LearnThatStack Ace your next interview
AI Evals & Observability · question
Question 7 of 55

What are traces and spans in LLM observability?

beginner
← All AI Evals & Observability questions
Re-explain

A trace is the complete, structured record of one request's journey through your AI application. It captures the user input, every intermediate step, and the final output, with timing. A span is a single operation within that trace: one LLM call, one retrieval query, one tool execution, one guardrail check.

Spans nest, so a "handle_question" root span might contain a "retrieve_docs" span and two "llm_call" spans.

Each span carries attributes: model name, prompt and completion (or references to them), input/output token counts, cost, latency, and error status. Spans also carry custom metadata like user tier or feature flag. This structure makes LLM apps debuggable.

When a user reports a bad answer, the trace shows the retrieved documents and final prompt. It also shows what the model returned at each step.

Traces are also the raw material for everything else in the eval stack. Judges score traces, datasets are curated from traces, and cost/latency dashboards aggregate span attributes. Tools like LangSmith, Langfuse, Braintrust, and Arize Phoenix are all built around this trace/span model, increasingly using OpenTelemetry conventions.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the AI Evals & Observability cheatsheet.

← Back to all AI Evals & Observability questions
Pro · $10/mo

48 of 55 AI Evals & Observability answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime