Last updated:
About GenAI Spans
GenAI spans describe calls to large language models, AI agents, and the tools they use. They follow the OpenTelemetry semantic conventions for generative AI, which define the gen_ai.* attributes Dash0 reads.
Dash0 uses GenAI spans to:
- Inspect GenAI spans: The Gen AI tab of the span sidebar groups a span's
gen_ai.*attributes into identity, parameters, token usage, response, and tool call details. - Compute GenAI metrics: Token usage, cost, chats, and tool calls, derived from span attributes. See Gen AI Metrics.
- Run evals: Evals score GenAI spans with an LLM judge.
- Analyze coding agents: AI SDLC Insights reads GenAI spans from coding harnesses.
Key Attributes
Send gen_ai.operation.name on every GenAI span. Evals only run on spans that carry it. These attributes are the most useful to send:
| Attribute | Description |
|---|---|
gen_ai.operation.name | The kind of operation, for example chat, embeddings, execute_tool, or invoke_agent. |
gen_ai.provider.name | The model provider, for example openai or anthropic. |
gen_ai.request.model | The model the application requested. |
gen_ai.agent.name | The name of the agent that made the call. Dash0 uses it to attribute results per agent. |
gen_ai.conversation.id | The conversation or session the call belongs to. |
gen_ai.usage.input_tokens, gen_ai.usage.output_tokens | Tokens consumed by the call. |
gen_ai.input.messages | The messages sent to the model. Only present when content capture is enabled. |
gen_ai.output.messages | The messages the model returned. Only present when content capture is enabled. |
gen_ai.system_instructions | The system instructions sent to the model. Only present when content capture is enabled. |
See the GenAI attribute registry for the full list.
Instrument Your Application
Use an OpenTelemetry instrumentation for your model SDK or agent framework, and send the spans to Dash0 like any other trace data.
- OpenTelemetry instrumentations: For example,
opentelemetry-instrumentation-openai-v2for the OpenAI Python SDK. - AI integrations: The Integration Hub lists AI integrations such as OpenLLMetry, OpenLIT, and LangChain.
Capture Message Content
Most instrumentations do not record prompts and responses by default, because they can contain sensitive data. Features that read conversation content, such as evals, need it enabled.
- Enable capture in the instrumentation: Each instrumentation has its own setting. For example, the OpenTelemetry Python GenAI instrumentations read the
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENTenvironment variable. - Check where content is recorded: Some instrumentations record message content as span events or log records instead of the
gen_ai.input.messagesandgen_ai.output.messagesattributes. Evals can only reference span and resource attributes.
To keep conversation content out of storage, use GenAI Attribute Redaction in Settings → Datasets. Redacted values are replaced with <REDACTED>. Evals still judge the original content, because redaction runs after them. See Redact on Ingestion.
Further Reading
- About Tracing — Explore traces and spans in the Trace Explorer.
- Data Privacy & Redaction — Control which GenAI content Dash0 stores.
- Evals — Score GenAI spans with an LLM judge.
- Gen AI Metrics — Metrics Dash0 derives from GenAI spans.