I am measuring the power consumption on hundreds of devices. The data is collected every 15 minutes (as watt hours used during those 15 minutes) which can then be summed to get the kWh.
The problem is that the devices being measured are not always available (for example they might be rebooting), so there are gaps in my measurements.
I also have tags used to store states, for example if a feature is enabled or disabled:
07:00:00 server=server1,feature_XX=enabled Wh=10
07:15:00 server=server2,feature_XX=disabled Wh=20
<data for 07:30:00 missing>
07:45:00 server=server1,feature_XX=enabled Wh=12
I’m trying now to calculate the total kWh per day for all servers. To do that I don’t care if feature_XX is enabled or disabled, and I want to fill in the missing gaps to get (more) accurate measurements. I’ve tried to drop the feature_XX column and then use interpolation (per 15 minutes), but that still results in duplicate measurements (one for feature_XX=enabled and one for feature_XX=disabled).
I know I must be missing something basic about InfluxDB and how interpolation works. So, if anyone has any advice or tips on how I can tackle this problem, I’d really appreciate it!
Here’s an example of a non-working query:
|> range(start: -30d, stop: today())
|> filter(fn: (r) => r._measurement == “power_data”)
|> filter(fn: (r) => r._field == “consumed_energy”)
|> drop(columns: [“feature_XX”])
|> interpolate.linear(every: 15m)
|> aggregateWindow(every: 24h, fn: sum, createEmpty: false)