Tracing tokens, latency, and cost
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
make every request observable and its cost visible.
Planned topics
- One trace per conversation turn, with spans for retrieval, each model call, and each tool call.
- Attributes: model name and version, prompt version, input and output tokens, latency, computed cost, outcome.
- Do not store raw personal data in traces without a policy.
- Dashboards: cost per conversation per day, p95 latency per step, error and refusal rates.
- Alerts on cost spikes so the bill is not the first signal.
Draft outline details
Demonstration
span tree: assistant.turn → retrieval (40 ms) → llm.call (1.8 s, 1,200 in / 300 out tokens, 0.004 USD) → tool.get_order_status.
Check your understanding
Why record the prompt version on spans?
Show answer
To tell which change caused a quality or cost change.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.