WispyCloud
WispyCloud

Reputation: 4230

How to query how many metrics in a period with Influxdb?

I want to know how many events we send to InfluxDB for a given period. If I use the following query SELECT COUNT(value) FROM /./ WHERE time > now() - 1h GROUP BY time(10m), I get that grouped for each metric but I want the total for all metrics.

If I use SELECT COUNT(*) FROM /./ WHERE time > now() - 1h GROUP BY time(10m), I get an error:

Server returned error: expected field argument in count()

Upvotes: 1

Views: 7165

Answers (1)

beckettsean
beckettsean

Reputation: 1846

The COUNT function takes one and only one field key as an argument. If you have field keys that are not named value you will have to run a separate query to count them.

Alternately, you can run them together like:

SELECT COUNT(value), COUNT(otherfield), COUNT(anotherfield) FROM /./ WHERE time > now() - 1h GROUP BY time(10m)

Upvotes: 5

Related Questions