Understanding Grafana Options on explore page

Viewed 29

I have reviewed the Prometheus documentation and understand the difference between an instant and range vector. In PromQL, you can define an expression as a range vector by adding a [5m] range at the end (as a example).

I therefore am a bit confused when using Grafana to construct a query. Besides for the prometheus expression which I write, it has some other options you can select: enter image description here

What exactly does the Type option of range/instant do, if the expression itself should define if its a range or instant vector? Additionally, what would the 'Both' option mean?

1 Answers

https://grafana.com/docs/grafana/latest/datasources/prometheus/

Range - Query returning a Range vector, a set of time series containing a range of data points over time for each time series.

Instant - Perform an “instant” query to return only the latest value that Prometheus has scraped for the requested time series. Instant queries can return results much faster than normal range queries. Use them to look up label sets. Instant query results are made up only of one data point per series but can be shown in the graph panel in a dashboard with the help of series overrides. To show them in the graph as a latest value point, add a series override and select Points > true. To show a horizontal line across the whole graph, add a series override and select Transform > constant.

Both - Available only in Explore. Runs both range and instant query

Mixing Prometheus query type with Grafana query type:

  • Range Prometheus query + Instant Grafana type => single (last) point only in the Grafana graph
  • Instant Prometheus query + Range Grafana type => I guess also single (last) point only in the Grafana graph
Related