-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Allow DISTINCT function to operate on tags #3880
Comments
Idea also exist in #1815 at "Not currently implemented (might in the future, but no promises)" |
@The-Nik are you asking for |
I ask for DISTINCT to support tags for counting the different tag values 👍 |
@The-Nik you can use
|
Yeah, this is a good way. But in my case, I need the number in Grafana in a single stat panel. In Grafana, there are some aggregate fuctions but no "count". So InfluxDB has to serve the exact value or I build something in my Grafana like a count-function ;-) |
+1; being able to quickly summarise the distinct number of datasets / tags directly from the influx SQL would be very handy; e.g. a grafana panel of the number of sensors I have reporting data over time. |
+1: I have a similar use case to yee379 in mind. |
+1 on being able to count distinct tags. I also feel like this speaks to the deeper issue of providing guidance on what should be a tag vs. a value. For a schema-less DB there's sure a lot of subtlety around defining your schema! :) |
I would also like to see this. We use the cpu and load plugins which themselves don't explicitly provide the cpu count. They do provide each cpu as an "instance" tag e.g. a box with 32 cpus will collect metrics on 32 individual cpus tagging them with with their instance number. If I could get the total count of cpus from the tags, then the load numbers would have a little more context in our graphs Grafana and Chronograph. |
+1, any progress on it ? |
+1. this would makes things quite a bit simpler for some tasks at hand. |
+1 |
+1 Really need this. Tag should also support a kind of normal |
+1 |
+ 1 Anybody as a solution to count my hosts in Grafana through Influxdb query language ? |
+1 |
2 similar comments
+1 |
+1 |
++++++1 This would really help pulling some of our metrics much much easier |
+1 |
Perhaps a better way to accomplish the same goals: #5668 |
+1 |
2 similar comments
+1 |
+1 |
+1 (as described by @cnelissen) |
+1 |
1 similar comment
+1 |
Please leave +1 comments to adding a 👍 to the top post using a reaction. Leaving a message notifies everybody who is participating in this conversation and doesn't add anything to the discussion. |
My need is to count number of unique tags with tag filters in Grafana. I can count fields but it gives incorrect answer. SHOW SERIES cannot be limited enough like return only one TAG which I could the distinct + count. SELECT count("Incoming_Answers_2xxx") FROM "Realm-day" WHERE "INSTANCE" =~ /IPXDEA/ AND "ANSWERHOST" =~ /dtag/ AND "REALM" =~ /mcc2/ AND time > '2017-02-09T00:00:00Z';
|
I managed to achieve this by using subqueries in influxdb 1.2 Eg. getting number of hosts from telegraf in grafana:
I'm using a measurement and a field I know it will always be present, it could be anything. |
If you get no data for a host for the time period won't it be missed ? I don't think this can be 100% relied upon ?
… On 10 Feb 2017, at 16:04, lpic ***@***.***> wrote:
I managed to achieve this by using subqueries in influxdb 1.2
Eg. getting number of hosts from telegraf in grafana:
select count(tot) from (SELECT mean("used") as tot FROM "mem" WHERE $timeFilter GROUP BY "host" fill(null))
I'm using a measurement and a field I know it will always be present, it could be anything.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yes, but that's what I expected. If there is no data for a particular host during the selected query period I don't want to consider it. You can remove or maybe increase this time restriction in the WHERE clause, but then I guess the query can be quite slow. |
Ok so it's slightly different use case, I think most want a distinct list of tag key values regardless of time period.
i.e. I'd want all time across a year of data for example potentially peta bytes of data where the series count might be 2m cardinality.
… On 10 Feb 2017, at 16:25, lpic ***@***.***> wrote:
Yes, but that's what I expected. If there is no data for a particular host during the selected query period I don't want to consider it. You can remove or maybe increase this time restriction in the WHERE clause, but then I guess the query can be quite slow.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
+1 |
In my case I needed to display the number of sensors which reported within a time interval (to indicate confidence of the mean). I managed to work around it with a subquery, but it's a bit filthy: SELECT count("first") FROM (
SELECT first("value") FROM "temperature"
WHERE "topic" =~ /hub0[1234567]\/sensors\/\d+\/temperature/ AND $timeFilter
GROUP BY time($interval), topic
)
WHERE $timeFilter
GROUP BY time($interval) |
+1 |
1 similar comment
+1 |
I'm locking this to prevent further 👍 messages. We will be discussing this to figure out the feasibility of the request and create a timeline. Please push the "Subscribe" button instead to get any updates about this feature. |
WIP: there's some work completed to allow distinct / count against a
But there are still wrong answers being resolved:
|
I would like to have following feature:
Since the new release 0.9.3 tags are resulting as own columns if you use SELECT * FROM measurement
Currently, it's not possible to use commands on this columns. An example:
returns:
I want to do a query like:
The result is
Anyone else need this feature?
The text was updated successfully, but these errors were encountered: