Anton
Anton

Reputation: 309

How to set returned samples frequency in Prometheus query?

I'm querying a metric's values over a period of time like metric_name[1w] which returns a metric value for every timestamp. And the timestamps' frequency is set by the scrape_interval parameter in Prometheus config as far as I understand.

I would like to alter that samples' frequency through the query, without changing the scrape interval. I want to get not every sample but, for example, a sample for every 10 seconds, or a sample for every 30 seconds, or a sample for every 5 minutes, etc. How do I do it with PromQL?

Upvotes: 2

Views: 2909

Answers (1)

valyala
valyala

Reputation: 17800

Try metric_name[1w:10s], e.g. to put the desired step interval (10s in this case) after a colon in square brackets. This enables subquery functionality in PromQL.

Upvotes: 2

Related Questions