File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
azure/ai/agents/telemetry Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 3838GEN_AI_SYSTEM = "gen_ai.system"
3939SERVER_ADDRESS = "server.address"
4040AZ_AI_AGENT_SYSTEM = "az.ai.agents"
41+ AZ_NAMESPACE = "az.namespace"
42+ AZ_NAMESPACE_VALUE = "Microsoft.CognitiveServices"
4143GEN_AI_TOOL_NAME = "gen_ai.tool.name"
4244GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id"
4345GEN_AI_REQUEST_RESPONSE_FORMAT = "gen_ai.request.response_format"
5052GEN_AI_RUN_STEP_STATUS = "gen_ai.run_step.status"
5153ERROR_TYPE = "error.type"
5254ERROR_MESSAGE = "error.message"
53-
55+ GEN_AI_SEMANTIC_CONVENTIONS_SCHEMA_VERSION = "1.34.0"
5456
5557class OperationName (Enum ):
5658 CREATE_AGENT = "create_agent"
@@ -114,9 +116,11 @@ def start_span(
114116 if _span_impl_type is None :
115117 return None
116118
117- span = _span_impl_type (name = span_name or operation_name .value , kind = kind )
119+
120+ span = _span_impl_type (name = span_name or operation_name .value , kind = kind , schema_version = GEN_AI_SEMANTIC_CONVENTIONS_SCHEMA_VERSION )
118121
119122 if span and span .span_instance .is_recording :
123+ span .add_attribute (AZ_NAMESPACE , AZ_NAMESPACE_VALUE )
120124 if gen_ai_system :
121125 span .add_attribute (GEN_AI_SYSTEM , AZ_AI_AGENT_SYSTEM )
122126
Original file line number Diff line number Diff line change 1212class GenAiTraceVerifier :
1313
1414 def check_span_attributes (self , span , attributes ):
15+ assert "https://opentelemetry.io/schemas/1.34.0" == span .instrumentation_scope .schema_url
16+
1517 # Convert the list of tuples to a dictionary for easier lookup
1618 attribute_dict = dict (attributes )
19+ attribute_dict ["az.namespace" ] = "Microsoft.CognitiveServices"
1720
1821 for attribute_name in span .attributes .keys ():
1922 # Check if the attribute name exists in the input attributes
You can’t perform that action at this time.
0 commit comments