Reputation: 3
I've set up the following InfluxDB measurement called ratio with one fieldKey called "name"
--------------------------------------------------
| time | name |
--------------------------------------------------
| 1481274571179850400 | current_assets |
--------------------------------------------------
| 1481274571179850401 | othervalue |
--------------------------------------------------
| 1481274571179850402 | othervalue |
--------------------------------------------------
| 1481274571179850403 | current_assets |
--------------------------------------------------
| 1481274571179850404 | othervalue |
--------------------------------------------------
There are about 20 different names. Depending on what is called on the backend I write one line with the given name (e.g. current_assets, othervalue, ...) for statistic.
This works well and I get the table above.
Now I'd like to create one query (in grafana)
e.g.
251 "current_assets" entries the last 24 hours
21 "other value" entries the last 6 hours
I have tried different things here but I can not make it.
Does somebody have any idea how such a query can look?
Thanks a lot
Upvotes: 0
Views: 2282
Reputation: 4747
I'd recommend changing name
to a tag and having a field value
that either stores an integer or a bool. That way you can issue queries like
SELECT count(value) FROM ratio WHERE time > now() - 24h GROUP BY name
Upvotes: 2