Hi, I’m new to InfluxDB and looking to use it in a realtime monitoring set up.
I am writing data to an InfluxDB measurement that has a tag to identify the instance that the data point it for and its value. Different instances send a data point to the same measurement at times but with the same sample frequency. The value being sent is strictly increasing.
Example data could be:
T, id, value
1, a, 100
2, b, 50
3, a, 150
4, b, 125
5, a, 155
6, b, 180
I’d like to query the sum of values across instances and I would expect a strictly-increasing time series as the result, e.g. for the above sample data:
The issue I’m having is that for sufficiently small intervals the resulting time series is not strictly increasing and appears to use 0 instead of the previous value for a tag when the tag doesn’t have a data point in the interval. This ends up with a series that looks like:
Concretely, if T above is in minutes, the issue I’m describing can be observed with this query:
SELECT sum(“value”) AS “sum_value” FROM “testdb”.“autogen”.“test_metric” WHERE time > :dashboardTime: AND time < :upperDashboardTime: GROUP BY time(1m) FILL(previous)
Changing the FILL policy seems to have no effect, but previous sounded like the most likely to have the behaviour I want. Changing the time grouping to 2m gives the time series I expect, but with lower resolution than I want.
Is there a way to write a query that carries forward values for tags across intervals?
I can think of a couple of work-arounds but they feel a bit hacky to me:
- Send values more frequently so that I can use the resolution I want in the above query, though in my real-world app this is already a lot of data and I’m not wanting to unnecessarily increase it.
- Write an intermediary service that synchronises the data points and sends the current value for all instances when any of the instances sends a new data point.
Thanks in advance for the advice