basicstats aggregators plugin's diff
and non_negative_diff
provide misleading results
#9715
Labels
area/exec
bug
unexpected problem or unintended behavior
help wanted
Request for community participation, code, contribution
size/m
2-4 day effort
waiting for response
waiting for response from contributor
To my understanding, the basicstats aggregators plugin's
diff
andnon_negative_diff
provide at least misleading results. This might also apply to therate
stat which is computed based ondiff
.The behaviour I expect from a
diff
is to provide the difference considering all measurements. Unfortunately the current implementation only provides diffs from the first to the last measurement of a timeframe that is shifted without overlapping (the last measurement of the previous window is not included). With A, B, C, D, E and F being measurementswe currently only get a
diff_value
for the changes from A to B, C to D and E to F, but we are missing the changes from B to C and D to E! Taking only the current period into account is fine / required for stats likesum
,max
andcount
, but I think it does not make sense for deriving stats likediff
andrate
.When we implemented the
diff
stat, I did not realize that the basicstats plugin exclusively moves the sliding window for measurements to be considered.If there are usecases for the current behaviour, I am very interested in learning about those. Otherwise this behaviour should be regarded as a bug.
To my current understanding I assume this plugin should not implement deriving stats like
diff
andrate
as this is not how the concept of the plugin works. Maybe there should be an extra plugin providing those stats or the existing derivative aggregator plugin could be extended accordingly.Relevant telegraf.conf:
System info:
telegraf version 1.19.3
Steps to reproduce:
start telegraf with the above config (
telegraf --config telegraf.conf
)Actual behavior:
Expected behavior:
Besides the provided
value_diff
entries, e.g. from1630661106000000000
to1630661109000000000
resulting invalue_diff=-7
and from1630661112000000000
to1630661115000000000
resulting invalue_diff=5
I would have expected additionalvalue_diff
entries, e.g. for the window from1630661109000000000
to1630661112000000000
.The text was updated successfully, but these errors were encountered: