What does duration [] mean when used in Prometheus UI Graph

1.3k views Asked by At

In Prometheus when the below query would mean fetching all samples observed during 5m period and then perform the rate calculation with those samples and the the duration.

rate(prometheus_http_request_duration_seconds_sum{handler="/-/reload", cluster="k8s.util.ue1.plaid.io"}[5m])

When i run this in Table mode in Prometheus UI I get to select a time and then the interval is then determined based my duration and the timestamp i chose. This makes sense.

But what happens when i switch to Graph tab? It accepts a duration in the UI along with the timestamp. Say I select 1 hour duration with the same query above the resulting graph covers 1 hour. How does the graph work for 1 hour while my query has explicitly selected 5 mins as duration for rate calculation.

Thanks in advance for your help.

1

There are 1 answers

0
Marcelo Ávila de Oliveira On BEST ANSWER

In the "Graph" tab, Prometheus calculates the 5m rate in a moving window during the 1h interval. It starts calculating the rate for the first 5m (between 1h ago and 1h-5m ago), then it continues calculating the rate moving this 5m window for each timestamp, until the end (between 5m ago and now). It plots all the results in the graph, so you can verify how the 5m rate changed in time.