liveBook · Manning

Tail-based sampling

As explained in Cloud Observability in Action

Tail-based sampling is a tracing sampling strategy that defers the capture decision until a trace is complete.

Tail-based sampling defers the decision to keep or discard a trace until the request is complete, allowing sampling to consider the whole trace. section 2.5.3 section 8.3.1

This preserves traces that reveal errors, anomalies, or other valuable downstream behavior that head-based sampling might miss. The trade-off is operational: completion can be difficult to detect when services time out, so agents must retain more state and may consume additional network, storage, and processing resources. section 2.5.3 section 8.3.1

A request with a straggling service

A distributed request passes through several services. Sampling waits for completion so it can retain the trace if a downstream service fails, but must decide how long to wait when another service times out. section 8.3.1

Table 2.3 Overview of the costs of traces (view table figure)

 

Overhead

Considerations

Instrumentation

Some effort and auto-instrumentation

OpenTelemetry uptake and legacy

Agent

Sampling strategy and latency overhead

Use OpenTelemetry collector

Destination

Dedicated storage layer and query and analytics

Lots of commercial offerings and some OSS (e.g., Tempo and Jaeger)

Use the trace-cost overview to compare sampling overhead with instrumentation, agent, and destination costs. section 2.5.3

How Cloud Observability in Action covers it

How deep it goes
Explains the completion-time decision and operational trade-offs, but defers detailed implementation guidance.
Examples
Uses anomalous or failing downstream requests and services that time out before trace completion.
What it assumes
Assumes familiarity with distributed traces, spans, requests, and head-based sampling.
What you can do after
Evaluate tail-based sampling against simpler up-front sampling by balancing trace relevance, latency, storage, and network costs.
How it connects
Contrasts with head-based sampling and depends on distributed tracing, spans, timeouts, and context propagation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Cloud Observability in Action. The section links point to the parts of the book it draws on.