Return a LIMITed number of Prometheus samples between START and END timestamps

214 Views Asked by At

I want to get at most limit raw samples from a Prometheus metric, starting at a start time and stopping before an end time (in case limit is greater than the number of samples between start and end). With InfluxQL, this is straightforward:

SELECT some_field FROM metric
WHERE time >= ${start} AND time < ${end} LIMIT ${limit}

What is the equivalent of this query in Prometheus?

A MetricsQL solution would be acceptable too, but the limit N suffix that's extra, doesn't apply to this case.

1

There are 1 best solutions below

0
On

Limiting the number of returned samples per series is not possible with Prometheus. I've filed an enhancement request for VictoriaMetrics.