In LLM observability, a span is one timed operation, such as a single model call, a tool call or a retrieval step. It carries attributes like the model and token counts. A trace is the tree of all spans that share one trace ID, recording one end-to-end run of your app or agent from the root span down. Cost is calculated per span, and it is usually reported per trace, workflow or customer.
Key takeaways
- A span is one step. A trace is the whole run, linked by a shared trace ID and parent span IDs.
- Model, token and cost data live on the LLM spans. The trace adds them up.
- The root span decides which workflow, and in Tracium which version, a trace belongs to.
- Counting traces per day is what reveals a workflow that has silently stopped running.
What is a span in an LLM app?
A span is a unit of work with a name, a start and end time, and a status. It also has a span ID, the ID of its parent span, and attributes (OpenTelemetry traces). In an LLM app, those are model calls, tool calls, retrieval and the steps around them. A model-call span records which model was asked and how many input and output tokens it used.
Tracium gives each span a role: llm, tool, agent, chain, retriever or embedding. It takes that role from openinference.span.kind, traceloop.span.kind or gen_ai.operation.name, and otherwise treats any span with a model or token counts as llm. This role is separate from OpenTelemetry’s span kind (client, server, internal, producer, consumer).
What is a trace?
A trace is every span that shares one trace ID, nested by parent span ID into a tree. The span with no parent is the root. One user request or one agent run is one trace. Tracium calls a trace a run, and its run counts are distinct trace IDs.
How does an agent run map to one trace and many spans?
The outermost function becomes the root span, and every model or tool call inside it becomes a child. With OpenLLMetry, the decorator creates the root and auto-instrumentation creates the model-call children:
from openai import OpenAI
from traceloop.sdk.decorators import workflow
client = OpenAI()
@workflow(name="support-agent") # root span of the trace
def answer(question: str) -> str:
resp = client.chat.completions.create( # child span: chat
model="gpt-4o-mini",
messages=[{"role": "user", "content": question}],
)
return resp.choices[0].message.content
A run that plans, calls two tools and answers produces one trace. In it, a support-agent root sits over two chat spans and two tool spans. In Tracium’s trace view, each parent span also shows the cost and tokens of everything under it (reading a trace).
Which attributes belong on an LLM span?
The model and token counts, which your instrumentation records, plus your business labels.
| Attribute | Set by | Used for |
|---|---|---|
gen_ai.request.model | Instrumentation | Price lookup; Tracium falls back to gen_ai.response.model |
gen_ai.usage.input_tokens, output_tokens | Instrumentation | Cost and context size |
gen_ai.operation.name | Instrumentation | Span role (chat, execute_tool, invoke_agent) |
tracium.user.id | You | Cost per customer |
tracium.workflow.version | You, on the resource | Comparing releases |
Tracium also reads the older prompt_tokens/completion_tokens names and the llm.usage.* names. It doesn’t read OpenInference’s llm.token_count.*. The GenAI semantic conventions post covers the full set.
Why does cost live on spans but get reported per trace?
Only a span knows which model ran and how many tokens it used, so only a span can be priced. Tracium’s collector multiplies each span’s tokens by its model’s rates from a bundled price table, including separate cache-read and cache-write rates and long-context tiers. A model with no price gets $0, and its span and tokens are still kept. A run’s cost is the sum of its spans’ cost across the trace ID (cost and usage).

The trace is what you report. It’s assigned to the workflow of its root span (workflows), and its version comes from the root span’s resource. That’s why tracium.user.id has to be on every span. A child span without it can put its cost under an empty customer.
How do traces help you catch problems early?
Daily trace counts and summed span costs give each workflow a series to watch. Tracium scores each workflow’s daily cost, error rate and run count against its own trailing baseline with a robust z-score. It flags cost and error-rate spikes, and spikes or drops in runs. A drop in runs means traces stopped arriving, which is what a silently failing workflow looks like. If a workflow version first appeared that day or the day before, the anomaly names it. Cloud plans send these alerts to Slack or email (pricing). The open-source core shows them as Overview outliers.
When is Tracium a good fit?
Tracium fits when you already emit OpenTelemetry and want to be told when a workflow’s cost, errors or volume leave their normal range. As of November 2026, Langfuse and LangSmith offer threshold alerts that you configure per metric, with PagerDuty and webhooks. Choose them for those channels or their evaluation tooling.
FAQ
Is an LLM call a trace or a span?
A single LLM call is a span. It becomes a trace of its own only when nothing wraps it. Then the trace is just that one span.
What is a root span?
The root span is the span with no parent, usually your agent or workflow entry point. Tracium takes a trace’s workflow name and version from it, and falls back to the earliest span when the root lacks them.
Can I add up span costs to get a run’s cost?
Yes. Sum the cost of every span in the trace, which is how Tracium computes run cost. Don’t add up the subtree totals the trace view shows on parent spans, because that counts child spans twice.
To see your own agent runs as traces, clone Tracium from GitHub and self-host it, or start free at app.tracium.ai.