Claude Certification Program · Five exams · Guides updated December 7, 2026

Home › Study guides › CCDV-P › Domain 3 › Lesson 3.3

CCDV-P · Domain 3 · 12% of the exam · Lesson 3.3 · 20 min read New in the December 7, 2026 guide release (v1.0)

Trace analysis at scale: sampling, aggregation and failure cohorts

Finding failures no single trace explains: head, tail and stratified sampling, failure rates by attribute, failure cohorts, and Claude as a trace labeller.

Written against skill 3.3 of the official CCDV-P exam guide (Version 1.0, effective November 2026). An independent resource, not affiliated with Anthropic; the practice questions are written from scratch.

3.3.1 Why 12,000 wrong answers a week leave no clue in any one trace

Ferrow Health Plans insures members through 310 employer groups. Its member-benefits chat agent answers coverage questions, such as whether an MRI is covered. Claude runs the conversation and calls three tools Ferrow wrote: lookup_member_plan returns the member's plan and plan year, search_benefits retrieves passages from the benefit documents, and get_accumulators returns deductible progress. The agent handles 400,000 conversations a week.

Every week, benefits specialists audit a random 2,000 conversations against the plan documents. About 3% end with a wrong coverage answer, which across all traffic means roughly 12,000 members a week told something untrue about their cover. Member services flags a few thousand more when members call back to dispute an answer.

Priya, the site reliability engineer who owns the agent's telemetry, has read more than 200 of the failing traces. Each tells its own story: a vague question, a passage that looks slightly off, a confident answer the specialist marked wrong. None shows a bug. Every model call ended normally, every tool returned data, and every answer cited a real document.

That is the signature of a systemic failure: a cause that lives in what many failures share, which no single trace can show. Reading traces one at a time is the right tool for one incident and the wrong tool for a rate. Think of the doctor who traced a cholera outbreak to one water pump: he did not examine one patient more closely, he plotted every case on a map. Trace analysis at scale is that map. You keep traces so rates can be computed, compare rates across attributes, find the group where failures concentrate, and size its impact.

3.3.2 What head and tail sampling each miss

Ferrow already keeps 1% of traces. Why did that sample never show the pattern? Because every sampling strategy is blind to something, and you need to know what before you trust its output.

Head sampling decides at the start of a request, usually from the trace id and a target percentage, so a trace is kept or dropped whole. It is cheap and simple, and it is unbiased: the kept 1% is a fair miniature of all traffic, so a rate computed on it is honest. What it misses is anything rare or narrow. One percent of 400,000 is 4,000 traces a week, about 120 of them wrong, spread across 310 employer groups. Most groups contribute zero or one failure, so a pattern confined to a few groups drowns.

Tail sampling decides after the trace completes, looking at all or most of its spans: keep every error, every slow trace, every escalation. In OpenTelemetry (OTel, the open standard for traces and metrics) this runs in the Collector's Tail Sampling Processor, which must hold whole traces until it decides, so it is stateful and costly to operate. What it misses is a failure that looks like a success when the decision is made. A wrong coverage answer ends with stop_reason end_turn, no error and normal latency; its label arrives days later from an audit or a call-back. A tail rule cannot keep what it cannot see.

What each sampling strategy keeps and misses

Head sampling

Decides at the start
Fair miniature of traffic
Rare or narrow failures vanish

Tail sampling

Decides when the trace ends
Keeps every visible failure
Misses failures labelled days later

Summary row for all

Attributes only, no content
Late labels join by conversation id
Feeds every rate and cohort
Head sampling is fair but thin, tail sampling is rich but biased and blind to late labels, so Ferrow adds a summary row for every conversation that late labels can join.

Tail sampling also tilts the kept set. If you keep every escalation and 1% of everything else, escalations are kept at a hundred times the rate of other traffic and look far more common than they are. Any rate computed on the kept traces is wrong unless each trace carries its keep probability. The OTel guidance allows combining the two: head sampling early to protect the pipeline, tail sampling later before export.

Ferrow's redesign has three layers. A summary row for every conversation holds attributes and no content: employer group, route, prompt version, tools called and their outcomes, the plan year asked about and the plan years retrieved. It also records the model that served the request. The Claude API's OpenTelemetry tracing, in beta so attribute names can still change, carries it as gen_ai.response.model. It differs from the requested model when a fallback model answered or an alias was requested. Tail rules keep full traces for signals visible at the end, such as errors, escalations and max_tokens or refusal stops. A stratified sample, next, keeps content for 30 days.

3.3.3 Stratified sampling: give every slice enough traces

Here is the question that catches teams: even with an honest random sample, can you see a problem in one employer group? Not in a small one. A group with 800 conversations a week leaves 8 traces in a 1% sample, and at a 3% failure rate that is one failure every four weeks.

Stratified sampling fixes this. You split traffic into strata, groups decided by attributes such as tenant size, route or outcome, and give each stratum its own keep rate so every one yields enough traces to analyse. Each kept trace records its rate. When you estimate an overall figure, every trace counts for 1 divided by its keep rate, its weight, so the over-sampled strata do not distort the total.

Stratum (Ferrow, per week) Conversations Keep rate Kept Weight
Escalated to a person or refused, any group 16,000 20% 3,200 5
Not escalated, 40 large groups 270,000 0.5% 1,350 200
Not escalated, 270 small and mid groups 114,000 2.5% 2,850 40

Learn the weight column: it is what makes a stratified sample usable for rates. Strata built on tenant or route can be decided when the request starts, so they work as head sampling; strata built on outcome need the end of the trace, so they live in the tail sampler. Ferrow also sets a floor of 30 kept conversations per group per week, which guarantees that even the smallest group has traces to read.

The price is bookkeeping. Every query over the kept traces must apply the weights, and a dashboard that forgets them reports escalated traffic as 43% of all conversations when it is 4%.

3.3.4 Aggregation: turn traces into rates you can compare

With summary rows for all traffic and labels joined to them, Priya can ask the question no single trace answers: where are failures more common? The mechanism is aggregation: group conversations by one attribute and compute a failure RATE for each value, per step, per tool, per model and per prompt version.

Rates, not counts. The busiest tool appears in the most failures only because it appears in the most conversations, so a count ranks traffic, not trouble. Every rate needs its denominator, and the denominator must come from a complete count. Spans exported by the Claude API's OpenTelemetry tracing (in beta) are delivered best effort, so a span can be lost. A caller can also leave a request's spans out by turning off the sampled flag in its traceparent header. Ferrow therefore counts denominators from its own summary rows.

Here is Ferrow's first cut, from four weeks of audited conversations (8,000 conversations, 240 wrong).

Slice Share of traffic Wrong-answer rate
Primary model served 97% 3.0%
Fallback model served 3% 3.1%
Prompt version benefits-v21 55% 2.9%
Prompt version benefits-v22 45% 3.1%
get_accumulators called 31% 2.8%
14 employer groups renewing for 2027 9% 25%
Other 296 groups 91% 0.8%

Per-step rates work the same way on spans: for each step, the share of runs that errored, ran slow or returned nothing. Ferrow's showed every tool call succeeding, which is why reading traces found no bug.

The flat rows are as informative as the spike. Model and prompt version barely move the rate, which rules out the two causes most teams reach for first, a weaker model and a bad prompt. The 14 groups stand out at 25%, against 0.8% elsewhere. A trend line adds one more fact: the rate was about 1% in October and rose when open enrollment, the season when members choose next year's plan, began in November.

Aggregates tell you WHERE, not WHY. Two cautions apply. A rate on a small slice is noisy, so put a range on it before acting. And an overall rate can move only because the mix moved: if the high-failure groups send more traffic one month, the total rises while no group got worse. Compare per-slice rates before you believe a change in the total.

3.3.5 Failure cohorts: what do the failures share?

Aggregation found where. Failure-cohort analysis finds the shared cause: you group failures by the attributes they have in common and compare each group with the traffic around it. A cohort is a set of conversations defined by attribute values, such as "group in renewal, question about 2027". The measure is lift: the cohort's share of failures divided by its share of traffic, which equals its failure rate divided by the overall rate.

Failure-cohort analysis, step by step

LABELaudit verdicts and flags, joined by conversation id
COMPAREeach attribute's share of failures vs share of traffic
INTERSECTcombine high-lift attributes into the tightest cohort
CONFIRMread 20 traces inside and 20 outside
QUANTIFYtraffic share, failure share, users, fix impact
Each step narrows from all failures to one cohort whose mechanism is visible in its traces and whose impact has a number.

At Ferrow, three attributes had high lift: belonging to one of the 14 groups, asking about plan year 2027, and search_benefits returning no passage for the plan year asked. The third was sharpest. Its cohort, plan-year mismatch, holds 6% of traffic and 72% of wrong answers: 173 of 480 cohort conversations were wrong in the audit (36%), against 0.9% outside, a lift of 12.

Then Priya read traces, now with a question. Inside the cohort every answer quoted a real 2026 benefit, a $40 specialist copay for example, to a member asking about 2027, when that group's 2027 plan had changed it. The 14 groups had renewed with new benefits, but their 2027 documents were not yet loaded into the benefits index, and search_benefits quietly returned the latest year it had. Outside the cohort, the same mechanism never appeared. No error, a real passage, a grounded-looking answer: no reviewer could spot it without knowing the 2027 documents existed elsewhere.

Quantifying impact turns the finding into a decision:

Cohort: plan-year mismatch (no passage retrieved for the plan year asked)
Traffic: 6% of conversations, about 24,000 a week
Wrong answers: 72% of all wrong answers; rate 36% (plus or minus 4 points), 0.9% elsewhere
Who: members of 14 of 310 employer groups, about 15,000 people a week, during plan choice
Fix impact: if the cohort fell to 0.9%, the overall rate would drop from 3.0% to about 0.9%

One subtlety: the flags from call-backs are good for finding cohorts but not for measuring them, since members who call back are not a random set. Rates come from the random audit. The fix sits in the data, not the model: load the 2027 documents and make search_benefits return an explicit "no documents for that plan year" result instead of a silent fallback.

3.3.6 Using Claude to label and cluster traces, and where it stops

Removing the cohort leaves a residual 0.9%, and no recorded attribute stands out in it. The mechanism now lives in the words of the conversations, which no span attribute captures. This is where Claude helps: it reads each failed transcript and assigns a mechanism label, which becomes a new attribute you can aggregate.

Anthropic's Clio research shows the pattern at scale: Claude extracts attributes ("facets") from each conversation, groups similar ones, writes a description for each cluster and arranges the clusters in a hierarchy. Anthropic validated its accuracy against existing classifiers, and its clusters go to human analysts for review rather than to automated enforcement.

In the call below, note the enum, a closed list of labels so results can be counted, and the evidence field, which makes every label checkable. The schema goes in output_config.format, the structured outputs parameter.

import json
import anthropic
client = anthropic.Anthropic()
MECHANISMS = ["wrong_plan_year", "wrong_member_plan", "missed_exclusion",
              "accumulator_misread", "other"]
def label_failure(redacted_transcript: str) -> dict:
    response = client.messages.create(
        model=LABEL_MODEL, max_tokens=300, system=LABEL_RUBRIC,  # one example per label
        messages=[{"role": "user", "content": redacted_transcript}],
        output_config={"format": {"type": "json_schema", "schema": {
            "type": "object",
            "properties": {"mechanism": {"type": "string", "enum": MECHANISMS},  # closed set
                           "evidence": {"type": "string"}},  # quote the turn that shows it
            "required": ["mechanism", "evidence"], "additionalProperties": False}}})
    return json.loads(next(b.text for b in response.content if b.type == "text"))

Claude labels; your code counts. The limits decide where each job belongs.

Job Limit What your pipeline does
Label a transcript against a fixed list A label is a judgment; it can be wrong, and shifts when model or rubric change Check labels against specialist labels first; store model and rubric version with each
Propose clusters and names from a sample A cluster name is a hypothesis that can read well and be wrong Turn it into a structured attribute and count it on the population
State "about 40% of failures are X" A model's estimate is not a measurement Compute shares in code over the labels, with denominators
Read thousands of transcripts off the request path Message Batches halve the price but are not zero-data-retention eligible; results are kept 29 days Redact first, and pick the API path the data agreement allows

At Ferrow, Claude labelled 600 residual failures from the redacted stratified sample. A new label for members holding both a medical and a dental plan stood out. Specialists agreed with 46 of 50 sampled labels, so Priya added a derived attribute, "member has more than one active plan", and counted it on the summary rows. The count, not the cluster, went into the report.

3.3.7 The exam traps

Every trap here either studies the wrong unit, a trace instead of a population, or computes the right number the wrong way.

  • ✗ Reading more individual traces, more carefully, to explain a steady failure rate. ✓ Compute rates by attribute and compare cohorts against the baseline; a systemic cause shows only in what many failures share.
  • ✗ Relying on 1% head sampling, or tail rules on errors and latency, to catch quality failures. ✓ Keep a summary row for every request, join late labels to it, and sample by stratum; wrong answers end normally and are labelled days later.
  • ✗ Computing rates from tail-sampled or stratified traces as if every trace counted once. ✓ Weight each trace by the inverse of its keep rate, or take denominators from a complete count.
  • ✗ Ranking suspects by failure counts: "tool X appears in most failures". ✓ Rank by rate and lift; a busy tool appears in most failures because it appears in most conversations.
  • ✗ Switching to a larger model because 3% of answers are wrong. ✓ Compare per-model and per-prompt-version rates first; flat rates put the cause in the data or the harness, where a bigger model fixes nothing.
  • ✗ Reporting Claude's estimate that "40% of failures are X". ✓ Have Claude label against a closed list, validate the labels, and compute the share in code on a random sample.

3.3.8 Put it together: find a planted cohort in synthetic traces

You now have every piece: sampling that keeps the evidence, weights that keep rates honest, aggregation for where, cohorts for why, and Claude as a checked labeller. The surest way to own them is to plant a failure in synthetic data and find it again.

Each piece connects to the rest of the domain. Telemetry and instrumentation (3.1) decides which attributes exist on a span, and so which cohorts you can ever find. Monitoring and alerting (3.2) turns a cohort you found once into an indicator that pages someone next time. Complex failure diagnosis (4.1) picks up where this lesson stops, with one incident and its evidence.

Key takeaways

  • ✓ A systemic failure belongs to a population, so explain a steady failure rate with rates and cohorts, not by reading more single traces.
  • ✓ Head sampling is fair but loses rare failures; tail sampling keeps visible failures but misses late labels and biases rates, so keep a summary row for every request.
  • ✓ Stratified sampling gives small tenants, routes and outcomes enough traces, and every estimate weights each trace by the inverse of its keep rate.
  • ✓ Aggregate failure rates per step, tool, model and prompt version with complete denominators; flat rates rule causes out and mix shifts can fake a change.
  • ✓ Find the cohort with the highest lift, confirm its mechanism in traces inside and outside it, and report its traffic share, failure share, users and fix impact from a random sample.
  • ✓ Claude can label and cluster failed traces into new attributes, but every label is validated and every share is computed in code.

Check your understanding

4 questions written for this lesson. Every answer option is explained, including the ones you did not pick. Nothing is stored.

CCDV-P practice questions are being written

There is no CCDV-P question bank on this site yet. The practice questions are being written now. Until they are ready, work through the free study guide: every lesson ends with questions that check your understanding, and every answer option is explained.

Back to Domain 3 → The CCDV-P exam guide →

The CCDV-P course will hold the same study guide as a book, for reading in the app.

Sources