OpenTelemetry GenAI traces in Tracewell

OpenTelemetry's GenAI semantic conventions describe LLM calls as spans with gen_ai attributes. If your product collects OTel traces, Tracewell's trace list and span waterfall can show them with little more than a mapping function.

Field mapping

How OpenTelemetry's data maps to the kit's Trace and Span type. Your backend does this mapping and serves the result to the kit. The kit itself doesn't call OpenTelemetry. Check field names against OpenTelemetry's documentation for the version you use.

OpenTelemetry fieldKit fieldNote
trace_idTrace.id
root span nameTrace.nameOr your own feature or route name
root span durationTrace.latencyMsend − start, in milliseconds
root span statusTrace.statusERROR → error; OK or UNSET → success
sum of gen_ai.usage.input_tokensTrace.inputTokensAcross the LLM spans in the trace
sum of gen_ai.usage.output_tokensTrace.outputTokens
gen_ai.request.model (or gen_ai.response.model)Trace.model, Span.model
span parent linksSpan.depthDepth in the span tree
span start − trace startSpan.offsetMilliseconds
gen_ai.operation.nameSpan.kindchat or text_completion → llm; embeddings and retrieval → retrieval; execute_tool → tool
span countTrace.spans

From spans to a waterfall

Tracewell's Span type is a flattened tree: each span has a depth, an offset from the start of the trace and a duration, all in milliseconds. Walk the OTel span tree depth-first, compute those three numbers and the waterfall draws itself.

Span kinds

The kit colors spans by kind: chain, llm, retrieval, tool and guardrail. Use gen_ai.operation.name where it's set, and your own span names (for example retrieve, guardrail.check) for the rest.

Collecting the data

Your product receives traces over OTLP, stores them, and serves trace lists and trace detail from its API. Tracewell is the front end for that API; it doesn't talk OTLP itself.

Questions

Are the GenAI conventions stable?

They're still evolving and now live in their own OpenTelemetry repository. Some names changed, for example gen_ai.system became gen_ai.provider.name, so map both if you accept data from older SDKs.

Where does cost come from?

OpenTelemetry doesn't define a cost attribute. Calculate it from tokens and model price on your backend.

Can I show prompts and completions?

Recording message content is opt-in in most instrumentations. If you collect it, show it in the trace explorer's input and output panes.