You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that Prometheus contains some smartness that prevents you from running queries that match every metric. For example, running the query {} prints the following error:
Error executing query: parse error at char 2: vector selector must contain label matchers or metric name
Let's add some smartness to work around this by running {__name__=~".*"}:
Error executing query: parse error at char 16: vector selector must contain at least one non-empty matcher
You could ask yourself: why would you want to run a query that matches every metric? Well, I just want to get a rough idea of the number of metrics our Prometheus setup stores by job. Ideally I'd just want to run count({}) by (job), but now I'm forced to use workarounds like count({__name__=~"..*"}) by (job) (notice the ..*).
The text was updated successfully, but these errors were encountered:
This is on purpose to reduce the chances of users accidentally hosing their Prometheus, as it's very easy to end up with such an expression while playing around.
I've noticed that Prometheus contains some smartness that prevents you from running queries that match every metric. For example, running the query
{}
prints the following error:Let's add some smartness to work around this by running
{__name__=~".*"}
:You could ask yourself: why would you want to run a query that matches every metric? Well, I just want to get a rough idea of the number of metrics our Prometheus setup stores by job. Ideally I'd just want to run
count({}) by (job)
, but now I'm forced to use workarounds likecount({__name__=~"..*"}) by (job)
(notice the..*
).The text was updated successfully, but these errors were encountered: