-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Feature Request] Make regex work on field keys in SELECT clause #5955
Comments
I would update to not have quotes around the regex:
I think the behavior on this should be that it returns a series for each field, just like when you have a regex against a tag. In that output format it'll be consumable by Grafana. |
@pauldix the syntax is a bit confusing for me. So if the following fields exist: If you do |
grafana seems to put double quotes around field names as far as I can see. Not that I care one way or the other as long as it works (preferably without using the advanced/manual query editor) :) |
I have similar problem. I want to use regex on fields:
How can I do that? I want to get memory / time for some urls (single domain or sample path with all files inside etc) |
+1 |
Also interested in this. I have a scenario where we have fields named read_[0-30] and would really love to pull all with something like the following: (Some of you may think this is an insane use case but blame Lustre...)
EXPANDED:
|
We now support this with wildcards so it should be easy enough to support this with regexes in a future version since the foundation is there. |
Can you say more about "now"? (which version of grafana, or perhaps influxdb, etc?) I'm trying with Grafana 3.1.0, and field(), field(usage__), field("usage*"), etc. all return no values. But maybe I'm doing something wrong overall -- the full query is:
|
Ah, that is my mistake for the unclear language. We do not support this exact feature. I should have said:
Wildcards can only exist for expanding all of the fields rather than a subset. We still need to implement regex support. |
Ah, makes sense, but I can't make it work with all fields either -- unless that came with Grafana newer than 3.1? (that is, "*" or just bare * all return errors). Under the hood, it looks like InfluxDB doesn't really support any of this for fields, so any expansion would have to come from Grafana. |
I'm not sure if Grafana supports it, but it was just implemented in InfluxDB very recently. I think you need to run 1.0.0-beta3 and do |
+1 awaiting this feature too, we've got null values in fields and want to query for these fields. |
I'm using grafana templating with influxdb to select the fields to be displayed and grafana creates this query if i select multiple values
It would be nice if this would work. regards |
+1 awaiting this feature as well to match new fields as they are dynamically added to schema. |
This would be nice as it would be a workaround for some issues with time operators. You could build a subquery that would regex timestamps for certain values |
@Electronickss this has already been implemented. For instance if you're using telegraf you can do: select count(/.*/) from cpu where time > now() - 1h
select /.*/ from cpu limit 1 |
How can I use the matches of the regex to use it in the query? Use case would be to be |
how can use not match |
I just tried it as I needed the same thing and it worked just fine for match and not match regex I don't think it will be easy to have this working with mean() function or any other because then function becomes ambiguous - should it apply the function on each individually or on the sum total values for each field |
As an extension of (or at least related to issue #2715, per @jsternberg) It would be wonderful if the field key (name) in the SELECT clause supported regex as is available for measurements in the FROM clause and tags in the WHERE clause. This is also mentioned on the google user groups here.
The reason this is "all of a sudden" very important is now with 0.10.0 of Telegraf (and InfluxDb) there is a shift from many measurements with one value, to one measurement with many values.
A great example of this (though this same thing is EVERYWHERE now) is the change to telegraf's CPU plugin. Prior to telegraf 0.10.0, our query for our CPU graph was simply:
SELECT mean("value") FROM /cpu_usage_.*/ WHERE ...
And Grafana creates a nice graph with series for each of 'user', 'system', 'iowait', etc. The series alias can be created from the measurement name, and it all just works.
Now that we've upgraded to telegraf 0.10.0 we have had to add every one individually, and alias every one individually, so the query now looks like this:
SELECT mean("usage_guest") AS "guest", mean("usage_iowait") AS "iowait", mean("usage_irq") AS "irq", mean("usage_nice") AS "nice", mean("usage_softirq") AS "softirq", mean("usage_system") AS "system", mean("usage_user") AS "user" FROM "cpu" WHERE
I would REALLY like not to have to go through this tedious effort for so many of our dashboards (it applies to all sorts of things, from GC counters, to Heap, to System Memory, to Disk Usage)
We should be able to write the above query like this:
SELECT mean("/usage_.*/") FROM "cpu" WHERE ...
Thanks!
The text was updated successfully, but these errors were encountered: