OpenTelemetry probabilistic sampling in the Collector

Probabilistic sampling in the OpenTelemetry Collector drops a fixed share of traces and logs by trace ID, so teams can cut back-end cost with predictable results. This page covers when to use it, how it combines with SDK sampling, and what to confirm before rollout.

On this page

When probabilistic sampling in the Collector cuts trace and log volume

If your telemetry volume and back-end bills are growing faster than the value you get from them, the probabilistic sampler processor in the OpenTelemetry Collector is one of the simplest levers to test. It drops a fixed percentage of trace and log data before it reaches paid storage, so you pay to store a known fraction of what your services emit. The trade-off is that the percentage applies to everything that passes through it, including the requests you most need to see, so the decision is about which signals to thin and by how much, not whether to thin at all.

OpenTelemetry is an observability framework and toolkit for generating, exporting and collecting telemetry such as traces, metrics and logs, and it is vendor- and tool-agnostic. It is not an observability backend. Storage, querying and visualization are handled by separate tools, which is why sampling decisions in the pipeline directly change what those tools must store and bill for. The OpenTelemetry Collector documentation describes the Collector as a vendor-agnostic way to receive, process and export telemetry. It can run as an agent next to your services, which is where most SDK-level decisions start, or as a gateway that accepts data from many sources, which is where a central sampling processor usually sits.

Before you choose a percentage, confirm which pipeline position your sampler will occupy and which signals pass through it. Ask your team to document the current volume per service and per signal, the back-end pricing unit (spans, log records, or bytes), and which services produce data that must never be sampled. Check the processor's README in the release you plan to deploy, because the Collector's components have mixed stability levels. Those checks determine whether a fixed percentage is a reasonable first step or whether you need a more selective design.

Configuration options and when each fits

This table compares the main settings of the probabilistic sampler processor and when each one fits. Read each row as a decision: what the setting controls, what it changes in your data, and when to leave it alone. Confirm exact key names and defaults in the component README for the Collector version you deploy, because the processor's options change between releases.

SettingWhat it controlsWhen it fits
Sampling percentageShare of traces or log records kept, applied uniformly to everything the processor seesUse for a single, predictable volume reduction on one pipeline. Start conservatively and measure the effect on storage before raising or lowering it.
Hash seedSeed used when hashing the trace ID to make the keep or drop decisionSet the same seed on every Collector that handles the same traces, so each tier makes the same decision. Leave it unchanged unless two sampling stages must be deliberately decorrelated.
Trace ID handlingDecisions keyed on trace ID so all spans of one trace are kept or dropped togetherChoose for traces that must stay complete for trace views. Confirm that every span of a trace reaches the same Collector instance, or decisions will fragment.
Log record handlingDecisions applied to individual log records, which may lack a trace IDChoose when logs need a volume cut independent of traces. Records without a trace ID are sampled individually, so related log lines may be kept or dropped unevenly.
Attribute-based precedenceWhether a sampling attribute on the data can override the percentage, if the Collector version supports itConsider when some traffic, such as a debug flag or a priority tenant, must always be kept. Confirm support in the README for your version before relying on it.
Combined SDK samplingHead sampling already applied in the application SDK before data reaches the CollectorChoose when the SDK already drops traffic. Multiplying two percentages lowers the effective rate, so calculate the result before setting either value.

Combining probabilistic sampling with SDK sampling

With SDK sampling only, the application decides at the start of each trace whether to record and export it. Spans for dropped traces are never created or sent, so the cheapest data is the data that never leaves the process. The trade-off is that the decision is made before the request finishes, so the sampler cannot know whether the request will fail or run slowly. Changing the rate means changing configuration in every service, which can take a release cycle per team.

  • Lowest transport cost: dropped spans consume no CPU for export, no network bandwidth and no Collector memory.
  • Errors are sampled by chance: a failing request is kept only if it falls inside the sampled percentage.
  • Rate changes are distributed: each service must be updated, so consistency across teams depends on rollout discipline.
  • Parent-based behavior matters: downstream services usually follow the parent decision, so the sampler configuration must be consistent across the call chain.
  • Less debugging context: a rare incident may leave no trace at all if the sampled percentage is low.

Before relying on this placement, confirm the SDK version and sampler type your languages support, and test that a sampled trace stays complete across every service it crosses.

Setting up probabilistic sampling in the Collector step by step

This sequence takes a team from choosing a Collector distribution to confirming, with counts from the back end, that a fixed percentage of traces and logs is kept and that decisions stay consistent across the pipeline. Each step ends with a check so problems surface before production traffic is affected.

  1. Choose a Collector distribution with the processor

    The platform or observability engineering team confirms that the Collector build includes the probabilistic sampler processor. The contrib distribution includes it, and the Collector Builder can produce a custom build that contains only the components you need, which is the approach OpenTelemetry's security guidance recommends. Ask the vendor or your internal platform team which distribution your environment already runs. The step is done when a written list of the chosen distribution and its components names the probabilistic sampler processor. Check the component list in the running binary before moving on.

  2. Pin the Collector release for the environment

    Select the Collector version to deploy and record it in your change records. The latest releases at the time of writing include v0.163.0, but pin a specific version only after confirming it is supported in your environment, your container images and your internal approval process. Collector releases publish signed artifacts, SHA256 checksums and SBOM files, so verify those against the release page before you introduce an image into your registry. The step is done when the version, the checksum verification and the image digest are recorded together.

  3. Define the sampling percentage and hash seed

    Decide which signals will be sampled, traces, logs or both, and the fixed percentage each one keeps. Set the sampling percentage in the processor configuration and, if more than one Collector tier samples, use the same hash seed everywhere so that each trace ID gets the same decision on every instance. Confirm the processor's current option names and defaults in the component README for your release, because option names change between versions. The step is done when a reviewed configuration file states the percentage and seed for each signal.

  4. Place the processor in the traces and logs pipelines

    Add the probabilistic sampler processor to the traces pipeline and, if logs are in scope, to the logs pipeline, placing it after the receivers and before the exporters. Keep batch processing after sampling so exporters only send data that was kept. Confirm the pipeline order in the configuration, and note that the log sampling behavior depends on the attributes available in your release. The step is done when the configuration validates with the Collector's validate command and the rendered pipeline shows the processor in the intended position for each signal.

  5. Deploy the configuration to a test gateway

    The platform team deploys the Collector as a gateway in a test environment that receives representative traffic from at least one instrumented service. Keep the gateway's receivers bound to the addresses your network design allows, because server components bind to localhost by default in recent releases and any change should be deliberate. Store the configuration securely and apply the same authentication and encryption settings you plan to use in production. The step is done when the gateway is running, reports healthy status and receives spans and log records from the test service.

  6. Verify decisions with the debug exporter

    Temporarily add the debug exporter to the sampled pipelines and send known test requests, including traces that you expect to be kept and traces you expect to be dropped. Compare the number of items received by the processor with the number emitted, and confirm that all spans belonging to one trace are either kept together or dropped together. Remove or disable the debug exporter afterward, since verbose output can expose sensitive attributes. The step is done when a short written test record shows the received and emitted counts and confirms trace-level consistency.

  7. Confirm volumes in the back end

    Compare item counts in the back end with the counts the Collector reports for the same test window, and check that the observed retention ratio is close to the configured percentage for a sample large enough to be meaningful. Confirm that traces from multiple services that share a trace ID are still complete after sampling. Record the baseline volume before rollout so cost and volume changes can be measured later. The step is done when the back-end figures, the Collector figures and the baseline are stored together and the team agrees the results are acceptable for production.

Securing the sampling pipeline and its configuration

A sampling pipeline sits between your applications and your back ends, so it inherits both their trust and their data. The cards below cover the Collector's network exposure, its configuration, the sensitive data that passes through it, the components it is built from, and how you verify the binary you deploy.

Keep receivers on localhost by default

Since v0.110.0, Collector server components bind to localhost rather than 0.0.0.0 by default. Check every receiver endpoint in your sampling configuration and confirm which interfaces it actually listens on after upgrades. Any receiver that must accept traffic from other hosts, such as an agent receiving from application pods, needs an explicit bind address and a firewall rule that limits the sources allowed to reach it.

Collector security practices

Authenticate exposed receivers

A receiver reachable from other networks should not accept anonymous telemetry, because a spoofed stream can distort sampling ratios and fill the pipeline with noise. Collector authenticator extensions can validate incoming connections, for example with OIDC, and the oauth2client extension can attach credentials to outgoing exporter requests. Confirm which receivers need this and test that rejected clients are actually rejected.

Collector configuration docs

Protect the configuration file

The sampling configuration names your endpoints, and exporter sections often hold credentials. Store the file under version control with restricted write access, keep secrets out of the file itself, and encrypt the storage and transport used to deliver it. Review changes to the sampling percentage and the sampling seed as security-relevant edits, since a quiet change to either alters what data reaches your back end.

Redact before and after sampling

Sampling reduces volume but does not remove sensitive content from the records it keeps. Attributes such as authorization headers, tokens, personal identifiers or query strings can still reach storage in every sampled trace and log. Keep the redaction processor in the same pipeline, and place it so that it runs on every record that is kept, including records that other processors pass through. Test with real sample payloads from each service.

Collector security practices

Build with only the components you need

The Collector Builder lets you assemble a distribution that includes only the receivers, processors and exporters your sampling pipeline uses. A smaller binary has fewer components to patch and fewer open paths to review. Record the component list with each build, and check component stability levels in each README before relying on a processor in production, because stability differs across components.

Collector security practices

Verify signatures, checksums and SBOMs

Before you deploy a Collector build, check the signed artifact, compare its SHA256 checksum with the published value, and review the SBOM listing its dependencies. Collector releases ship the contrib distribution with these artifacts, so verification fits into your normal artifact approval step. Keep the checksum and SBOM with the deployed binary so that an auditor or incident responder can match what runs in production to what was released.

Collector release artifacts

How sampled telemetry flows from services to the back end

Telemetry starts in the instrumented services, where the SDK sampler may already drop some traces before anything leaves the process. Spans and logs then cross into the application network through an agent Collector, and the gateway Collector runs the probabilistic_sampler processor on traces and logs. Check the trust boundary at the gateway: only the share the sampler keeps should reach the back end, and the dropped share should never be exported.

Services, agent and gateway Collectors, with the sampled-out share shown as a branch.

Limits to confirm before rollout

Probabilistic sampling is simple to switch on, but its effects reach past the Collector. The cards below cover what to verify in your environment before a sampling rate reaches production, from component maturity to how dashboards, alerts and back-end billing react to fewer records.

Component stability level

Core Collector components carry mixed stability levels, and each component's README documents its own. Before you rely on the probabilistic sampler in a production pipeline, confirm the stability level of the exact processor and the Collector distribution you plan to ship, including whether logs and traces sit at the same level. Record that check against the version you pin, because stability labels can change between releases.

OpenTelemetry status

Dashboards and alert math

A fixed sampling rate lowers the number of spans and log records that reach the back end, so any count-based panel, rate calculation or threshold shifts with it. Check every dashboard and alert that counts telemetry, and decide whether to scale results by the sampling rate or to derive metrics from unsampled data first. Without that step, a dashboard can look healthy while the underlying traffic has grown or shrunk.

Shared hash seed across signals

If traces and logs use different hash seeds, a request sampled in one signal may be dropped in the other, which breaks correlation during an investigation. Confirm whether your sampler configuration sets the same seed for each signal and each Collector tier, and test a known trace ID through the pipeline to see whether its logs survive. Document the seed value so later changes do not silently split decisions.

Interaction with tail sampling

Probabilistic decisions made in the SDK or at the first Collector tier happen before tail sampling sees a trace, so a span dropped early can never be kept by a later error or latency policy. Map which decision runs first in each tier, and confirm whether your tail sampling rules assume full trace data. This check matters most where the two-tier layout is planned.

Metric derivation before sampling

Metrics derived from spans, such as request rate and error counts, are only accurate if they are computed before the sampler discards data. Confirm the order of processors and connectors in each pipeline, and check whether derived metrics are generated from the full stream or only from kept spans. Otherwise error rates computed from sampled traces may understate real failures.

Back-end pricing and volume rules

Many back ends bill by ingested volume, by retained data, or by the number of series, and some apply tiers or minimum commitments. Ask your vendor how billing counts sampled data, whether discounts or free allowances change at certain volumes, and whether your contract allows a sampling rate to be reduced without a renegotiation. Compare those answers with the savings you expect before setting a rate.

Questions teams ask before sampling telemetry

What drives the cost of setting up probabilistic sampling in the Collector?

Most of the cost is engineering time, not software, because the probabilistic sampler processor is a component of the OpenTelemetry Collector, which is Apache-2.0 licensed. The effort grows with the number of pipelines, the number of services whose telemetry passes through them, the number of signals (traces, logs, or both) being sampled, and the amount of testing needed to confirm that dashboards and alerts still read correctly. Ask any partner to break the quote into configuration, pipeline changes, test runs, and dashboard or alert rework, and to state which of these are one-time and which recur when services or sampling rates change.

How long does a probabilistic sampling project usually take?

The duration depends on scope rather than on the processor itself. A single pipeline with a few services and an agreed sampling rate is a much smaller job than a multi-cluster rollout that samples traces and logs differently for each team. No duration is set here, so ask for a timeline tied to a written scope, with separate milestones for the Collector change, the verification period, and any dashboard or alert rework that follows.

What information does our team need to provide before the work starts?

Three inputs make the scope accurate:

  • Current telemetry volume by service and signal, for traces and logs, over a representative period
  • Back-end bills or storage invoices, so the savings target can be set against real spend
  • Named service owners who can confirm which traces and logs must stay complete for debugging and compliance

Without the service owner input, a fixed percentage can silently remove data that a team relies on during an incident.

Can our in-house team set up probabilistic sampling without a partner?

Often yes, for one pipeline with a clear sampling goal and an engineer who already runs the Collector. The work is configuration and testing, and the Collector documentation describes the components involved. A partner tends to add value when several teams, several pipelines, or regulated data are involved, or when no one has time to measure the effect on dashboards. Compare the internal cost of the same test and rollback steps against a fixed-scope quote before deciding.

Does sampling at the Collector reduce data already sent by the SDK?

No. A Collector-side sampler only sees spans or logs that reach it, so any volume the SDK has already exported has been sent over the network and processed by the receiver. To cut volume earlier, teams combine SDK sampling with the Collector processor, and they must agree on which layer makes the final decision for each trace. Confirm this design in the test environment before anything is switched on in production.

Will sampled traces still be complete when they reach the back end?

The probabilistic sampler decides by trace ID, so all spans for one trace share the same decision when the same rate is applied at each hop. Problems appear when a trace passes through a second Collector configured with a different rate or a different hash seed, because the two tiers may keep different spans. Check that every tier uses matching settings and that a sampled trace shows all of its expected spans in the back end.

What does sampling put at risk for security and compliance?

Sampling reduces the amount of evidence available for investigations, so it must not remove the audit or security events your controls depend on. Keep authentication failures, administrative actions and any log class named in your retention requirements out of the sampled set, and confirm this with your compliance and security owners. Sampling itself does not remove sensitive attributes, so review what is exported and use the redaction processor described in the OpenTelemetry security guidance where needed. DeployOpen prepares controls and evidence for compliance assessments, but audit conclusions come from independent auditors.

How do we know the sampling rate is working as intended?

Measure it. Compare the count of exported spans or log records before and after the processor, check the ratio against the configured percentage, and confirm that error and high-latency traces are still visible in dashboards. Plan a fixed verification period in the test environment and record the results, so the change can be rolled back quickly if key views degrade. Ask any partner for the test plan and the rollback steps as part of the written scope.

How DeployOpen scopes and delivers probabilistic sampling work

Every probabilistic sampling engagement starts with a written scope agreed before any configuration changes. DeployOpen's engagements are fixed-scope, so the scope document names the telemetry signals in play (traces, logs or both), the Collector deployment pattern that will run the probabilistic_sampler processor, the sampling percentages per pipeline, the hash seed decision, and the SDK sampling settings that will be changed or left alone. It also records which environments are covered, which back ends receive the sampled output, and who on the client side approves each decision. Agreeing these items up front is what keeps the work bounded, because most of the cost in this area comes from undecided questions discovered midway through the build.

Deliverables are set out in that scope and typically include the Collector configuration as code in the client's own repository, test evidence showing that trace IDs are sampled consistently across services and that the expected reduction appears in each back end, and documentation covering the rationale for each rate, the rollback steps, and the checks the client's own team should run after each change. DeployOpen implements everything inside the client's infrastructure, in their cloud accounts, data centers or air-gapped networks, so the configuration, credentials and telemetry never leave systems the client controls. DeployOpen does not publish a price list. A quote follows from the written scope, and the client should ask for each deliverable and each environment to be priced as its own line.

Sampling rarely stays correct after the first rollout, because services, SDK versions and Collector releases change. Clients who want continued help can add a retainer covering Collector upgrades, re-testing of sampling rates after major changes, and ongoing support for the pipeline. Before signing, confirm with DeployOpen what the retainer includes, how requests are prioritized, and which upgrade releases are covered, and check the current Collector releases on the OpenTelemetry Collector releases page so the scope reflects the version you will actually run.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.