Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just ignore matchers which match everything #996

Closed
tomwilkie opened this issue Sep 10, 2018 · 5 comments
Closed

Just ignore matchers which match everything #996

tomwilkie opened this issue Sep 10, 2018 · 5 comments

Comments

@tomwilkie
Copy link
Contributor

Its a common pattern to see matchers which match everything (eg instance=~".*") in queries, as people like to use multi-selects in grafana and then select "all", which results in this.

We should just ignore them - no reason to even look in the index for this matcher, it was not intersectional power.

@bboreham
Copy link
Contributor

Is there an issue against Grafana not to do this?

@tomwilkie
Copy link
Contributor Author

Not that I know of; it'd be pretty hard to implement in Grafana, as it currently doesn't manipulate the query - this is implemented as a variable substitution (ie instance=~"$instance"). Anyway I checked it out and this isn't coming from Grafana - when you select "All" in a multiselect it subs in the form a|b|c.

@bboreham
Copy link
Contributor

I found one in our Grafana dashboards - there is a drop-down for pods, and the defined query is:

sum by (namespace,pod_name) (container_memory_usage_bytes{container_name!="POD",container_name!="",instance="$instance",pod_name=~"${pods:regex}"})

and when pods is set to "All" the Query Inspector shows (after decoding):

https://cloud.weave.works/api/prom/api/v1/query_range?query=sum by (namespace,pod_name) (container_memory_usage_bytes{container_name!="POD",container_name!="",instance="ip-172-20-2-42.ec2.internal",pod_name=~".+"})&start=1536745080&end=1536748680&step=30

which roughly matches what you said.

I now see why it would be hard to fix in Grafana.

@bboreham
Copy link
Contributor

Wait: .+ doesn’t match everything.

@pstibrany
Copy link
Contributor

I've tried to introduce this optimization in Prometheus, but it turns out it's not valid, because there are values that ".*" regex doesn't match, specifically values that include newline character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants