Trace sampling: less volume, complete traces

Sample traces at ingest by trace ID, so every trace you keep stays complete across all services. Create metrics from all spans first, then decide how much to store.

Span list with time series, filters and service
Pipeline stages per signal: sampling runs after masking, filtering and to-metric
A kept trace with all its spans and attributes
Decision
Per trace ID, at ingest
Result
Kept traces stay complete across services
Pipeline
Mask, filter and to-metric run before sampling
Not included
Tail-based sampling on errors or latency
Product tour

How your team works with Trace sampling

From the span list to the pipeline stage that decides which traces are stored: these views come from the Obseria app.
01 / 05

Every span with service, type and duration

Filter spans by name, service, attribute, errors or duration and see a time series with outliers and RED metrics.

  • Built-in views for HTTP, gRPC and database
  • Slower than p95 filter
  • Group by and aggregation
Learn more
Every span with service, type and duration
02 / 05

Sampling as one stage of the pipeline

For spans, rules run from sensitive data through spam filter and to-metric to sampling, before anything is stored.

  • Input, reduced and stored
  • Rules run left to right
  • Impact per rule
Sampling as one stage of the pipeline
03 / 05

Kept traces stay complete

Because the decision is made per trace ID, a stored trace contains every span of the request, with its attributes.

  • Waterfall of all spans
  • Attributes, resource and events
  • Jump to the full trace
Learn more
Kept traces stay complete
04 / 05

Query span duration over time

The query builder charts stored spans, for example the average duration per service, and can turn a query into a check rule.

  • Tracing, logs, metrics and PromQL
  • Group by service or attribute
  • Add to a dashboard
Learn more
Query span duration over time
05 / 05

Traces via OpenTelemetry

Build an OpenTelemetry Collector configuration with receivers, processors and exporters for traces, metrics and logs.

  • YAML editor with validation
  • Pipelines per signal
  • Copy or download
Traces via OpenTelemetry
Capabilities

Control trace volume without broken traces

Sampling is one stage of the ingest pipeline, next to masking, filtering and conversion to metrics, with the effect of each rule visible.
Trace sampling

Trace sampling

Samples traces per trace ID at ingest, so each kept trace stays complete across all services.

Distributed Tracing

Distributed Tracing

Follows a request across all involved services and shows where the time is lost.

Learn more →
OpenTelemetry native

OpenTelemetry native

Accepts data in the open OpenTelemetry standard, without a proprietary agent.

Metrics

Metrics

Collects time series from applications and infrastructure and makes them queryable and comparable.

Learn more →
  • Observability pipelines
How it works

From all spans to the traces you keep

Five steps that reduce trace volume without losing the information you need.
  1. Spans via OTLP
    01

    Send spans

    Applications send spans via OpenTelemetry. Spans of the same request share a trace ID.

    • Tokens masked
    • Health checks dropped
    • Noise filtered
    02

    Clean up

    Earlier pipeline stages mask sensitive data and drop noise such as health-check spans.

  2. Metrics from all spans
    03

    Derive metrics

    A to-metric rule can turn spans into metrics before sampling, so rates and latencies are based on all spans.

  3. Decision per trace ID
    04

    Sample per trace ID

    The sampling rule decides by trace ID. All spans of a trace get the same decision, so kept traces stay complete.

  4. Input192K
    Filtered−35K
    Stored157K
    Example · spans in 24 h
    05

    Check the effect

    Compare input and stored spans, see the impact per rule and adjust when rare paths go missing.

In depth

How Trace sampling works

Per trace ID

Either the whole trace or none of it

Obseria samples traces at ingest and bases the decision on the trace ID. Every span carries the ID of its trace, so all spans of one request receive the same decision, regardless of which service sent them or when they arrive.

The result is a smaller set of traces that are each complete: the frontend span, the API call, the database query and the message to the queue all belong to the same stored trace. There are no traces with silent gaps that would mislead an investigation.

Because the decision is made at ingest, nothing has to change in your applications. Existing OpenTelemetry instrumentation keeps sending spans as before.

  • Decision by trace ID
  • Same decision for all spans of a trace
  • No gaps in kept traces
  • No change in your applications
Pipeline order

Metrics from all spans, samples for debugging

Sampling is one stage of the Signal Control pipeline. For spans, the stages are sensitive data, spam filter, conversion to metrics, sampling and finally storage. Rules run from left to right, and within a stage from top to bottom.

That order matters. A to-metric rule placed before sampling sees every span, so request rates, error rates and latencies are calculated from the full data. The sampled traces that are stored afterwards serve as examples for debugging, not as the basis for counting.

In the same way, masking and spam rules run first, so sensitive values are removed and noise is dropped before any sampling decision.

  • Sensitive data, spam filter, to metric, sampling
  • Rules run from left to right
  • Metrics based on all spans
  • Noise dropped before sampling
Impact

See what every rule removes

The pipeline overview shows the input per signal, how much the rules reduced it and how much was stored. You can switch between the last hour, 24 hours, 7 days and 30 days to see whether a change had the intended effect.

Below the pipeline, a list shows the impact per rule: how many matches a rule had and what share it dropped. If the stored span volume drops more than expected, the culprit is easy to find.

Rules are created in the interface, imported as JSON or started from the suggestions tab, which points out where rules could help.

  • Input, reduced and stored per signal
  • 1 h, 24 h, 7 and 30 days
  • Impact per rule
  • Suggestions and JSON import
Tracing views

Sampled traces work like any other trace

Kept traces appear in the tracing views as usual. The span list can be filtered by name, service, attributes, errors and duration, and shows a time series with outliers and RED metrics.

Opening a trace shows the waterfall with all its spans and their attributes. Because the trace was kept as a whole, every step of the request is there, from the browser click to the database query.

The query builder works on the stored spans too, for example to chart the average or p95 duration of a service over time.

  • Span list with filters and time series
  • Full waterfall per trace
  • Attributes on every span
  • Queries on span duration
Integrations

Traces from the open standard

Obseria receives traces via OpenTelemetry (OTLP), directly from SDKs or through an OpenTelemetry Collector, for Java, Python, Go, Node.js, .NET, PHP and other languages.
  • OpenTelemetry
  • OTel Collector
  • Java
  • Python
  • Go
  • Node.js
  • .NET
  • PHP
  • Ruby
  • Kubernetes
Guide

Trace sampling explained: head, ingest and tail

What trace sampling is

Distributed tracing records every step of a request as a span: the HTTP call, the database query, the message sent to a queue. Spans that belong to the same request share a trace ID and together form a trace. In a busy system that adds up quickly. Thousands of requests per minute, each with dozens of spans, produce far more data than anyone will ever look at.

Trace sampling means keeping only part of these traces. The goal is to store enough traces to understand how the system behaves, find slow paths and debug errors, without paying for and searching through every single request.

Where sampling can happen

There are three common places to sample, and they differ in what they know about a trace:

  • Head-based sampling in the application: the decision is made when the trace starts, in the SDK. It is cheap, but at that moment nobody knows whether the request will fail or be slow.
  • Sampling at ingest: the backend decides when spans arrive, before they are stored. Data still travels over the network, but storage and query costs drop.
  • Tail-based sampling: a component waits until a trace is finished and then decides, for example to keep all traces with errors. Powerful, but it needs buffering and more infrastructure, typically in an OpenTelemetry Collector.

Why sampling per trace ID matters

The biggest risk of naive sampling is broken traces. If each service decides on its own and keeps, say, every tenth span, a stored trace will have gaps: the frontend span is there, the database span is missing. Such traces are worse than none, because they look complete and mislead.

Sampling per trace ID avoids this. The decision depends only on the trace ID, so all spans of a trace get the same answer, no matter which service sent them or in which order they arrive. A trace is either kept completely or dropped completely.

Good practice for trace sampling

  • Derive metrics before you sample. Request rates, error rates and latency percentiles should be calculated from all spans. Sampled traces are for examples and debugging, not for counting.
  • Start without sampling, then reduce. Look at the actual span volume per service first. Often a few chatty services, health checks or internal calls produce most of the data.
  • Filter noise before sampling. Spans that nobody ever needs, such as health checks, are better dropped completely than sampled.
  • Watch the effect. Compare input and stored volume after every change and make sure rare paths still appear in the stored traces.
  • Be consistent across tools. If your application already samples in the SDK, remember that ingest sampling reduces the remaining volume further.

How much should you keep?

There is no universal sampling rate. The right amount depends on traffic, the number of services and what you use traces for. A few questions help:

  • How rare are the paths you care about? If an important endpoint is called only a few times per hour, aggressive sampling may leave you with no example at all.
  • Where does the volume come from? Reduce chatty, well-understood services more than rarely called ones, and drop pure noise entirely.
  • What do you need traces for? For latency analysis a representative sample is enough; for debugging individual customer requests you need more.
  • What does the budget allow? Storage and query costs grow with the number of stored spans, so set a target volume and work backwards.

Start conservatively, measure, and reduce step by step. It is easier to lower a rate than to explain why the trace of a critical incident was not stored.

Trace sampling in Obseria

In Obseria, trace sampling is a rule in the Signal Control pipeline, which processes telemetry at ingest, before it is stored. Sampling works per trace ID, so every trace that is kept stays complete across all services.

The pipeline shows the stages for each signal side by side: sensitive data, spam filter, conversion to metrics, sampling, aggregation and what is finally stored. Rules run from left to right. For spans this means you can mask data, drop noise and create metrics from all spans before the sampling stage reduces the volume.

The overview shows the input, how much the rules removed and how much was stored, for the last hour, 24 hours, 7 or 30 days. A list of the impact per rule makes clear which rule removes how much. Rules can be created in the interface, imported as JSON, or started from the suggestions tab.

Sampled traces appear in the tracing views like any other trace: in span lists, as waterfall with all spans of the request, and in queries on span duration.

What to know before you start

Sampling at ingest decides by trace ID, not by the content of a trace. Obseria does not offer tail-based sampling that keeps all error traces or all slow traces automatically. If you need that, run tail sampling in your own OpenTelemetry Collector before data reaches Obseria. Also keep in mind that data dropped by a rule is neither stored nor calculated later.

FAQ

Questions about Trace sampling

Answers on features, setup and what is not included yet.
Contact us

Trace sampling FAQ

It keeps only part of the incoming traces. The decision is made at ingest, before storage, and is based on the trace ID, so every kept trace is complete across all services.

All spans of a request share the same trace ID. Deciding by that ID gives every span of a trace the same result, so you never store traces with missing spans.

Only if they are calculated from all spans. Place a to-metric rule before the sampling stage, or use metrics your services emit themselves. Counting stored traces after sampling gives a reduced picture.

No. Sampling happens at ingest in Obseria. Your OpenTelemetry instrumentation keeps sending spans as before.

Yes. If your SDK already samples, ingest sampling reduces the remaining volume further. Make sure both together still leave enough traces for rare paths.

The pipeline overview shows input, reduction and stored volume per signal for different time ranges, and the impact of every rule.

No. Sampling decides by trace ID, not by the content of a trace. To keep traces based on errors or latency, run tail sampling in your own OpenTelemetry Collector before sending data to Obseria.

Tail-based sampling, rules that keep traces by error status or duration, and adaptive sampling rates that adjust on their own. Dropped spans are neither stored nor available for later calculation.

Contact

See Trace sampling in action

In 30 minutes we show you how Obseria works in your environment and answer your questions on setup, privacy and pricing.

  • No obligation, free of charge
  • Usually answered within one business day
  • Data in the EU
Your contact
Your contactObseria team

* Required field. By submitting, you agree to the processing of your details as described in our Privacy Notice