Continuous query - tag hour in day

Hi,

I am using influxdb for my energy consumption data. I would like to create a continuous query (Not found any other way supported by influxdb) where I would after every hour run a CQ which would add a hour tagkey.

Ex.

Value Time
4 2019-01-01 00:00 - 01:00 --> Run QC to new database and add tagkey 00-01
6 2019-01-01 01:00 - 02:00 --> Run QC to new database and add tagkey 01-02
5 2019-01-01 02:00 - 03:00 --> Run QC to new database and add tagkey 02-03

Is it possible to schedule continuous queries to run every hour?Preformatted text

Hello @Stian_Braa,

Why do you want to inherit the timestamp in a tagvalue? What are you looking to do? Can you not just filter your data by timestamp after performing a CQ?

FYI you can include GROUP BY * in the CQ to preserve tags in the destination measurement as specified here.

Hi,

In the end I would like to get data from multiple days and sum the energy consumption per hour in a day:

The only way I have found that might work is to create tags with the hour of day.

br
Stian

@Stian_Braa,

We don’t support histograms in 1.x but we do in 2.x (only the alpha is available at the moment). You could theoretically make a CQ at the end of 24 hours and put the data into 24 different series with 24 different tags (one, two, three…etc). However, then you wouldn’t be able to graph them all on one graph. However, if you’re okay with using a scatter plot to visualize this data you could make a hacky solution with Flux. I would take a look at the Window() function and this blog to start.

Thanks! Looking forward to v2. For now it looks like I managed via tickscripts and grafana on the visual side:

2019-04-24_2321

Not optimal, but will do while we wait for something better.

1 Like