-
Notifications
You must be signed in to change notification settings - Fork 263
feat: slogai #4194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: slogai #4194
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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). |
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:

