Repository navigation
Add an agent OpenTelemetry tracing example - #1168
Conversation
Go has otelprovider but no sample. Add an example that installs a stdout OpenTelemetry tracer and wraps a Foundry agent with the otel middleware, so the agent run emits a gen_ai invoke_agent span (model, usage, finish reason) printed to stdout. Registered with cmd/verifyexamples (env-gated).
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The example description claims a model attribute that the middleware does not emit.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Adds an OpenTelemetry tracing example for Foundry agents and registers it with verifyexamples.
Changes:
- Exports agent spans to stdout.
- Registers environment-gated example verification.
| File | Description |
|---|---|
examples/02-agents/observability/step01_agent_tracing/main.go |
New agent tracing sample |
cmd/verifyexamples/examples.go |
Registers the sample for verification |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
# Conflicts: # cmd/verifyexamples/examples.go
This comment has been minimized.
This comment has been minimized.
# Conflicts: # cmd/verifyexamples/examples.go
API consistency review
Changed Go contractNone to exported APIs. Adds the sample Upstream evidence reviewed
AssessmentBoth upstream SDKs have an agent tracing sample, and the Go sample covers the same scenario. It is placed under a matching
|

Go has
otelprovider(an OpenTelemetry tracing middleware) butexamples/has no sample, unlike the .NETAgentOpenTelemetrysample.Change
examples/02-agents/observability/step01_agent_tracingthat installs a stdout OpenTelemetry tracer (stdouttrace, already a dependency) as the global provider and wraps a Foundry agent withotelprovider.NewMiddleware, so the run emits agen_aiinvoke_agentspan (model, usage, finish reason) printed to stdout.cmd/verifyexamples(env-gated onFOUNDRY_PROJECT_ENDPOINT).Builds,
go vet,gofumptclean; nogo.modchanges; theverifyexamplestest passes.