What you need to know
At millions of traces a day, reading traces one at a time finds anecdotes, not causes. Systemic issues, such as a tool that fails for one tenant's data format or a prompt that hurts one language, look ordinary in each trace and only appear when traces are grouped. Trace analysis at scale is about keeping the right traces, grouping them the right way, and drawing honest conclusions.
Sampling that keeps what matters
| Strategy | Decides | Keeps rare failures? |
|---|---|---|
| Head-based random sampling | Before the request runs | No: a 1% sample of a 0.05% failure keeps a handful |
| Tail-based sampling | After the trace completes | Yes: keep every error, slow or unusual trace, sample routine successes |
| Stratified review sampling | By segment | Covers every route, tenant tier and outcome |
| Anomaly over-sampling | By unusual features | Surfaces new failure modes first |
Keep all error traces even when successes are sampled heavily: errors are rare and carry the most diagnostic value. Successful traces still matter as the comparison group.
Aggregation and failure-cohort analysis
When an overall rate moves and no single trace looks wrong:
- Group failures by cohort: document type, language, tenant, route, tool, model snapshot, prompt version, MCP server version.
- Compare failure rates across cohorts to see where the change is concentrated.
- Contrast failing and passing traces in the affected cohort on attributes such as tools called, stop reasons and result sizes, to find the mechanism.
- Line up the change timeline: a jump at 14:05 next to a deployment or configuration change at 14:04 is a strong lead.
| Question | Aggregation |
|---|---|
| Why did cost per task rise 25%? | Tokens per task by category (input, output, cached reads, tool results), and turns per task by task type |
| Which change broke things at 14:05? | Error rate split by each version attribute |
| Why do failures look like "nothing found"? | Failures by tool, tenant and result type |
Labeling failures at scale
Claude can label thousands of failed conversations against a defined category list. The labels need checking against a human-reviewed sample before they drive decisions. The same applies to estimating properties such as groundedness over 50,000 reports a month: score a sample with a judge that checks each claim against its sources, and validate the judge against human review first.
Statistical traps
Retention for analysis
Keep aggregates and metadata for long periods (trends over months), detailed spans for a short period (recent debugging), and any captured content for the shortest period, under its own policy.
In the exam
Trace-analysis items give a fleet-level symptom and a pile of traces. Pick the sampling, grouping or comparison that would reveal the cause, and reject conclusions drawn from small random reads, single outliers, averages that hide cohorts, or confounded comparisons.
Check your understanding
A 1% random trace sample keeps almost no examples of a failure affecting 0.05% of requests. What fits better?
Show answer
Answer: C. Deciding after the trace completes keeps the rare failures; a bigger random sample still mostly misses them.
Version B looks better overall but worse in every request segment. What explains it?
Show answer
Answer: D. Different traffic mixes can reverse an aggregate comparison; compare within segments.
A team needs to classify why 12,000 conversations failed last month. Which approach fits?
Show answer
Answer: A. Model-assisted labeling scales, and a human-checked sample makes the labels trustworthy.
Apply it: Find Tidewater's systemic failure
Tide's task success fell from 93% to 89% over two weeks. Nothing looks wrong in individual traces. Traces carry tenant, plan, language, route, tool, model snapshot, prompt version and MCP server version. The team keeps a 2% random sample of traces.
- Change the sampling so the next investigation has the traces it needs.
- Write the aggregation plan, in the order you would run it.
- Describe how you would confirm a suspected cause before acting.
- Name one trap you will check for in the comparison.
Show model answer
1. Sampling. Tail-based: keep every failed, refused, truncated or slow (over p95) trace, and every trace with an unusual tool sequence; keep 2% of routine successes. Add a weekly stratified sample by plan, language and route for human review.
2. Aggregation plan.
- Failure rate by each version attribute (model snapshot, prompt version, MCP server version), lined up with the change log for the two weeks.
- Failure rate by tenant, plan, language and route, to find where the drop is concentrated.
- Within the affected cohort, failing versus passing traces by tool called, tool error category and stop reason.
3. Confirm. Replay a sample of failing requests from the affected cohort with the previous version of the suspected component and everything else fixed, several trials each; compare failure rates.
4. Trap. Traffic mix: if one large tenant onboarded during the period, the overall drop may come from its cohort, so compare failure rates within segments before and after, not overall.