flipt icon indicating copy to clipboard operation
flipt copied to clipboard

feat(prometheus): Add minimum range interval based on scrape interval

Open ChrisMcD1 opened this issue 6 months ago • 1 comments

Inspired by how Grafana does $__rate_interval, this adds the feature that the minimum range passed to Prometheus will be 4x the configured scrape interval. This allows users of 1 minutes scrape intervals to see metrics on the 30 minute and 1 hour time range, which is currently impossible.

For details of Grafana's implementation: https://grafana.com/blog/2020/09/28/new-in-grafana-7.2-__rate_interval-for-prometheus-rate-queries-that-just-work/

ChrisMcD1 avatar Jun 18 '25 19:06 ChrisMcD1

Oh, just realized that this implementation doesn't quite work for larger time ranges. We only want to divide by the scaling factor for the smaller time ranges.

Perhaps a better idea would be to just decrease the number of data points when there is a longer scrape interval.

ChrisMcD1 avatar Jun 18 '25 19:06 ChrisMcD1