Search code examples
grafanapromql

Reference chosen time range (from, to) in Grafana's Promql query


I have a PromQL query max_over_time(some_metric_max[1h]) but instead of "1h" I would like to use the selected time range in Grafana. I can't find any variable for that (looking for something like $__interval, but for the selected range)...


Solution

  • Use:

    max_over_time(some_metric_max[$__range])
    

    See more details at Grafana documentation here.