Skip to content
AnswerWell geo Documentation

Research · 10 min read · Answerwell

Adaptive Bit Rate Sampling, Sample Intervals, and Confidence

How Cloudflare analytics and logs use sampling, ABR, sample intervals, and confidence intervals—and how to query and verify estimates.

This page summarises Cloudflare documentation on sampling in analytics, security dashboards, log delivery, and custom metrics. At very high scale, products analyse a subset of events, then extrapolate totals and counts so dashboards and APIs answer in seconds instead of minutes. The main mechanisms are Adaptive Bit Rate (ABR) for query-time resolution, adaptive GraphQL nodes (names ending in Adaptive), per-row sampleInterval / _sample_interval fields, optional confidence intervals, and separate customer-configured rates on Logpush and Logpull.

Why analytics use sampling instead of every event

Section titled “Why analytics use sampling instead of every event”

Cloudflare’s data pipeline handles over 700 million events per second across the global network. Processing all this data in real-time for every query would be prohibitively expensive and time-consuming.

— Cloudflare, GraphQL API inconsistent results

Sampling analyzes a subset of data rather than every individual data point. Cloudflare uses Adaptive Bit Rate (ABR) sampling to ensure queries complete quickly, even when working with large datasets.

— Cloudflare, GraphQL API inconsistent results

Analytics is designed to provide requested data, at the appropriate level of detail, as quickly as possible. Sampling allows Cloudflare to deliver analytics within seconds, even when datasets scale quickly and unpredictably, such as a burst of Firewall events generated during an attack.

— Cloudflare, GraphQL API Sampling

Common conclusion: Sampling is intentional for scale and latency. Aggregated metrics (totals, averages, percentiles) are scaled from the sample so they still aim to represent the full population—but you should know when a dataset is sampled and how to read sampleInterval or request confidence metadata.

Adaptive Bit Rate (ABR): how query resolution is chosen

Section titled “Adaptive Bit Rate (ABR): how query resolution is chosen”

We use a sampling method called Adaptive Bit Rate (ABR) to ensure that queries complete quickly, even when working with large datasets. ABR dynamically adjusts the level of detail in the data retrieved based on query complexity and duration.

— Cloudflare, Understanding sampling in Cloudflare Analytics

ABR stores data at multiple resolutions: 100% — Full data (used for smaller datasets); 10% — 10% sample (medium resolution); 1% — 1% sample (lower resolution). When you run a query, ABR dynamically selects the best resolution based on query complexity, time range requested, number of rows to retrieve, and current system load.

— Cloudflare, GraphQL API inconsistent results

With Adaptive Bit Rate sampling, every supported analytics query is calculated at a resolution matching the query; cardinality and accuracy are described as preserved even for historical data behind Network Analytics nodes.

ABR versus fixed roll-ups (Network Analytics v1 vs v2)

Section titled “ABR versus fixed roll-ups (Network Analytics v1 vs v2)”
Aspect Network Analytics v1 (NAv1) Network Analytics v2 (NAv2)
Historical method One-minute, hour, and day roll-ups Adaptive Bit Rate
Typical packet sampling 1 of every 8,192 packets (0.012%) Dynamic, e.g. dosd 1/100–1/10,000; Network Firewall 1/100–1/1,000,000; flowtrackd 1/10,000
Enrichment pipeline Core Sample Enrichment Edge Sample Enrichment

On the other hand, Network Analytics v2 (NAv2) uses Adaptive Bit Rate (ABR) sampling. This means that users do not need to choose a node based on their query timeframe. Furthermore, the cardinality and accuracy is preserved even for historical data.

— Cloudflare, Main differences between Network Analytics v1 and v2

Sampled GraphQL datasets: Adaptive nodes and estimates

Section titled “Sampled GraphQL datasets: Adaptive nodes and estimates”

Which HTTP and firewall datasets are sampled

Section titled “Which HTTP and firewall datasets are sampled”

The following sampled analytics datasets are available: HTTP requests — httpRequestsAdaptive — All plans — At least 31 days; Firewall events — firewallEventsAdaptive — Pro, Business, and Enterprise — At least 31 days. These datasets use adaptive sampling. Results can omit individual events, and counts can be estimates.

— Cloudflare, Observability logs datasets

Cloudflare GraphQL API exposes datasets that powered by adaptive sampling. These nodes have Adaptive in the name and can be discovered through introspection.

— Cloudflare, GraphQL API Sampling

How totals are extrapolated from a sample rate

Section titled “How totals are extrapolated from a sample rate”

For example, suppose that during an attack the sampling rate is 10% and 5,000 events are sampled. Cloudflare will estimate 50,000 total events (5,000 × 10) and report this value in Analytics.

— Cloudflare, GraphQL API Sampling

Dataset Rate Notes
firewallRulePreviewGroups 1% Use with caution for small datasets
ipFlows1mGroups, ipFlows1hGroups, ipFlows1dGroups, ipFlows1mAttacksGroups 0.012% (1 / 8,192 packets) Legacy Network Analytics roll-up nodes

For unsampled HTTP requests and firewall events in the observability UI, Log Explorer requires the paid add-on; see Log Explorer FAQ for timeouts on wide time ranges.

sampleInterval vs SampleInterval: two different meanings

Section titled “sampleInterval vs SampleInterval: two different meanings”

GraphQL and dashboard: per-row adaptive weight

Section titled “GraphQL and dashboard: per-row adaptive weight”

The GraphQL API exposes a sampleInterval field to show which sampling level applied to a query. See Web Analytics FAQ.

Note: the GraphQL API exposes a sampleInterval field to indicate which level of sampling has been applied to the query.

— Cloudflare, Web Analytics FAQ

In Workers Analytics Engine and the SQL API, each row carries _sample_interval, the inverse of the sample rate (1% sampling → interval 100):

The sample interval is the inverse of the sample rate. For example, if a one percent (1%) sample rate is applied, the sample_interval will be set to 100.

— Cloudflare, Sampling with Workers Analytics Engine

Logpush sample_rate vs log field SampleInterval

Section titled “Logpush sample_rate vs log field SampleInterval”

The sample_rate parameter and SampleInterval field are independent mechanisms that operate at different stages of the logging pipeline: sample_rate: A configuration parameter you set on your Logpush job… SampleInterval: A data field… particularly Network Analytics Logs… A SampleInterval of 1000 means the log entry represents 1 in 1000 packets. The sample_rate you configure applies on top of any pre-existing sampling.

— Cloudflare, Logpush API configuration

Value can range from 0.0 (exclusive) to 1.0 (inclusive). sample=0.1 means return 10% (1 in 10) of all records. The default value is 1, meaning logs will be unsampled.

— Cloudflare, Logpush API configuration

When customer-configured sampling is applied, the SampleInterval value in the logs is not modified; without internal sampling, SampleInterval is always 1 regardless of your configured sample_rate.

Workers Analytics Engine: equitable sampling and query weights

Section titled “Workers Analytics Engine: equitable sampling and query weights”

We do this through a technique called equitable sampling. This means that we will equalize the number of events we store for each unique index value.

— Cloudflare, Sampling with Workers Analytics Engine

The index should match how users will query and view data… It is not recommended to write a unique index value on every row (like a UUID) for most use cases.

— Cloudflare, Sampling with Workers Analytics Engine

SQL: counts and averages with _sample_interval

Section titled “SQL: counts and averages with _sample_interval”
Goal Without sampling With sampling
Count events count() sum(_sample_interval)
Sum a quantity sum(bytes) sum(bytes * _sample_interval)
Average avg(bytes) sum(bytes * _sample_interval) / sum(_sample_interval)

From Workers Analytics Engine SQL API and SQL API functions: for adaptively sampled event and log datasets, the SQL API automatically applies sample weights to COUNT, SUM, AVG, countIf, sumIf, avgIf, and topK. EXACT MIN and MAX are rejected—use APPROX_MIN and APPROX_MAX. For Grafana time series, weight metrics with SUM(_sample_interval * double1) / SUM(_sample_interval).

At write and read, TURN analytics uses similar two-level sampling; billing guidance is to sum usage per customer per period in one query.

Confidence intervals and data-quality signals

Section titled “Confidence intervals and data-quality signals”

GraphQL confidence(level:) on adaptive datasets

Section titled “GraphQL confidence(level:) on adaptive datasets”

Confidence intervals help assess accuracy and quantify uncertainty in results from sampled datasets. When querying sum or count fields on adaptive datasets, you can request a confidence interval… specifying a confidence level of 0.95 returns the estimate, along with the range of values that likely contains the true value 95% of the time.

— Cloudflare, GraphQL API Confidence Intervals

Supported only on adaptive (sampled) datasets, for sum and count fields; confidence level is a decimal between 0 and 1. Example request shape is in Confidence Intervals.

When the same query returns slightly different numbers

Section titled “When the same query returns slightly different numbers”

If you run the same GraphQL Analytics API query multiple times and receive slightly different results, this is caused by Adaptive Bit Rate (ABR) sampling.

— Cloudflare, GraphQL API inconsistent results

Issue Mitigation
Results vary between runs Shorter time ranges (daily or weekly)
Aggressive sampling on large queries Split intervals; aggregate client-side
Verify quality confidence(level: 0.95) { count { estimate lower upper sampleSize } }
Raw adaptive rows Prefer aggregated nodes with Groups suffix

A higher sampleSize indicates more reliable results.

— Cloudflare, GraphQL API inconsistent results

Radar confidence levels (result.meta.confidenceInfo.level 1–5) describe Cloudflare’s confidence in Radar aggregates (sparse regions or ASNs), not the same API as GraphQL adaptive confidence intervals.

Web Analytics beacons vs long-term storage

Section titled “Web Analytics beacons vs long-term storage”

We retain unsampled beacon data for the past 7 days, after this point data is aggregated down to around 10%… the beacon script will fire on every pageview… the data ingestion pipeline does not apply sampling—every received beacon will be recorded.

— Cloudflare, Web Analytics FAQ

Dashboard and GraphQL queries then pick dynamic sampling between 0.0001% and 100% from filters and row volume.

The Security Analytics dashboard uses sampled data, except when showing raw logs.

— Cloudflare, Security Analytics

For large volumes of traffic, Cloudflare uses sampling to return results faster. This means that not every individual event may appear in the list.

— Cloudflare, Security Events

Switch to raw logs is available only when sampled logs for the frame are fewer than 100 (Security Analytics). Narrow the time range to reduce sampling (Security Events).

Workers tracing head sampling (separate from ABR)

Section titled “Workers tracing head sampling (separate from ABR)”

Workers observability traces use head-based head_sampling_rate from 0 to 1 (default 1 = all requests traced). That controls trace volume, not GraphQL firewallEventsAdaptive extrapolation.

Estimating Logpull volume with the sample query parameter

Section titled “Estimating Logpull volume with the sample query parameter”

To size log storage, Logpull additional details recommend a 1% or 10% sample over one hour, then scale line count and bytes to 24 hours. Aim for at least 30 log lines in the hourly sample; adjust sample, not the time range, if the file is too small or large.

Yes. Sampled data is highly reliable… Aggregated metrics (totals, averages, percentiles) are extrapolated based on the sample size… Sampling may not capture extremely rare events with very low occurrence rates.

— Cloudflare, GraphQL API inconsistent results

Frequent mistakes:

  • Treating listed sampled security events as a complete audit trail—pagination in the dashboard may be unreliable on sampled data; the GraphQL API is noted as not having that pagination issue (Security Events).
  • Using MIN/MAX on adaptively sampled SQL datasets without APPROX_* (SQL API functions).
  • Multiplying query results by a constant factor instead of weighting by _sample_interval or sampleInterval per row (Workers Analytics Engine sampling).
  • Querying 30 days in one GraphQL window and expecting identical counts on rerun (GraphQL API inconsistent results).
  • Indexing every row with a UUID in Analytics Engine, slowing aggregations (Workers Analytics Engine sampling).
  • Confusing Logpush sample_rate with upstream SampleInterval and double-counting effective sparsity (Logpush API configuration).

For Log Explorer and broad SQL pulls: narrow time, avoid heavy ORDER BY/LIMIT on huge windows, and select only needed columns.

  1. In the Cloudflare dashboard, open analytics for your zone or account and note whether the UI marks the view as sampled (see Understanding sampling in Cloudflare Analytics on dashboard icons).

  2. Run a GraphQL query against an Adaptive node (for example httpRequestsAdaptive or firewallEventsAdaptive per datasets) with a one-day window first; repeat with a 30-day window and compare whether totals shift more than expected (GraphQL API inconsistent results).

  3. On the same adaptive query, add confidence(level: 0.95) on a count or sum field and review sampleSize, lower, and upper (Confidence Intervals).

  4. If you use Workers Analytics Engine or the SQL API, confirm aggregates use weighted forms or built-in weighted functions, and inspect _sample_interval on returned rows (SQL API).

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page looks wrong or you need a clarification, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about.