The OpenTelemetry GenAI conventions give LLM calls, agent steps and tool calls a shared vocabulary, so one dashboard can cover the OpenAI SDK, Bedrock, LangChain and your own spans. The catch is that the conventions are still in Development status and names have changed between releases. This sheet lists the names you will query, the renames that break dashboards, and queries that work on the common back ends. Always confirm against what your instrumentation actually emits.
Find out what you're emitting first
# Print spans locally to see real attribute names
export OTEL_TRACES_EXPORTER=console
export OTEL_METRICS_EXPORTER=console
opentelemetry-instrument python app.py
# Or in code: list attributes on the spans your app produces
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter
provider = TracerProvider()
provider.add_span_processor(SimpleSpanProcessor(ConsoleSpanExporter()))
Span names and operations
Client spans are named {gen_ai.operation.name} {gen_ai.request.model}, for example chat gpt-4o-mini.
gen_ai.operation.name | Used for |
|---|---|
chat | Chat completion style calls |
text_completion | Legacy completion APIs |
embeddings | Embedding calls |
generate_content | Multimodal content generation APIs |
execute_tool | A tool call executed by your code |
create_agent / invoke_agent | Agent creation and invocation |
Core span attributes
| Attribute | Example | Notes |
|---|---|---|
gen_ai.provider.name | openai, azure.ai.openai, aws.bedrock | Replaced gen_ai.system; older instrumentations still send the old name |
gen_ai.request.model | gpt-4o-mini | What you asked for (Azure: often the deployment name) |
gen_ai.response.model | gpt-4o-mini-2024-07-18 | What actually answered; use this to catch silent version changes |
gen_ai.request.max_tokens | 800 | |
gen_ai.request.temperature | 0.2 | Also top_p, stop_sequences, seed |
gen_ai.response.finish_reasons | ["stop"] | Array; length means truncated |
gen_ai.response.id | chatcmpl-... | Join to provider-side logs |
gen_ai.usage.input_tokens | 1834 | Was gen_ai.usage.prompt_tokens in early versions |
gen_ai.usage.output_tokens | 212 | Was gen_ai.usage.completion_tokens |
gen_ai.conversation.id | session ID | Group turns of one conversation |
gen_ai.agent.name / gen_ai.agent.id | triage-agent | On agent spans |
gen_ai.tool.name / gen_ai.tool.call.id | get_ticket | On execute_tool spans |
error.type | RateLimitError, 429 | Set on failure; pair with span status |
server.address / server.port | endpoint host | Tells you which region or gateway served it |
Prompt and completion content
Content is off by default in most instrumentations, because it can contain personal data.
| Setting | Effect |
|---|---|
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true | Python GenAI instrumentations record messages (as events or attributes depending on version) |
OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental | Opts some instrumentations into the newest convention names instead of the older ones |
gen_ai.input.messages, gen_ai.output.messages, gen_ai.system_instructions | Newer structured content attributes; older versions used per-message events such as gen_ai.user.message and gen_ai.choice |
Warning
Turning on content capture sends prompts and answers to your telemetry back end, with that back end's retention and access model. Redact before export, or capture content only in non-production, and check that trace access is as restricted as the data in the prompts.
Metrics
| Metric | Type | Key attributes |
|---|---|---|
gen_ai.client.token.usage | Histogram, {token} | gen_ai.token.type = input / output, operation, provider, request and response model |
gen_ai.client.operation.duration | Histogram, seconds | operation, provider, model, error.type |
gen_ai.server.request.duration | Histogram, seconds | For model servers you run |
gen_ai.server.time_to_first_token | Histogram, seconds | Model servers |
gen_ai.server.time_per_output_token | Histogram, seconds | Model servers |
Prometheus exporters rewrite dots to underscores and may append unit suffixes, so gen_ai.client.operation.duration usually appears as gen_ai_client_operation_duration_seconds_bucket. Check /metrics or your collector's output for the exact names.
PromQL
# Output tokens per minute by model
sum by (gen_ai_response_model) (
rate(gen_ai_client_token_usage_sum{gen_ai_token_type="output"}[5m])
) * 60
# p95 call latency by provider and model
histogram_quantile(0.95,
sum by (le, gen_ai_provider_name, gen_ai_request_model) (
rate(gen_ai_client_operation_duration_seconds_bucket[5m])))
# Error ratio by error type
sum by (error_type) (rate(gen_ai_client_operation_duration_seconds_count{error_type!=""}[5m]))
/ ignoring(error_type) group_left
sum (rate(gen_ai_client_operation_duration_seconds_count[5m]))
KQL (Azure Monitor Application Insights, workspace-based)
Client spans from the Azure Monitor OpenTelemetry distro land in AppDependencies, with gen_ai attributes in the Properties column.
// Tokens and latency per model, last 24 hours
AppDependencies
| where TimeGenerated > ago(24h)
| where isnotempty(Properties["gen_ai.request.model"])
| extend model = tostring(Properties["gen_ai.response.model"]),
provider = coalesce(tostring(Properties["gen_ai.provider.name"]),
tostring(Properties["gen_ai.system"])),
inTok = toint(Properties["gen_ai.usage.input_tokens"]),
outTok = toint(Properties["gen_ai.usage.output_tokens"])
| summarize calls=count(), inTok=sum(inTok), outTok=sum(outTok),
p95ms=percentile(DurationMs, 95), failed=countif(Success == false)
by provider, model
| order by outTok desc
// Answers cut off by max_tokens
AppDependencies
| where TimeGenerated > ago(24h)
| where tostring(Properties["gen_ai.response.finish_reasons"]) has "length"
| summarize truncated=count() by model=tostring(Properties["gen_ai.request.model"]), AppRoleName
// Requested model vs model that answered (catches auto-upgrades)
AppDependencies
| where TimeGenerated > ago(7d) and isnotempty(Properties["gen_ai.response.model"])
| summarize calls=count() by req=tostring(Properties["gen_ai.request.model"]),
resp=tostring(Properties["gen_ai.response.model"]), bin(TimeGenerated, 1d)
// Slowest tool calls inside agent runs
AppDependencies
| where TimeGenerated > ago(24h) and Name startswith "execute_tool"
| summarize p95ms=percentile(DurationMs, 95), errors=countif(Success == false)
by tool=tostring(Properties["gen_ai.tool.name"])
| order by p95ms desc
Renames that break dashboards
| Old | Current | Action |
|---|---|---|
gen_ai.system | gen_ai.provider.name | coalesce() both in queries during the transition |
gen_ai.usage.prompt_tokens | gen_ai.usage.input_tokens | Same |
gen_ai.usage.completion_tokens | gen_ai.usage.output_tokens | Same |
gen_ai.prompt / gen_ai.completion | Message events, then gen_ai.input.messages / gen_ai.output.messages | Rebuild content views |
Tip
Normalise names once in the OpenTelemetry Collector (a
transformprocessor that copies old keys to new ones) rather than in every query. Then dashboards and alerts survive the next instrumentation upgrade.
Prevent it next time
- Pin instrumentation package versions and read the changelog for convention changes before upgrading.
- Add a CI check that runs one test call with a console exporter and asserts the attributes your dashboards depend on exist.
- Alert on
gen_ai.response.modelvalues you haven't seen before and on risingfinish_reasonsoflength. - Keep content capture off in production unless redaction runs before export.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get