Choose and configure head sampling in the OpenTelemetry SDK to reduce trace volume at the source

domain: opentelemetry.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Select a sampler: ParentBased(root=TraceIdRatioBased(ratio)) is the most common choice for consistent sampling across services that share a parent context
  2. Set the sampler in SDK initialization via the OTEL_TRACES_SAMPLER environment variable (parentbased_traceidratio) and OTEL_TRACES_SAMPLER_ARG (e.g., 0.1 for 10%)
  3. For services that must always sample high-priority traffic, wrap the ratio sampler with a custom sampler that inspects a baggage key or span attribute before delegating
  4. Propagate the sampling decision in the traceparent header (W3C Trace Context) so downstream services respect the parent's sampling flag without re-sampling
  5. Validate the effective sampling rate by querying span ingestion metrics in your backend and comparing to the configured ratio
  6. Document the chosen ratio per service in a config map or environment variable manifest checked into version control so changes are auditable

Known gotchas

Related routes

Configure the OTel Collector probabilistic sampler processor for head-based sampling to reduce trace volume uniformly
opentelemetry.io · 5 steps · unrated
Configure tail sampling in the OpenTelemetry Collector to keep only high-value traces
opentelemetry.io · 6 steps · unrated
Configure the OpenTelemetry Collector tail sampling processor with multiple composite policies for intelligent trace retention
opentelemetry.io · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans