Override mappings for context from the shim#56813
Merged
harsimar merged 12 commits intoAzure:mainfrom Mar 23, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Azure Monitor OpenTelemetry Exporter to treat additional Application Insights shim context values as envelope tags (instead of custom dimensions), aiming for consistent behavior across telemetry types (including metrics), and adds an environment-variable override for application/component version.
Changes:
- Adds support for overriding
ai.application.verviaAPPLICATIONINSIGHTS_COMPONENT_VERSION. - Introduces new shim context tag attribute constants and mapping paths (Activity tags, log attributes, and metric tags) to populate
TelemetryItem.Tags. - Updates/extends E2E and unit tests to validate the new context-tag-to-envelope-tag behavior.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/Models/TelemetryItem.cs | Adds environment variable override for component version; copies/mapping of additional context tags into envelope tags. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ActivityTagsProcessor.cs | Extends the set of recognized Activity semantic attributes for shim context tags. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogsHelper.cs | Extends log attribute extraction into LogContextInfo for mapping into envelope tags. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogContextInfo.cs | Adds new extracted context fields for logs. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/MetricHelper.cs | Adds metric-tag-to-envelope-tag mapping hook for metrics. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/SemanticConventions.cs | Adds constants for shim context attributes. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/SchemaConstants.cs | Adds max-length constants for newly mapped envelope tags. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/Platform/EnvironmentVariableConstants.cs | Adds APPLICATIONINSIGHTS_COMPONENT_VERSION constant and includes it in override-related environment variable sets. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/**/TelemetryItemTests.cs | Adds unit test for APPLICATIONINSIGHTS_COMPONENT_VERSION override. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/**/LogsHelperTests.cs | Removes user-agent log-context test coverage and updates combined-context tests accordingly. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/**/E2ETelemetryItemValidation/TracesTests.cs | Adds E2E validation that shim context attributes map to envelope tags and not custom dimensions for traces. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/**/E2ETelemetryItemValidation/LogsTests.cs | Adds E2E validation that shim context attributes map to envelope tags and not custom dimensions for logs. |
| sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/tests/**/E2ETelemetryItemValidation/MetricsTests.cs | Adds an Internals using (currently unused). |
You can also share your feedback on Copilot code review. Take the survey.
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/Models/TelemetryItem.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/MetricHelper.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/SemanticConventions.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ActivityTagsProcessor.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogsHelper.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/Models/TelemetryItem.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/Models/TelemetryItem.cs
Outdated
Show resolved
Hide resolved
.../tests/Azure.Monitor.OpenTelemetry.Exporter.Tests/E2ETelemetryItemValidation/MetricsTests.cs
Outdated
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/SchemaConstants.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/LogContextInfo.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/MetricHelper.cs
Outdated
Show resolved
Hide resolved
mattsains-msft
approved these changes
Mar 23, 2026
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/Models/TelemetryItem.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/MetricHelper.cs
Outdated
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/Models/TelemetryItem.cs
Show resolved
Hide resolved
mattsains-msft
approved these changes
Mar 23, 2026
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Internals/ActivityTagsProcessor.cs
Show resolved
Hide resolved
sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/src/Customizations/Models/TelemetryItem.cs
Outdated
Show resolved
Hide resolved
rajkumar-rangaraj
approved these changes
Mar 23, 2026
harsimar
added a commit
to harsimar/azure-sdk-for-net
that referenced
this pull request
Mar 27, 2026
…1 release Added PR links to existing entries and new changelog items: - Azure#57194: Gen-ai attribute truncation (256KB limit) - Azure#56813: Classic TelemetryContext tag mapping - Azure#56368: AOT warning regression fix - Azure#56891: ApplicationInsightsRestClientSettings PR link Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
harsimar
added a commit
to harsimar/azure-sdk-for-net
that referenced
this pull request
Mar 27, 2026
…ure#56813 from changelog Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
harsimar
added a commit
that referenced
this pull request
Mar 27, 2026
* Update Azure.Monitor.OpenTelemetry.Exporter CHANGELOG for 1.7.0-beta.1 release Added PR links to existing entries and new changelog items: - #57194: Gen-ai attribute truncation (256KB limit) - #56813: Classic TelemetryContext tag mapping - #56368: AOT warning regression fix - #56891: ApplicationInsightsRestClientSettings PR link Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update Azure.Monitor.OpenTelemetry.Exporter to 1.7.0 GA and remove #56813 from changelog Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to: microsoft/ApplicationInsights-dotnet#3137
This PR is to ensure that context set from the shim shows up as tags (not custom dimensions) in most telemetry types (not including metrics)