Fix usage of deprecated telemetry tags#48187
Open
alzimmermsft wants to merge 1 commit intoAzure:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Azure SDK for Java OpenTelemetry tracing to emit both deprecated and replacement telemetry attributes for Azure namespace and service request ID, maintaining backwards compatibility while aligning with newer OpenTelemetry semantic conventions.
Changes:
- Updated attribute mapping to duplicate
az.namespace->azure.resource_provider.namespaceandaz.service_request_id->azure.service.request.id. - Adjusted core tracing + HTTP policy tests to validate presence of both old and new attributes.
- Updated Service Bus, Event Hubs, and AI Inference tracer tests to assert the new replacement attribute is also present.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/servicebus/azure-messaging-servicebus/src/test/java/com/azure/messaging/servicebus/TracingIntegrationTests.java | Extends span assertions to validate azure.resource_provider.namespace is emitted alongside az.namespace. |
| sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TestSpanProcessor.java | Adds assertion for azure.resource_provider.namespace for Event Hubs spans. |
| sdk/core/azure-core-tracing-opentelemetry/src/test/java/com/azure/core/tracing/opentelemetry/OpenTelemetryTracerTest.java | Updates expectations to require both deprecated and replacement attributes across span creation paths. |
| sdk/core/azure-core-tracing-opentelemetry/src/test/java/com/azure/core/tracing/opentelemetry/OpenTelemetryHttpPolicyTests.java | Updates HTTP tracing tests to validate both namespace and service request id attributes, and ensures response bodies are consumed before assertions. |
| sdk/core/azure-core-tracing-opentelemetry/src/test/java/com/azure/core/tracing/opentelemetry/CreateTracerTests.java | Updates tracer-creation tests to validate both namespace attributes are set. |
| sdk/core/azure-core-tracing-opentelemetry/src/main/java/com/azure/core/tracing/opentelemetry/OpenTelemetryUtils.java | Implements key-mapping that duplicates deprecated attributes into their replacements during attribute population. |
| sdk/core/azure-core-tracing-opentelemetry/src/main/java/com/azure/core/tracing/opentelemetry/OpenTelemetryTracer.java | Uses the updated attribute-addition mapping when setting az.namespace so both tags are emitted. |
| sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md | Documents the addition of the replacement attributes while keeping deprecated ones for now. |
| sdk/ai/azure-ai-inference/src/test/java/com/azure/ai/inference/ChatCompletionClientTracerTest.java | Adds assertion for azure.resource_provider.namespace in AI inference tracing tests. |
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.
Description
Fixes #48068
Updates tag usage of
az.namespaceto include additionalazure.resource_provider.namespacetag, which is the replacement foraz.namespace, and same foraz.service_request_idto addazure.service.request.id. In both cases, both the deprecated and replacement tags will be included in telemetry to maintain backwards compatibility. Eventually, the deprecated tags will be removed from telemetry.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines