---
source: https://iinventedlight.com/library/notes/otel-genai-spans.md
title: "Record GenAI work as OpenTelemetry traces and client spans"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "CC-BY-4.0 (OpenTelemetry); Apache-2.0 (open-telemetry/semantic-conventions-genai (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: OpenTelemetry, Traces; open-telemetry/semantic-conventions-genai (GitHub), Semantic conventions for generative client AI spans. CC-BY-4.0; Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-19
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-19
as_of: 2026-11-19
confidence: medium
untested: "Not reproduced (2026-11-19). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: agent-operations
topic_area: "agent operations: OpenTelemetry GenAI spans"
tags: [opentelemetry, genai, tracing, spans]
client: Librarian
sources:
  - id: S1
    title: "Traces"
    publisher: OpenTelemetry
    url: https://opentelemetry.io/docs/concepts/signals/traces/
    accessed: 2026-11-19
    license: "CC-BY-4.0"
  - id: S2
    title: "Semantic conventions for generative client AI spans"
    publisher: open-telemetry/semantic-conventions-genai (GitHub)
    url: https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/gen-ai-spans.md
    accessed: 2026-11-19
    license: "Apache-2.0"
---
# Record GenAI work as OpenTelemetry traces and client spans
**Answer:** Traces give the path of a request through your application. Spans in that request share the same trace_id. GenAI conventions treat a client span as a logical operation observed by the caller, covering that operation from start to finish, including automatic retries.

## Traces and spans

Traces give the big picture of what happens when a request is made to an application. A trace is the path of a request through your application. One way to think of traces is that they are structured logs plus context, correlation, and hierarchy. Spans in the same request share a trace_id. The root span has no parent_id. A Tracer Provider is a factory for Tracers, typically initialized once, including Resource and Exporter initialization. Trace Exporters send traces to a consumer.

## GenAI client spans

GenAI spans represent logical operations as observed by the caller. The span should cover the duration of the operation. It starts when work is initiated and ends when the response is fully received, or when the operation is terminated due to an error or cancellation. If a request was retried automatically, the span should include every retry of that logical operation. The conventions also describe inference, embeddings, retrievals, memory, and execute tool spans. For Fetch response, the name SHOULD be fetch_response and Span kind SHOULD be CLIENT. Status is Development.

| trace_id | parent_id |
|---|---|
| trace_id | field indicating the trace |
| parent_id | missing on the root span |
| Tracer Provider | factory for Tracers |
| Trace Exporters | send traces to a consumer |

## See also

- [otel-genai-metrics](https://iinventedlight.com/library/notes/otel-genai-metrics/)
- [otel-genai-mcp](https://iinventedlight.com/library/notes/otel-genai-mcp/)
- [ao-mcp](https://iinventedlight.com/library/notes/ao-mcp/)

## Claims

- id: C1
  claim: A trace records the path of a request through an application.
  source: S1
  evidence: "The path of a request through your application."

- id: C2
  claim: Traces can be thought of as structured logs plus context and hierarchy.
  source: S1
  evidence: "a collection of structured logs with context"

- id: C3
  claim: GenAI spans represent logical operations as seen by the caller and should cover the operation duration.
  source: S2
  evidence: "GenAI spans represent logical operations as observed by the caller."

## Sources

- [S1] Traces. OpenTelemetry. https://opentelemetry.io/docs/concepts/signals/traces/ . License: CC-BY-4.0. Accessed 2026-11-19.

- [S2] Semantic conventions for generative client AI spans. open-telemetry/semantic-conventions-genai (GitHub). https://github.com/open-telemetry/semantic-conventions-genai/blob/main/docs/gen-ai/gen-ai-spans.md . License: Apache-2.0. Accessed 2026-11-19.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: OpenTelemetry, Traces; open-telemetry/semantic-conventions-genai (GitHub), Semantic conventions for generative client AI spans. CC-BY-4.0; Apache-2.0. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
