GenAI semantic conventions
OpenTelemetry's standard attribute names, spans, metrics and events for generative AI calls, such as gen_ai.operation.name and gen_ai.usage.input_tokens.
In more detail
They live in their own repository and are still at Development status, so names can change: pin the version you follow. Required attributes are the operation and provider names; the request model is conditionally required and token usage recommended, while prompt and reply content are opt-in because they may hold personal data. Input token counts include cached tokens.
Related terms
- GenAI span — A trace span for one model call, named after the operation and model, such as "chat claude-sonnet", carrying the GenAI convention attributes.
- OpenTelemetry — A vendor-neutral, open-source standard and set of tools for producing traces, metrics and logs and sending them to any backend.
- semantic conventions — OpenTelemetry's agreed names for common attributes, such as http.route and db.system, so every library records the same fact the same way.
Taught in
- Tracing And Monitoring — AI Engineering: LLM Apps, RAG & Agents
- Capstone: The Tasks Assistant — AI Engineering: LLM Apps, RAG & Agents
References
- OpenTelemetry: semantic-conventions-genai repository
- OpenTelemetry GenAI conventions: Semantic conventions for generative client AI spans