LLM Agent Observability: OpenTelemetry Pitfalls and Solutions
frisbeema52 · reddit · 2026-07-31
The author dives deep into instrumenting LLM agents with OpenTelemetry, sharing common pitfalls and solutions:
- OpenAIInstrumentor().instrument() exports nothing by default; a TracerProvider with exporter is required.
- OTELSEMCONVSTABILITYOPTIN is read at import time; set env var before importing.
- OTELINSTRUMENTATIONGENAICAPTUREMESSAGECONTENT is an enum, not boolean; passing true fails silently.
- On Node, @opentelemetry/instrumentation-openai is incompatible with openai 7.x; pin to 6.x.
- Span attributes don't inherit; use a span processor with ContextVar to propagate genai.conversation.id.
All failures are silent; code runs clean but backend empty. The author notes AI coding tools generate code but cannot verify observability output. Runnable Python/TS examples are provided.
More from coding & agent
- Study: Over-reliance on Coding Agents Hurts Code Comprehension — omarsar0 · 2026-07-31
- 10-Year Expert Shares How to Build AI Eval Systems — danielmckinn0n · 2026-07-31
- Awesome OpenClaw: Curated List of OpenClaw Ecosystem Resources — tom_doerr · 2026-07-31
- Hermes Agent Open-Source Skills: Buzz Integration and Media Attachments — Teknium · 2026-07-31
- AI Automates Freight Matching in 8 Minutes, Dispatchers Become Supervisors — avz008 · 2026-07-31
- From Basics to Agentic RL: A Deep Dive into LLM Tool Use — natolambert · 2026-07-31