prometheus/web/api/v1/testdata
Dan Cech 8a233132e6
promql: track samples read per query
Add a per-query samples-read counter that distinguishes storage I/O
from the existing TotalSamples count. TotalSamples reports samples
loaded into the evaluator and so over-counts when a sample is reused
across multiple range-vector windows; samplesRead reflects what the
storage layer actually had to read.

For range-vector functions in range queries, samplesRead applies
delta semantics: step 0 counts the full window, later steps count
only the points not already present in the previous step's window.
For other query shapes samplesRead equals TotalSamples.

Expose the new counter:

- as `samplesRead` and `samplesReadPerStep` in /api/v1/query{,_range}
  stats responses (the per-step variant only with stats=all and the
  per-step stats feature flag enabled);
- as the `prometheus_engine_query_samples_read_total` Prometheus
  counter, reporting the cumulative samples-read across all queries;
- in the OpenAPI schemas.

Also update the per-step stats feature flag and querying API
documentation, and add unit tests covering instant queries, range
queries, range-vector functions, and subqueries.

Signed-off-by: Dan Cech <dcech@grafana.com>
2026-06-01 14:05:00 -04:00
..
openapi_3.1_golden.yaml promql: track samples read per query 2026-06-01 14:05:00 -04:00
openapi_3.2_golden.yaml promql: track samples read per query 2026-06-01 14:05:00 -04:00