The requests you can see may differ from the requests that failed
Analyze outcome-dependent trace retention, telemetry loss, inclusion probabilities, and known request denominators before estimating incident impact.
On this page
The question for today
What you’ll understand
- Explain how outcome-dependent selection changes an observed error fraction.
- Use declared positive inclusion probabilities with a known population denominator.
- Distinguish iid sampling variability from missing and biased telemetry.
A trace store is an observed population created by instrumentation, sampling, buffering, export, and retention decisions. It is not automatically a random sample of all user requests. Error-focused tail sampling can make failures much more common among retained traces, while an overloaded exporter can lose the very period investigators most need. Before calculating impact, ask which requests could appear, which were lost, and where a trustworthy denominator comes from. A missing trace is not equivalent to a successful request or to no request at all.
Selection can depend on the outcome
Head sampling makes a retention decision early, while tail-oriented designs can use information accumulated later, such as latency or error status. Both can be useful, but their selection mechanisms answer different statistical questions. If errors are retained at a higher probability than successes, the fraction of retained traces that contain errors will overstate the population's error fraction when interpreted naively. That is an expected consequence of the design, not evidence that sampling failed to follow its intended rule.
Collection loss creates additional selection. A worker that crashes before exporting may leave no completed span; an exporter that drops under pressure may disproportionately lose the busiest instances. Record dropped-item counters, queue occupancy, sampling configuration, and instrumentation versions. An external request-count metric can help establish a denominator, but it too needs its own loss and semantics review. Combining two incomplete systems does not automatically recover the missing population if their gaps share a cause.
Weights require known support and the right denominator
When inclusion probabilities are known and positive for all relevant units, inverse-probability weighting can estimate population totals under the sampling model. A selected item that had a low chance of inclusion represents more population weight. For a fixed known total request count, dividing an unbiased estimated error total by that fixed count preserves that total-based expectation property. Dividing by an estimated total is a ratio estimator and does not automatically have the same finite-sample unbiasedness.
Unknown or zero inclusion probabilities are a more serious limitation than a small sample. If all crashed requests have zero chance of being recorded and no independent evidence identifies them, weighting visible successes cannot reveal their outcomes. Likewise, a nominal sampler rate does not include undocumented exporter loss. State what the weighting corrects and what remains unidentified. Sensitivity ranges or explicit unknown counts can be more honest than a precise corrected percentage based on an incomplete selection model.
More visible records do not remove a blind spot
Report the visible numerator, denominator, weighting scheme, and known gaps alongside an impact estimate. Compare client-visible errors with server and dependency signals, especially when crashes prevent normal completion telemetry. For AI systems, also distinguish transport success from semantic failure: a fast fallback response with an empty or wrong result may not appear in an HTTP-error filter. The definition of error is part of the estimand and should not change silently during incident analysis.
The sampling lab shows what variability looks like under an intentionally unbiased iid model. Reset, set both p=0.1 and n=20, predict the exact sample-mean variance, then inspect and Play or Step. Reset and set both p=0.1,n=100 for a separate comparison. Variance falls from 0.0045 to 0.0009 under those assumptions. Playback highlights outcomes rather than collecting samples; the normal comparison and its CDF bound do not correct biased inclusion or certify individual bars. The real collection mechanism must be assessed separately.
Work it through
Correct a deliberately known selection model
A fictional fixed population has 10,000 requests: 1,000 errors and 9,000 successes. Error traces are selected with probability 0.8 and success traces with 0.1. Suppose the realized retained counts are exactly 800 errors and 900 successes.
The naive retained-trace error fraction is 800/(800+900) = 800/1,700 ≈ 47.06%, far above the stipulated population error fraction of 10%.
With the declared known probabilities, the weighted error total is 800/0.8 = 1,000. Dividing by the independently known fixed N=10,000 gives a 10% total-based estimate in this realized sample.
The success weight also gives 900/0.1 = 9,000 here, but this numerical agreement is not proof that an unknown exporter-loss process was corrected. The calculation depends on the complete positive-inclusion model and the trustworthy population denominator.
The 47.06% visible fraction reflects outcome-biased retention. The corrected ten-percent result follows only from the example's explicitly known selection and population assumptions.
The living notebook
Explore the model
Interactive lab · sampling
Sampling precision assumes a population-selection model
Compare fresh Reset → set both p=0.1,n=20 and Reset → set both p=0.1,n=100 cases. Predict exact sample-mean variance, then Play or Step. This iid binomial instrument has no telemetry drops or outcome-dependent selection; its normal CDF bound is not a per-bar or bias guarantee.
- Mean sample proportion
- 0.5
- Sample-mean variance
- 0.0125
- Uniform CDF error bound
- ≤ 0.1062
Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA larger clean sample reduces variability only within its model; it does not reveal requests the collection process never observes.
Pause & reason
Check your understanding
Your turn
Try it yourself
A known fixed population contains 5,000 requests. A complete documented sampler gives every error inclusion probability 0.5, and 125 error traces are observed. Estimate the weighted error total and rate, then explain why unmeasured zero-probability crash loss would invalidate the claim.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Weight each observed error by the reciprocal inclusion probability and divide by the known full count.
Compare with the solution
The weighted error total is 125/0.5 = 250, giving 250/5,000 = 5% under the stated complete sampling model. If some crashed requests never have any inclusion chance and their outcomes are otherwise unknown, the assumed positive-probability model does not cover them. The five-percent estimate cannot silently represent those missing outcomes; additional evidence or an explicit unidentified range is needed.
Keep the idea
Take it with you
- Telemetry selection and export loss define the population available for analysis.
- Inverse-probability correction needs known positive inclusion and consistent denominators.
- Sampling precision cannot repair an unobserved or outcome-biased population by itself.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.