AI architecture

LLM observability with OpenTelemetry: what to trace, what to leave out, and why it matters

You can't manage cost, latency or quality in an LLM system you can't see. OpenTelemetry now has conventions for exactly this. Here is how I use them without leaking sensitive data into your logs.

ExplainerSumanta Mukhopadhyay7 min read5 sources
#ai#observability#opentelemetry#llm#agents
EXPLAINER · AI ARCHITECTURE19 Oct 2026 · 00:15 GST

The first question I ask about any AI system in production is simple: for yesterday's traffic, what did each answer cost, how long did it take, and which ones went wrong? Most teams can't answer it. They have application logs and a monthly invoice from a model provider, and nothing in between.

That gap is closing. OpenTelemetry, the open standard most teams already use for traces and metrics, has semantic conventions for generative AI. They define how to record a model call, its token usage and the tools an agent invokes, so any compatible backend can show it1.

What the conventions give you

The OpenTelemetry blog walks through a real example. A trace from an agent shows a top-level invoke_agent span, child chat spans for each model call, and execute_tool spans for each tool invocation1.

Dashboard showing a GenAI trace with an agent span, model call spans and tool execution spans
A GenAI trace: one agent invocation broken into model calls and tool executions, each with its own timing. Source: OpenTelemetry authors, Inside the LLM Call: GenAI Observability with OpenTelemetry · CC BY 4.0

Each span carries standard attributes, including the model requested, input and output token counts, and the reasons the model stopped generating12. There are matching metrics conventions, so you can chart usage and latency without parsing logs3, and separate conventions for agent and framework spans4.

Why this matters more than it sounds

QuestionWhat answers it
Which feature is driving the bill?Token counts per span, grouped by service and route
Why is this answer slow?The span tree: model time versus tool time versus retrieval
Why did the agent loop?Repeated tool spans and finish reasons inside one trace
Did the new model make things worse?Latency and error metrics split by model, before and after

Because it is the same OpenTelemetry you use elsewhere, an AI call shows up inside the request that triggered it. You see the database query, the retrieval step and the model call on one timeline, instead of three tools that never agree.

Privacy: metadata yes, content by exception

This is the part I am strict about. Prompts and completions can contain personal data, health information or confidential documents. The OpenTelemetry walkthrough notes that by default no prompt content or tool arguments are captured, only metadata such as model names, token counts and durations. Content capture is an explicit opt-in1.

Keep it that way in production. Turn on content capture only in development, in a sandbox with synthetic data, or behind redaction at an AI gateway. A trace store full of raw prompts is a data breach waiting for a misconfigured dashboard.

This lines up with how I design governed AI platforms generally, which I describe in securing MCP servers and UAE PDPL and AI.

A caution on stability

The GenAI conventions are still marked as in development on the official pages, and existing instrumentations can opt in to the newest experimental version with an environment variable2. Attribute names have already changed between versions; one commentary notes, for example, a move from gen_ai.system to gen_ai.provider.name5.

That is not a reason to wait. It is a reason to pin the version you emit, keep dashboards tolerant of renamed attributes, and plan a small migration when the conventions settle.

How I set it up

  1. Instrument at the gateway. If every model call passes through one AI gateway, instrument it once and every product inherits the telemetry.
  2. Add agent and tool spans in the orchestration layer, so a multi-step task appears as one trace rather than a pile of unrelated calls.
  3. Tag with business context: tenant, feature and use case. Cost per feature is the number leadership actually asks for.
  4. Metadata only in production. Content capture off, redaction on, retention short.
  5. Build three views: cost per feature per day, latency by step, and failures by finish reason and tool.
  6. Connect to evaluation. Link trace IDs to your evaluation runs so a quality regression can be traced to a specific prompt or model change. The RAG production checklist covers the evaluation side.

How I can help

I design AI platforms where cost, latency and quality are visible from day one: gateways, tracing, evaluation and governance. See my AI architecture work, or analyse your challenge and bring the result to a call.

References
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
FAQ

Common questions

What are the OpenTelemetry GenAI semantic conventions?

They are a standard set of span, metric and event names and attributes for generative AI operations, covering things like the model called, input and output token counts, finish reasons and tool calls. Using them means any OpenTelemetry-compatible backend can read your AI telemetry.

Are the GenAI conventions stable?

Not yet. The official pages mark them as in development, and existing instrumentations can opt in to the latest experimental version with an environment variable. Expect attribute names to change and pin the version you use.

Should I log full prompts and completions?

Not by default. Prompts and outputs can contain personal or confidential data. Capture metadata such as model, tokens and latency everywhere, and enable content capture only in controlled environments or with redaction.

Keep reading

Related

Open to advisory, fractional CTO & select builds

Let's talk about what you're building.

The fastest route is a free 30-minute call. Prefer to write? Send a message and I'll reply personally within two business days.

Start a conversation

How would you like to reach me?

Book a 30-min callFastest. Pick any open slot on my calendar.→ Write in GmailOpens a pre-filled draft in your browser.→ Use my email appOutlook, Apple Mail or your default client.→

I reply personally within two business days. US & UAE time zones.