Skip to content

feat: slogai#4194

Open
nddq wants to merge 1 commit intomasterfrom
slogai
Open

feat: slogai#4194
nddq wants to merge 1 commit intomasterfrom
slogai

Conversation

@nddq
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread slogai/handler.go Outdated
Comment thread slogai/encoder_test.go
Comment thread slogai/benchmark_test.go
Comment thread slogai/handler_test.go Outdated
Comment thread slogai/benchmark_test.go
Comment thread slogai/encoder_test.go
Comment thread slogai/benchmark_test.go
Comment thread slogai/benchmark_test.go
Comment thread slogai/benchmark_test.go
Comment thread slogai/async_sink_test.go
Signed-off-by: Quang Nguyen <nguyenquang@microsoft.com>
@nddq
Copy link
Copy Markdown
Member Author

nddq commented Jan 19, 2026

/azp run Azure Container Networking PR

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Collaborator

@rbtr rbtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be nice if there was a maintained ApplicationInsights-Go package where standard Go logging bindings could live 😒

@github-actions
Copy link
Copy Markdown

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

@github-actions github-actions Bot added the stale Stale due to inactivity. label Feb 12, 2026
@nddq nddq removed the stale Stale due to inactivity. label Feb 12, 2026
@github-actions
Copy link
Copy Markdown

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

@github-actions github-actions Bot added the stale Stale due to inactivity. label Feb 27, 2026
@nddq nddq removed the stale Stale due to inactivity. label Feb 27, 2026
@rbtr rbtr enabled auto-merge February 27, 2026 02:22
@github-actions
Copy link
Copy Markdown

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

@github-actions github-actions Bot added the stale Stale due to inactivity. label Mar 14, 2026
@github-actions
Copy link
Copy Markdown

Pull request closed due to inactivity.

@github-actions github-actions Bot closed this Mar 22, 2026
auto-merge was automatically disabled March 22, 2026 00:03

Pull request was closed

@github-actions github-actions Bot deleted the slogai branch March 22, 2026 00:03
@rbtr rbtr added exempt-stale Keep this fresh and removed stale Stale due to inactivity. labels Mar 23, 2026
@rbtr rbtr restored the slogai branch March 23, 2026 17:15
@rbtr rbtr reopened this Mar 23, 2026
@rbtr rbtr enabled auto-merge March 23, 2026 17:15
@rbtr rbtr requested a review from QxBytes March 23, 2026 17:16
@nddq
Copy link
Copy Markdown
Member Author

nddq commented Mar 23, 2026

recently scroll through my GitHub feed and this exists apparently 🙃 https://github.com/openclosed-dev/slogan (from @paulgmiller paulgmiller/careme#287)

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

Labels

exempt-stale Keep this fresh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants