Azure AI Agents: add az.namespace attribute and schema url#42015
Merged
lmolkova merged 4 commits intoAzure:mainfrom Jul 17, 2025
Merged
Azure AI Agents: add az.namespace attribute and schema url#42015lmolkova merged 4 commits intoAzure:mainfrom
az.namespace attribute and schema url#42015lmolkova merged 4 commits intoAzure:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds the az.namespace attribute and OpenTelemetry schema URL to spans in the Azure AI Agents library for consistent telemetry reporting.
- Defines new constants for namespace and schema version in
_utils.pyand updatesstart_spanto pass the schema version and addaz.namespace - Imports namespace constants in the instrumentor (
_ai_agents_instrumentor.py) - Updates tests (
gen_ai_trace_verifier.py) to verify the schema URL and expected namespace attribute
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/gen_ai_trace_verifier.py | Asserts instrumentation scope’s schema URL and includes az.namespace in expected attributes |
| telemetry/_utils.py | Adds AZ_NAMESPACE, AZ_NAMESPACE_VALUE, GEN_AI_SEMCONV_SCHEMA_VERSION, and updates span instantiation to include schema_version and namespace attribute |
| telemetry/_ai_agents_instrumentor.py | Imports new namespace constants for use in instrumentation |
Comments suppressed due to low confidence (3)
sdk/ai/azure-ai-agents/tests/gen_ai_trace_verifier.py:19
- The test only checks attribute presence; add an assertion like
assert span.attributes["az.namespace"] == "Microsoft.CognitiveServices"to verify the value is correct.
attribute_dict["az.namespace"] = "Microsoft.CognitiveServices"
sdk/ai/azure-ai-agents/azure/ai/agents/telemetry/_utils.py:55
- [nitpick] This constant holds a schema URL version but is named
..._VERSION, which may be confusing. Consider renaming toGEN_AI_SEMCONV_SCHEMA_URLif you store the full URL, or include the full URL in this constant.
GEN_AI_SEMCONV_SCHEMA_VERSION = "1.34.0"
sdk/ai/azure-ai-agents/azure/ai/agents/telemetry/_ai_agents_instrumentor.py:50
- [nitpick] Imported
AZ_NAMESPACEandAZ_NAMESPACE_VALUEbut they are not used in this file. Remove the unused imports or add code to utilize them for consistency.
AZ_NAMESPACE,
jhakulin
reviewed
Jul 15, 2025
jhakulin
approved these changes
Jul 15, 2025
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 used by the Azure Monitor to distinguish telemetry coming from different Azure SDKs and simplify resource discovery based on telemetry. This works along with #42016All azure SDKs should report it, but it's missing in agents.
Schema URL is used to help telemetry consumers map telemetry format and deal with breaking changes (that are coming to GenAI conventions - open-telemetry/semantic-conventions#2046)