Sampling

Sampling is the rule for sending, or keeping, only part of the data that is generated. In Datadog, the rate is placed in a different location for each of APM traces, RUM sessions, and log indexing.

Overview

Sending everything and keeping everything inflates both volume and cost, so sampling is the act of choosing only part of it somewhere along the way. Datadog has a layer that decides before the application sends, a layer where the Agent picks things back up, and a layer that decides after arrival whether to keep data in the index, and what gets reduced differs by layer. It matters when a trace that should exist cannot be found, when the number of RUM sessions looks lower than the actual number, and when you want to reduce ingestion volume but do not know which setting to touch.

Rules for not sending everything and not keeping everything

The APM default is head-based sampling, which decides at the root span, the starting point of a trace, whether to keep or drop it, and passes that decision downstream through headers (as of October 2026; Source: Ingestion Mechanisms). The decision is made only once, at the starting point, so in this layer a trace either remains whole or disappears whole. Picking up only part of it is the job of later-stage mechanisms such as the Agent's error sampler, which collects traces of local errors. There are two places to put the rate, the Agent (the default) and the SDK, and the SDK setting wins over the Agent.

Which layer reduces what?

Even for the same "thinning out," what is reduced and what remains differs by layer.

Sampling layers and how they take effect
Layer (where)Where it is setWhat is reducedWhat remains (caution)
Before sending (APM)DD_TRACE_SAMPLING_RULES in the SDK, or the Agent's default rateTraces that reach DatadogTrace metrics are calculated from the full volume
Before sending (RUM)sessionSampleRate and sessionReplaySampleRateSessions collected, and sessions with a replaySessions not collected cannot be recovered later
AgentThe error sampler and the rare samplerReduces nothing; picks back up traces that would have been droppedDoes not work for services whose rules are placed in the SDK
Index (APM)Retention filtersSearchable spansThe ingested volume does not change
Index (logs)The rate on an index's exclusion filterLogs entering the indexThey still flow to Live Tail and archives
Source: Ingestion Mechanisms, Browser RUM and Session Replay Sampling, and Indexes arranged by layer (as of October 2026)

The volume that affects billing is also split by layer. The rate before sending affects the volume you ingest, and the index rate affects the volume you keep, so which layer you touch is determined by which cost you want to reduce.

How far do manual keep and drop win?

The head-based decision can be overridden in the SDK. Traces of important transactions are tipped toward keeping with Manual Keep, and repetitive ones such as health checks are dropped with Manual Drop (as of October 2026; Source: Ingestion Mechanisms). However, Manual Keep must be applied before the context is propagated downstream; if applied after propagation, the whole trace spanning other services may not remain. Because it is a decision made in the SDK, there are cases where the trace is still dropped by Agent or server rules. Rates per service or resource are written in DD_TRACE_SAMPLING_RULES, and in the instructions for Java / Python / Go, DD_TRACE_SAMPLE_RATE is deprecated. The ingestion screens and default values are left to Ingestion Controls.

Is the request count still correct after thinning out?

APM trace metrics (request count, error count, latency) are calculated from all of the application's traffic, regardless of the ingestion sampling settings (as of October 2026; Source: Trace Metrics). What decreases is the number of traces you can open and read; the numbers in graphs and monitors do not shrink. The exception is configurations where spans are reduced before they reach the Agent. With sampling in the OpenTelemetry SDK, application-side sampling in the Ruby SDK, and spans coming through X-Ray, the metrics may represent only part of the whole. If you thin out in the OpenTelemetry Collector, placing the span_metrics connector before the thinning process makes the metrics calculated from the full volume.

RUM and logs thin out in different places

RUM uses the browser SDK: sessionSampleRate determines the proportion of sessions collected, and then sessionReplaySampleRate determines the proportion with a replay. The default is 100 for the former, and 0 for the latter from Browser SDK v5.0.0 (as of October 2026; Source: Browser RUM and Session Replay Sampling). The two-stage multiplication and how billing is counted are covered in Session (RUM). Logs are on the side that thins out after arrival: giving an index's exclusion filter a rate reduces only the number of logs entering the index. When thinning out per log, selection is based on whether a trace ID is present, so the remaining logs tend to line up with the remaining traces. For choosing between them, see Exclusion Filter.

Before deciding the rate, decide what must always be kept

If you start from the rate, you cannot prevent a trace needed for incident investigation from being dropped by chance. First, decide in words what must always be kept, such as traces containing errors, important resources like payments, and low-volume services. Map that onto the conditions of Manual Keep, sampling rules, and retention filters, and only after that narrow the remaining volume with a rate. The layer that is determining the volume appears in the breakdown of ingestion_reason on the Ingestion Reasons dashboard, so opening the breakdown for your own services once gives you a baseline before you move the rate.

Share