统计一个标签在influxdb中出现的次数

Count the number of times a tag appears in influxdb

我有一个名为 'cars' 的 influxdb 数据库,用于统计经过我大楼的汽车。一个用于此的标签称为 'make',其中 make = {ford, toyota...}。我想通过计算每个标签的条目数来计算每辆车经过我建筑物的次数。

这在 InfluxDB 中可行吗?

编辑:

有效:

> select count(make) from my_series where time > now()-10d group by make;
name: my_series
tags: make=
time                count
----                -----
1524058438416676920 764724

这样的查询将为您提供过去一小时内每个品牌的条目数:

SELECT COUNT(somefield) FROM cars WHERE time > now() - 1h GROUP BY make