Im using chronograf to count the number of fields returned from a measurement.
SELECT count(*) AS “count_sessions” FROM “telegraf”.“autogen”.“Janus Node” WHERE “url”=‘https://xxx.xxx.xxx.xxx/xxx’
The above seems to return a count of all the data points rather than the number of fields.
Hi @Si-Richards ,
Here you go
import "influxdata/influxdb/schema" schema.measurementFieldKeys(bucket: "Jetson", measurement: "exec_jetson_stats") |> count()
schema.measurementFieldKeys generates a table of all fields for a particular bucket and measurement. count then counts the number of rows within the table
Thanks Jay,
I enabled flux but kept getting path issues with import which is suspect is down to my server version.
in the end i mapped distinct values then counted which seems to work. Apologies if this is not good practice.
from(bucket: "telegraf/autogen")
|> range(start: v.timeRangeStart)
|> filter(fn: (r) => r._measurement == "Sessions Count")
|> distinct(column: "value")
|> map(fn: (r) => ({new_column: r._value, _value:r._value}))
|> count()
1 Like