Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds slogai, a new package that provides a slog handler for sending structured logs to Azure Application Insights. The package is inspired by the existing zapai implementation and includes synchronous/asynchronous sinks, field redaction, field mappers, and drop policies for high-throughput scenarios.
Changes:
- New
slogaipackage with full slog.Handler implementation for Application Insights - Synchronous and asynchronous sink support with configurable batching and drop policies
- Field mapping system to transform slog attributes to Application Insights context tags
- Sensitive data redaction capabilities for PII filtering
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| slogai/go.mod | Module definition with dependencies |
| slogai/go.sum | Dependency checksums |
| slogai/handler.go | Core slog.Handler implementation with field mapping and redaction |
| slogai/handler_test.go | Comprehensive tests for handler functionality |
| slogai/sink.go | Synchronous sink implementation for Application Insights |
| slogai/sink_test.go | Tests for sink functionality |
| slogai/async_sink.go | Asynchronous buffered sink with drop policies |
| slogai/async_sink_test.go | Tests for async sink functionality |
| slogai/encoder.go | Gob-based encoder/decoder for TraceTelemetry |
| slogai/encoder_test.go | Tests for encoder/decoder |
| slogai/mappers.go | Field mapper definitions for Application Insights context tags |
| slogai/mappers_test.go | Tests for field mappers |
| slogai/benchmark_test.go | Performance benchmarks |
| slogai/example/main.go | Example program demonstrating package usage |
| slogai/README.md | Documentation with usage examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
rbtr
left a comment
There was a problem hiding this comment.
Wouldn't it be nice if there was a maintained ApplicationInsights-Go package where standard Go logging bindings could live 😒
|
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
|
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
|
This pull request is stale because it has been open for 2 weeks with no activity. Remove stale label or comment or this will be closed in 7 days |
|
Pull request closed due to inactivity. |
Pull request was closed
|
recently scroll through my GitHub feed and this exists apparently 🙃 https://github.com/openclosed-dev/slogan (from @paulgmiller paulgmiller/careme#287) |
Summary
Adds
slogai, a new package that provides a slog handler for sending structured logs to Azure Application Insights. Inspired from @rbtr's zapai with some help from Claude for some enhancements, tests and documentation.Features:
slog.Handlerimplementation for Application InsightsTest plan
Logs in Application Insights:

