-
Notifications
You must be signed in to change notification settings - Fork 294
Add Self Diagnostics feature #3070
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
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 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.
...soft.ApplicationInsights/Extensibility/Implementation/Tracing/SelfDiagnosticsConfigParser.cs
Outdated
Show resolved
Hide resolved
...icrosoft.ApplicationInsights/Extensibility/Implementation/Tracing/MemoryMappedFileHandler.cs
Outdated
Show resolved
Hide resolved
...oft.ApplicationInsights/Extensibility/Implementation/Tracing/SelfDiagnosticsEventListener.cs
Show resolved
Hide resolved
...soft.ApplicationInsights/Extensibility/Implementation/Tracing/SelfDiagnosticsConfigParser.cs
Show resolved
Hide resolved
...osoft.ApplicationInsights/Extensibility/Implementation/Tracing/SelfDiagnosticsInitializer.cs
Outdated
Show resolved
Hide resolved
...sts/Extensibility/Implementation/Tracing/SelfDiagnostics/SelfDiagnosticsEventListenerTest.cs
Show resolved
Hide resolved
...sts/Extensibility/Implementation/Tracing/SelfDiagnostics/SelfDiagnosticsEventListenerTest.cs
Show resolved
Hide resolved
...t.ApplicationInsights/Extensibility/Implementation/Tracing/SelfDiagnosticsConfigRefresher.cs
Show resolved
Hide resolved
...s/Extensibility/Implementation/Tracing/SelfDiagnostics/SelfDiagnosticsConfigRefresherTest.cs
Outdated
Show resolved
Hide resolved
...oft.ApplicationInsights/Extensibility/Implementation/Tracing/SelfDiagnosticsEventListener.cs
Outdated
Show resolved
Hide resolved
rajkumar-rangaraj
left a comment
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.
LGTM, check copilot comments are applicable.
Fix Issue #3056.
Changes
(Please provide a brief description of the changes here.)
Checklist
For significant contributions please make sure you have completed the following items:
The PR will trigger build, unit tests, and functional tests automatically. Please follow these instructions to build and test locally.
Notes for authors: