1
votes

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()

1
What are the results of SHOW FIELD KEYS? - beckettsean
Field key is value for each metric but when using SELECT COUNT(value) I get the result for each metric rather than the total count of metrics values for the time period. - jtblin
There is no way to ask the system for a count of all points. This would be similar to asking a relational database how many rows there were in all tables combined, and is not a supported query. - beckettsean

1 Answers

5
votes

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)