On Tuesday, December 13, 2016 at 1:57:54 PM UTC+2, [email protected] wrote: > On Tuesday, December 13, 2016 at 1:55:13 PM UTC+2, [email protected] wrote: > > I have the following series of data: > > > > I have a gauge metric and I'm using a continuous query to store how much it > > changes (currently it increases only). It worked until at some point at > > midnight it calculated one wrong value. > > > > Here is the gauge > > > > SELECT value FROM collectd."default".redis_info_value WHERE type_instance = > > 'events_count' AND time > '2016-12-11 23:59:00' and time < '2016-12-12 > > 00:01:00'; > > name: redis_info_value > > time value > > ---- ----- > > 2016-12-11T23:59:03.083946Z 464885 > > 2016-12-11T23:59:13.083743Z 464885 > > 2016-12-11T23:59:23.083716Z 464885 > > 2016-12-11T23:59:33.083845Z 464885 > > 2016-12-11T23:59:43.08375Z 464885 > > 2016-12-11T23:59:53.083731Z 464885 > > 2016-12-12T00:00:03.082633Z 464885 > > 2016-12-12T00:00:13.082735Z 464885 > > 2016-12-12T00:00:23.082801Z 464885 > > 2016-12-12T00:00:33.082657Z 464885 > > 2016-12-12T00:00:43.082643Z 464885 > > 2016-12-12T00:00:53.082647Z 464885 > > > > > > The CQ for getting incrementals: > > > > CREATE CONTINUOUS QUERY cq_redis_events ON collectd RESAMPLE EVERY 10s FOR > > 30s > > BEGIN SELECT non_negative_derivative(sum(value), 10s) INTO > > collectd."default".redis_events > > FROM collectd."default".redis_info_value WHERE type_instance = > > 'events_count' GROUP BY time(10s) fill(0) END > > > > Running it manually (I removed "fill(0)" so values are actually zeros, with > > "fill(0)" I get the same result): > > > > SELECT non_negative_derivative(sum(value), 10s) FROM > > collectd."default".redis_info_value WHERE type_instance = 'events_count' > > AND time > '2016-12-11 23:59:00' and time < '2016-12-12 00:01:00' GROUP BY > > time(10s); > > name: redis_info_value > > time non_negative_derivative > > ---- ----------------------- > > 2016-12-11T23:59:00Z 0 > > 2016-12-11T23:59:10Z 0 > > 2016-12-11T23:59:20Z 0 > > 2016-12-11T23:59:30Z 0 > > 2016-12-11T23:59:40Z 0 > > 2016-12-11T23:59:50Z 0 > > 2016-12-12T00:00:00Z 0 > > 2016-12-12T00:00:10Z 0 > > 2016-12-12T00:00:20Z 0 > > 2016-12-12T00:00:30Z 0 > > 2016-12-12T00:00:40Z 0 > > 2016-12-12T00:00:50Z 0 > > > > Actual values in the measurement of the result of CQ: > > SELECT "non_negative_derivative" FROM "redis_events" WHERE time > > > '2016-12-11 23:59:00' and time < '2016-12-12 00:01:00'; > > name: redis_events > > time non_negative_derivative > > ---- ----------------------- > > 2016-12-11T23:59:10Z 0 > > 2016-12-11T23:59:20Z 0 > > 2016-12-11T23:59:30Z 0 > > 2016-12-11T23:59:40Z 0 > > 2016-12-11T23:59:50Z 0 > > 2016-12-12T00:00:00Z 464885 > > 2016-12-12T00:00:10Z 0 > > 2016-12-12T00:00:20Z 0 > > 2016-12-12T00:00:30Z 0 > > 2016-12-12T00:00:40Z 0 > > 2016-12-12T00:00:50Z 0 > > > > What can be the cause of this? > > CQ FOR is set for 30seconds, but metrics are sent every 10seconds and CQ > > runs every 10 seconds so the query calculates each value 3 times. > > Can it be 30 seconds is still too small interval to go back and somehow CQ > > reports wrong value because of that? > > Version number: > $ influx > Connected to http://localhost:8086 version 1.0.2 > InfluxDB shell version: 1.1.0
I was able to reproduce it by restarting influxdb (although it happens not exclusively when it's restarted) If I remove "fill(0)" from the Continuous Query then it works fine. Example 4 from https://docs.influxdata.com/influxdb/v1.1/query_language/continuous_queries/ says it should just insert 0 for if there's value in the FOR. So it doesn't explain why could this happen, seems like a bug to me. Could someone explain what is going on? -- Remember to include the version number! --- You received this message because you are subscribed to the Google Groups "InfluxData" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/influxdb. To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/cb9f5f22-a7b0-4533-ba33-96f91e72a03b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
