---
title: "Query-side sampling for a time range"
method: GET
path: "/builder/sampling"
tags: ["Builder"]
---

# Query-side sampling for a time range

`GET /builder/sampling`

Reports how much of the stored data a query over the given range would read, so the
time picker can show whether the screen is built from a sample. The measurement is
the one the widget path uses and shares its cache, so it costs nothing on the common path.

## Query parameters

- `fromTs` integer, required
- `toTs` integer, required
- `resource` string, required

## Response `200`

OK

- HelpersSamplingPreview
  - `applied` boolean — Applied is true when a query over this range reads only part of the stored rows. False means the range is small enough to read whole, the resource is not on a sampled path, or the selection could not be measured — in every one of those cases ScannedPercent is 100.
  - `scanned_percent` number — ScannedPercent is the share of stored rows a query reads, 0 < percent <= 100. It is the summed TierRatio of the selected SampleWeight tiers — the tier's true share of the table, as measured by the stats query rather than inferred from the weight value.
  - `unit` string — Unit names what a row is on this resource, for the reader-facing sentence: "logs", "spans", or "RUM events".

## Changes

- **2026-08-26** `2b8cdd9f2f3f` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/middleware/apis/middleware-api/changes/builder/sampling/get.md)

---

[API](https://skmtc.dev/middleware/apis/middleware-api.md) · [All operations](https://skmtc.dev/middleware/apis/middleware-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/middleware/middleware-api/revisions/2b8cdd9f2f3f/schema)
