-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
Summary
The Agents (Preview) blade in Azure Application Insights requires the deprecated gen_ai.system OpenTelemetry attribute to render GenAI spans. The OpenTelemetry Semantic Conventions have replaced gen_ai.system with gen_ai.provider.name, and SDKs like langchain-azure-ai (AzureAIOpenTelemetryTracer) already emit gen_ai.provider.name correctly — but the dashboard does not read it.
Observed Behavior
- GenAI spans emitted by
langchain-azure-ai(v1.0.4) viaAzureAIOpenTelemetryTracerincludegen_ai.provider.name = "azure.ai.openai"but notgen_ai.system. - These spans appear correctly in the
dependenciestable with allgen_ai.*attributes (token counts, operation name, response model, etc.). - However, the Agents (Preview) view does not display them.
- When we inject
gen_ai.system = "openai"via a customSpanProcessor, the same spans render correctly in the Agents view withtype = "GenAI | openai".
Steps to Reproduce
- Configure
azure-monitor-opentelemetrywithconfigure_azure_monitor(). - Create an
AzureAIOpenTelemetryTracer(fromlangchain-azure-ai>=1.0.4) reusing the global OTel providers. - Invoke a LangChain chain that calls Azure OpenAI.
- Query
dependenciestable — GenAI spans are present withgen_ai.provider.namebut withoutgen_ai.system. - Open App Insights > Agents (Preview) — no data is rendered for these spans.
Expected Behavior
The Agents (Preview) dashboard should read gen_ai.provider.name (the current OpenTelemetry semantic convention) to identify and render GenAI spans, rather than relying exclusively on the deprecated gen_ai.system.
Current Workaround
We use a SpanProcessor that injects gen_ai.system into spans that have gen_ai.* attributes but are missing gen_ai.system:
class _GenAISystemSpanProcessor(SpanProcessor):
def on_end(self, span):
if not span.attributes:
return
has_genai = any(k.startswith("gen_ai.") for k in span.attributes)
if has_genai and "gen_ai.system" not in span.attributes:
span._attributes["gen_ai.system"] = "openai"Environment
azure-monitor-opentelemetry (latest)
langchain-azure-ai>=1.0.4
Python 3.12
Deployed on AKS and tested locally via Docker Desktop
App Insights resource in West Europe
References
OTel Semantic Conventions: gen_ai.system deprecated in favor of gen_ai.provider.name
Azure AI Foundry: Trace agent frameworks with Application Insights