-
Notifications
You must be signed in to change notification settings - Fork 292
rrd: Fix absolute rate calculations #6646
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
Conversation
Absolute metric should work as follows: Timestamp = 300, 600, 900, 1200 Step = 300 seconds ABSOLUTE DS = 1, 2, 3, 4 But they do not seem to have ever worked correctly - they were previously divided by the interval but incorrectly handled NaNs, resulting in wrong behaviour. Then the refactoring (including 73ca3cc ("CA-404597: rrd - Pass Gauge and Absolute data source values as-is")) broke them further. Divide absolute metrics by the interval in process_ds_value. Fix the unit test to expect the right behaviour - it passes with this fix. Signed-off-by: Andrii Sultanov <[email protected]>
Would be good to test against what |
Ah actually you can feed timestamps to
That probably means we can't feed it fractional times, but that should be OK, we can generate synthetic data using integer timestamps only. |
The |
Assuming that is indeed the case, then the implication is that those 8 datasource are wrong by a factor of 5 right now :/ |
Here are 4 of those iostat values getting collected in the
So those do indeed appear to have the right units and "reset" the value by subtracting the "last" value, before passing the values to The |
The This RRD was introduced in c1e0901. |
Indeed. It should be a GAUGE as it's a measurement at a time point. |
In hindsight, perhaps the code that was changed here should wasn't the right place to do it. It seems the aim of that function is to calculate the difference between values for DERIVE datasource, not to do any time-based calculations. There is code further down in
Is this a better place to fix this by having a separate
There is a similar block even further down, which uses |
That's how I first approached it. But your suggestion does not pass the unit test (note that it modifies I don't really see any downsides to the current aproach - the function already considers the interval (when comparing it against |
For downsides of the current approach, the main thing is that dividing by the interval now happens if different places for Derive and Absolute. It would be nice if all the Then again, I don't yet really understand the |
The main thing I don't understand now is why E.g.
etc. |
Absolute metric should work as follows:
But they do not seem to have ever worked correctly - they were previously divided by the interval but incorrectly handled NaNs, resulting in wrong behaviour. Then the refactoring (including 73ca3cc ("CA-404597: rrd - Pass Gauge and Absolute data source values as-is")) broke them further.
Divide absolute metrics by the interval in process_ds_value. Fix the unit test to expect the right behaviour - it passes with this fix.
This means absolute metrics are now correctly calculated as unit/s, changing the behaviour in #6640
I am not 100% sure this fix goes all the way either - unit tests should cover expected values in RRAs as well, and the logic is still really confusing to me.