What does the "instant" checkbox in Grafana graphs based on prometheus do?
Asked Answered
A

2

47

I have no clue what the option "instant" means in Grafana when creating graph with Prometheus.

Any ideas?

Aver answered 7/8, 2018 at 13:30 Comment(0)
C
57

It uses the query API endpoint rather than the query_range API endpoint on Prometheus, which is more efficient if you only care about the end of your time range and don't want to pull in data that Grafana is going to throw away again.

Candice answered 7/8, 2018 at 14:39 Comment(1)
M
10

By default Grafana sends PromQL queries to /api/v1/query_range for building graphs. This API returns calculated datapoints on the requested [start ... end] time range with the given step interval between datapoints. The step interval is calculated by Grafana based on the selected step and resolution graph options and horizontal pixel resolution of the graph.

Sometimes it is needed to execute query only against the last datapoint on the selected time range. In this case you can check instant checkbox in Grafana graph settings. Then Grafana will send PromQL queries to /api/v1/query instead of /api/v1/query_range. This API returns only a single datapoint per each matching time series at the specified timestamp time. This API usually works faster than /api/v1/query_range, since it evaluates the provided PromQL query only at a single timestamp instead of multiple timestamps.

Mauldon answered 29/3, 2022 at 15:55 Comment(2)
I've been trying to find the 'instant' toggle in Grafana, but can not find where it is... Cant see it anywhere, and the docs are doing me no favours. Any pointers @valyala?Showboat
Fixed the link in the answer to Grafana docs about instant toggle. The new link is grafana.com/docs/grafana/latest/datasources/prometheus/…Mauldon

© 2022 - 2024 — McMap. All rights reserved.