Skip to content

Conversation

@xiang17
Copy link
Member

@xiang17 xiang17 commented Jan 7, 2026

Fix Issue #3056.

Changes

(Please provide a brief description of the changes here.)

Checklist

  • I ran Unit Tests locally.
  • CHANGELOG.md updated with one line description of the fix, and a link to the original issue if available.

For significant contributions please make sure you have completed the following items:

  • Design discussion issue #
  • Changes in public surface reviewed

The PR will trigger build, unit tests, and functional tests automatically. Please follow these instructions to build and test locally.

Notes for authors:

  • FxCop and other analyzers will fail the build. To see these errors yourself, compile localy using the Release configuration.

@xiang17 xiang17 marked this pull request as ready for review January 8, 2026 02:08
Copilot AI review requested due to automatic review settings January 8, 2026 02:08
Copy link

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 back the Self Diagnostics feature to Application Insights, which captures EventSource events from Application Insights modules and writes them to local files for internal troubleshooting. The feature uses memory-mapped files for efficient circular logging with configurable log levels and file sizes.

Key changes include:

  • New self-diagnostics infrastructure with configuration parsing, event listening, and file handling
  • Integration into TelemetryConfiguration to automatically initialize the feature
  • Comprehensive test coverage for all new components

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 21 comments.

Show a summary per file
File Description
CHANGELOG.md Added changelog entry documenting the feature addition
TelemetryConfiguration.cs Initializes self-diagnostics on configuration construction
SelfDiagnosticsInitializer.cs Manages lifecycle of self-diagnostics with singleton pattern
SelfDiagnosticsEventListener.cs Listens to EventSource events and writes formatted logs
SelfDiagnosticsConfigRefresher.cs Periodically checks and applies configuration updates
SelfDiagnosticsConfigParser.cs Parses JSON configuration from file or environment variable
MemoryMappedFileHandler.cs Handles circular writing to memory-mapped log files
CoreEventSource.cs Adds event for self-diagnostics file creation failures
Microsoft.ApplicationInsights.Tests.csproj Adds Moq package reference for testing
SelfDiagnosticsEventListenerTest.cs Tests event listener encoding and filtering logic
SelfDiagnosticsConfigRefresherTest.cs Tests configuration refresh and event capture
SelfDiagnosticsConfigParserTest.cs Tests JSON configuration parsing
MemoryMappedFileHandlerTest.cs Tests file handling and circular writing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@rajkumar-rangaraj rajkumar-rangaraj left a comment

Choose a reason for hiding this comment

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

LGTM, check copilot comments are applicable.

@xiang17 xiang17 merged commit 278a00e into main Jan 8, 2026
22 checks passed
@xiang17 xiang17 deleted the xiang17/SelfDiagnostics branch January 8, 2026 22:43
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.

3 participants