-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[AzureMonitorExporter] Add Microsoft override attributes for Application Insights compatibility #54023
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: main
Are you sure you want to change the base?
[AzureMonitorExporter] Add Microsoft override attributes for Application Insights compatibility #54023
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 Microsoft-specific override attributes to enable Application Insights SDK to preserve exact telemetry semantics when transitioning to OpenTelemetry-based instrumentation. The changes introduce new semantic convention constants for request and dependency override attributes, update the activity processor to recognize them, and modify telemetry data models to apply these overrides with precedence over computed values from standard OpenTelemetry conventions.
Key changes:
- Introduced 10 new Microsoft override attribute constants in
SemanticConventions.csfor requests, dependencies, and operations - Fixed a bug in
AzMonList.GetTagValue()changing fromReferenceEqualsto proper string comparison - Modified
RequestDataandRemoteDependencyDataconstructors to check for and apply override attributes when present - Added comprehensive test coverage for override attribute functionality
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| SemanticConventions.cs | Adds 10 new Microsoft override attribute constants with documentation; has inconsistent visibility modifiers between attributes |
| ActivityTagsProcessor.cs | Adds override attributes to semantics list and introduces HasOverrideAttributes flag for optimization |
| AzMonList.cs | Fixes string comparison bug by changing from ReferenceEquals to string.Equals with ordinal comparison |
| RequestData.cs | Adds override attribute processing logic, but implementation has a critical bug where TraceHelper will overwrite the Name field |
| RemoteDependencyData.cs | Adds override attribute processing with correct precedence; changes Azure namespace Type behavior |
| RequestDataTests.cs | Adds comprehensive tests for request overrides, but tests don't reflect actual production code path through TraceHelper |
| RemoteDependencyDataTests.cs | Adds comprehensive tests for dependency overrides with proper coverage of different dependency types |
Description
Added support for Microsoft-specific override attributes to preserve exact Application Insights semantics when exporting telemetry data. These attributes allow the exporter to use the precise values from Application Insights telemetry instead of computing them from OpenTelemetry semantic conventions.
Changes
microsoft.request.name,microsoft.request.url,microsoft.request.source,microsoft.request.resultCodemicrosoft.dependency.type,microsoft.dependency.target,microsoft.dependency.name,microsoft.dependency.data,microsoft.dependency.resultCodemicrosoft.operation_nameActivityTagsProcessorto recognize and process Microsoft override attributesRemoteDependencyData,RequestDatamodel to use override attributes when availableMotivation
The Application Insights SDK generates activities with specific telemetry values that may differ from standard OpenTelemetry semantic conventions. These override attributes ensure that when the SDK transitions to OpenTelemetry-based instrumentation, the exact Application Insights semantics are preserved for compatibility with existing monitoring dashboards and queries.
Testing