Skip to content

Commit 281c0ff

Browse files
committed
Align agent spans with latest semconv
1 parent 7911030 commit 281c0ff

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lab/5-Observability/01-trace-agent-session.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
" span.set_attribute(\"gen_ai.request.model\", \"gpt-4o-mini\")\n",
8181
" span.set_attribute(\"gen_ai.system_instructions\", system_prompt)\n",
8282
" span.set_attribute(\"server.address\", \"cora-agents.eastus2.inference.ai.azure.com\")\n",
83+
" span.set_attribute(\"server.port\", 443)\n",
8384
" span.set_attribute(\"azure.resource_provider.namespace\", \"Microsoft.CognitiveServices\")\n",
8485
"\n",
8586
"with tracer.start_as_current_span(\"invoke_agent cora-retail-agent\", kind=SpanKind.CLIENT) as span:\n",

lab/5-Observability/02-collect-span-snapshots.ipynb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,14 @@
6363
" \"⚡ Absolutely! Zava SwiftCoat Satin at $32 dries in 30 minutes. \"\n",
6464
" \"Want rollers too?\"\n",
6565
" )\n",
66+
" conversation_id = \"retail-session-002\"\n",
6667
"\n",
6768
" with tracer.start_as_current_span(\"invoke_agent cora-retail-agent\", kind=SpanKind.CLIENT) as span:\n",
6869
" span.set_attribute(\"gen_ai.provider.name\", \"azure.ai.inference\")\n",
6970
" span.set_attribute(\"gen_ai.operation.name\", \"invoke_agent\")\n",
7071
" span.set_attribute(\"gen_ai.agent.name\", \"cora-retail-agent\")\n",
72+
" span.set_attribute(\"gen_ai.agent.id\", \"agents/cora-retail-agent\")\n",
73+
" span.set_attribute(\"gen_ai.agent.description\", \"Cora retail assistant for Zava DIY customers.\")\n",
7174
" span.set_attribute(\"gen_ai.request.model\", \"gpt-4o-mini\")\n",
7275
" span.set_attribute(\"gen_ai.request.max_tokens\", 256)\n",
7376
" span.set_attribute(\"gen_ai.request.temperature\", 0.3)\n",
@@ -77,6 +80,8 @@
7780
" span.set_attribute(\"gen_ai.response.id\", \"resp-31f1\")\n",
7881
" span.set_attribute(\"gen_ai.usage.input_tokens\", 98)\n",
7982
" span.set_attribute(\"gen_ai.usage.output_tokens\", 41)\n",
83+
" span.set_attribute(\"gen_ai.conversation.id\", conversation_id)\n",
84+
" span.set_attribute(\"gen_ai.system_instructions\", system_prompt)\n",
8085
" span.set_attribute(\"gen_ai.input.messages\", json.dumps([\n",
8186
" {\"role\": \"system\", \"content\": system_prompt},\n",
8287
" {\"role\": \"user\", \"content\": customer_prompt}\n",

0 commit comments

Comments
 (0)