Skip to content

Conversation

@nddq
Copy link
Member

@nddq nddq commented Jan 14, 2026

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:

  • Standard slog.Handler implementation for Application Insights
  • Synchronous and asynchronous sinks with configurable batching
  • Field redaction for sensitive data
  • Field mappers for Application Insights context (cloud role, operation ID, etc.)
  • Drop policies for high-throughput scenarios

Test plan

  • Unit tests pass
  • Example program tested against live Application Insights instance

Logs in Application Insights:
image
image

@nddq nddq marked this pull request as ready for review January 14, 2026 15:56
@nddq nddq requested a review from a team as a code owner January 14, 2026 15:56
@nddq nddq requested review from MikeZappa87 and Copilot January 14, 2026 15:56
Copy link
Contributor

Copilot AI left a 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 slogai package 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>
@nddq
Copy link
Member Author

nddq commented Jan 19, 2026

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants