-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for derivative() CQ's with empty buckets #3383
Conversation
It looks like the tests are failing due to networking issues? |
…ng with GROUP BY clause
@kruckenb - the builds are failing due to compilation errors. Please run
|
@otoolep passes tests now. |
Not sure if this is right. The point of |
@pauldix This patch doesn't remove computing previous intervals. Previous intervals are still computed back to The problem with This fixes another issue that is also at the root of #3247: if you run a CQ with a I'm not sure I'm explaining it clearly (there's a lot to this), if it would help I can post some before-and-after details. |
The original goal with the combination of For instance, if you have a CQ with a group by time of Having only a single time interval means that you could end up not recomputing those They could set the That make sense? |
@pauldix I think I know how to resolve this so it uses
If that approach sounds right I'll code it up. |
Refactored to support both |
I think there might be one small issue on the setting of the time if In that case the What we actually want to happen is that in all cases, the start time is rounded down to the previous interval. So in the case of my example, we'd actually always compute the last hour and the current hour. In the case of a |
+1 on this commit! We're looking to graph rate metrics like packets/sec for network traffic, and using the deriv is one key way to implement this. Having gone back and forth trying to get consistent data in our graphs (using grafana), it's somewhat confusing as to the best approach. Overall question, does it make more sense to apply a query as below in a CQ or just have it run on its own? Seems like a CQ may lead to more consistent data with the ability to tweak the re-calc knobs, but is that best practice for such a (seemingly common) metric?
I'm curious to try out the patch from @kruckenb for a CQ with the above query to ensure we don't receive 0 values. At this point, whether from GUI or CLI we get periodic 0-values returned if we happen to query between intervals. If I'm in a tight loop accessing the same set of data (say a read query from 100 hosts at the same time), some will get all 0's but some will get full data... > select derivative(last(value)) from net_packets_recv where host='hostname' and interface='enp129s0f0' and time > now() - 1h group by time(10s)
name: net_packets_recv
----------------------
time derivative
2015-09-23T15:31:10Z 0
<wait about one/two seconds>
> select derivative(last(value)) from net_packets_recv where host='hostname' and interface='enp129s0f0' and time > now() - 1h group by time(10s)
name: net_packets_recv
----------------------
time derivative
2015-09-23T15:31:30Z 216.8
2015-09-23T15:31:40Z 216.8
2015-09-23T15:31:50Z 217.9
2015-09-23T15:32:00Z 230.5
...
... |
Following up yet again, found a post with a tip buried deep within...though it does present its own problems. For derivative functions (likely any other rate calcs), you should append fill(0) to your query: https://groups.google.com/forum/#!topic/influxdb/YbbWL2KCyVk This does result in some wonky first-bucket calculation periodically but overall does what you need. |
Any fix for derivative should also fix derivatives when querying normally. We may revisit this kind of solution later, but I think we're going to try implementing the suggestion in #5943. Thanks for your contribution. I'm going to close this PR. |
As mentioned beginning at #3247 (comment)
Setting recompute intervals using
recompute-previous-n
results in empty intervals when the interval doesn't overlap every sampling rate window.The GROUP BY time() in the CQ already buckets on the correct intervals, so
recompute-previous-n
is unnecessary.This is a fix against 0.9.2 branch, would be awesome if this could ship as part of 0.9.2