OpenTelemetry GenAI Semantic Conventions Explained
The OpenTelemetry GenAI semantic conventions give LLM applications a shared vocabulary: how to name a model call, what to record about tokens, how to measure latency. They are still maturing, so it helps to know what is standard, what is not, and how to build useful dashboards on top. This guide explains the pieces and shows how to try them with synthetic data.
What the conventions cover
| Area | What it standardises | Examples |
|---|---|---|
| Spans | One span per model call, named for the operation and the model, with request and response attributes | gen_ai.request.model, gen_ai.response.model, gen_ai.response.finish_reasons, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens |
| Agent spans | A hierarchy for agent frameworks: an agent invocation containing model calls and tool calls | An invoke_agent span with child chat spans |
| Client metrics | Token counts and call duration measured by the caller | gen_ai.client.token.usage (split by input or output), gen_ai.client.operation.duration |
| Server metrics | Latency measured by the model server | gen_ai.server.time_to_first_token, gen_ai.server.time_per_output_token |
| Content | Prompts and completions, as opt-in events or attributes | Off by default because they can hold sensitive data |
What the conventions do not cover
Production LLM monitoring needs more than latency and tokens, and several of the things teams care about most have no standard name yet:
- Cost. Dollars per call depend on per-model pricing that changes; there is no standard metric.
- Quality. Groundedness, relevance, hallucination rate and context relevance (for retrieval) come from evaluation, not from the call itself.
- Safety. Counts of detected personal data or prompt-injection attempts.
- Agent accuracy. Whether the agent picked the right tool.
OTel Studio puts these in a separate llm.* namespace on purpose — llm.cost.usd, llm.eval.groundedness_score, llm.eval.relevance_score, llm.rag.context_relevance_score, llm.safety.* and llm.agent.* — so that custom signals never masquerade as standard ones. That is good practice for your own instrumentation too: keep your own metrics under your own prefix, and migrate when a standard arrives.
Try it with synthetic data
- Start the AI Observability simulator at 30 calls a minute (Simulators → AI Observability). It simulates eight models from five providers.
- Run a GenAI scenario beside it — RAG Chatbot or Agent Workflow — to get spans with the span attributes above.
- In your backend, plot tokens by model, p95 call duration and time to first token, and spend per hour per model.
- Switch on the failure modes one at a time (cost spike, latency spike, high error rate, quality degradation) and check the right panels and alerts react.
The full walkthrough, with a test plan, is in Test GenAI Observability Dashboards.
Design tips
- Split by provider and model everywhere; averages across models hide the expensive one.
- Separate input from output tokens — they are priced differently and grow differently.
- Alert on rate of change of cost, not just absolute spend, so a runaway prompt is caught within minutes.
- Treat captured prompts as sensitive data and run them through redaction (see Test PII Redaction).