Cannot apply range selectors

5,496 views
Skip to first unread message

maur...@gmail.com

unread,
Jan 22, 2016, 6:46:19 AM1/22/16
to Prometheus Developers
Hi to all,
I've just discovered Prometheus so I'm testing it.

I've run the current master version with docker and executing the sample query "http_requests_total[5m]" (found on the documentation, see http://prometheus.io/docs/querying/basics/ chapter "Range Vector Selectors") the server returns the following response:

> Error executing query: invalid expression type "matrix" for range query, must be scalar or vector

Is it a bug or I'm mistaking something?

Thanks,
Mauro

Julius Volz

unread,
Jan 22, 2016, 8:43:08 AM1/22/16
to maur...@gmail.com, Prometheus Developers
Hi,

An expression that returns a range vector can only be queried in tabular view, not in the graph view. The reason is that a graph query itself already evaluates an entire expression over time, so you'd be getting back a whole range of values at each every sampling point along the graph (which doesn't make sense to graph). What you *do* use range vectors for in graphs is things like rates or deltas that take a range vector and return an instant vector, like: rate(http_requests_total[5m]).

The short rule is that only expressions that return an instant vector can be graphed.

Cheers,
Julius


--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mauro Rocchi

unread,
Jan 22, 2016, 9:44:56 AM1/22/16
to Julius Volz, Prometheus Developers
Hi Julius,
many thanks for the clarification.

Mauro

hero...@gmail.com

unread,
Apr 20, 2019, 1:49:41 PM4/20/19
to Prometheus Developers
This is something really confusing. It should be included in the doc. Thank you very much for clarifying that!
Reply all
Reply to author
Forward
0 new messages