[ ABORT TO HUD ]
SEQ. 1
SEQ. 2

Tracing with OpenTelemetry

📊 Observability & Monitoring 9 min 80 BASE XP

Understanding Agent Behavior

Foundry uses OpenTelemetry standards for distributed tracing, integrated with Azure Monitor Application Insights.

What Tracing Captures

  • LLM calls - Model, tokens, latency, response
  • Tool invocations - Which tools were called, with what arguments
  • Agent reasoning - Decision chains and state transitions
  • Errors - Failed calls, timeouts, content filter triggers

Setup in Code

from azure.monitor.opentelemetry import configure_azure_monitor

# One line to enable full tracing:
configure_azure_monitor(
    connection_string="InstrumentationKey=xxx;..."
)

# All subsequent SDK calls are automatically traced!

Viewing Traces

Traces are viewable in two places:

  • Foundry Portal → Tracing - Quick inspection of agent runs
  • Application Insights → Logs - Advanced KQL queries for deep analysis
🎯 Pro Tip: Always enable tracing in production. When an agent fails, traces show you the exact reasoning chain that led to the failure - invaluable for debugging complex multi-step workflows.
FOUNDRY VERIFICATION
QUERY 1 // 1
What standard does Azure AI Foundry use for distributed tracing?
Custom Microsoft protocol
OpenTelemetry
Log4j
Syslog