Distinguish Azure AI SDKs in statsbeats#42016
Merged
lmolkova merged 6 commits intoAzure:mainfrom Jul 17, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds support to differentiate Azure AI SDK spans from general Azure SDKs in statsbeats by inspecting the span’s instrumentation scope and the az.namespace attribute.
- Introduced a new
_AZURE_AI_SDK_NAMEconstant for Azure AI SDK instrumentation - Updated
_check_instrumentation_spanto detect any OpenTelemetry spans with scope names starting with “azure” and treat AI SDK calls specially - Appended the Azure AI SDK name into the instrumentation list in constants
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/trace/_exporter.py | Imported new constant and added branch to detect Azure AI SDK spans |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py | Defined _AZURE_AI_SDK_NAME, updated instrumentation list, and left a TODO for naming consistency |
Comments suppressed due to low confidence (2)
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_constants.py:198
- [nitpick] The constant value
"azure-ai"differs from other instrumentation names that include-opentelemetry. Consider renaming it (e.g.,"azure-ai-opentelemetry") or aligning naming conventions across SDKs.
_AZURE_AI_SDK_NAME = "azure-ai"
sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/trace/_exporter.py:534
- This new branch handles Azure SDK spans and AI-specific spans; please add unit tests to cover both the general Azure detection and the Microsoft.CognitiveServices (AI) path to ensure statsbeats metrics report correctly.
if span.instrumentation_scope.name.startswith("azure"):
lzchen
reviewed
Jul 15, 2025
lzchen
reviewed
Jul 15, 2025
…/opentelemetry/exporter/export/trace/_exporter.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/opentelemetry/exporter/export/trace/_exporter.py Co-authored-by: Leighton Chen <lechen@microsoft.com>
…/opentelemetry/exporter/_constants.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
6a8fffa to
194d05a
Compare
lzchen
approved these changes
Jul 17, 2025
Merged
Member
|
In response to breaking change which was released with OTel 1.35.0/0.56b0 |
6 tasks
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.
az.namespaceis set by very few of themThis works along with #42015