advanced26 min studyLesson 416 in Engineering

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

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.

P(E∣S)=P(S∣E)P(E)P(S∣E)P(E)+P(S∣¬E)P(¬E)P(E\mid S)=\frac{P(S\mid E)P(E)}{P(S\mid E)P(E)+P(S\mid\neg E)P(\neg E)}
E denotes request error and S trace selection in this two-outcome model with a positive denominator. The formula is dimensionless and describes selection, not a claim that real sampling probabilities are known or stable.↔ Scroll wide equations horizontally.

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.

N^E=∑i∈S1{Ei}πi,p^=N^EN\widehat N_E=\sum_{i\in\mathcal{S}}\frac{\mathbf{1}\{E_i\}}{\pi_i},\qquad\widehat p=\frac{\widehat N_E}{N}
π_i>0 is the known inclusion probability for request i, S the selected set, and N a fixed known full-population request count. Under the stated valid selection model, the weighted error total is an unbiased total estimator; this does not apply to unknown loss or units with zero inclusion.↔ Scroll wide equations horizontally.

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.

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.

  1. The naive retained-trace error fraction is 800/(800+900) = 800/1,700 ≈ 47.06%, far above the stipulated population error fraction of 10%.

  2. 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.

  3. 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 result

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.

Explore the model

Interactive lab

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.

Sampling precision assumes a population-selection modelExact 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). Current readings: Mean sample proportion: 0.5; Sample-mean variance: 0.0125; Uniform CDF error bound: ≤ 0.1062. All parameters are adjustable with the labeled controls below.Exact distribution of the mean of 20 independent Bernoulli variables with success probability 0.5; playback highlights outcome 0.00.250.50.75100.0580.1150.1730.23Sample mean · k / nProbability massNormal bin masses are an approximationk = 0 · exact probability = 9.54e-7
Exact binomial massNormal interval massHighlighted outcome / mean
Mean sample proportion
0.5
Sample-mean variance
0.0125
Uniform CDF error bound
≤ 0.1062
t = 0 s

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.

Check your understanding

Why can retained traces show a 47% error fraction while the full request population has 10% errors?

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.

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.