@0liver The influxdb.cardinality() function depends on an API that hasn’t been added to InfluxDB 2.0 yet. In the mean time, you can use a query similar to the following to return the total series cardinality within a time range. Fair warning, this could be a fairly heavy query depending on your data.
By default, from() returns results grouped by series (measurement, tag set, and field key). The example below uses first() to limit each table (series) to a single row, and then group() to group all rows into a single table, and then count() to count the number of rows in the table. That should give you series cardinality.
Hello @letrout,
Can you share the data you’re using? as well as the flux? There isn’t a mean() function in the flux above so I’m surprised that you’re getting that error.
Finally are you using Cloud? If so, you might be interested in:
I actually remember I had to use a transform to make it work for me. Apologies, I did not posted the updated query. I will try to retrieve it for you.
To be honest, it did not work for me as suggested by @scott, the query seems to be quite resource intensive and would never return in my case (I believe after 5mn it was still running).
I wish this feature was implemented for OSS v2 as it is something we are highly relying on.
@0liver Just to follow up on this, InfluxDB 2.1 will ship with the API necessary for the influxdb.cardinality() function. It should be available in the next couple of days. You could also build InfluxDB from source if you want it now.