add reset or overflow detection in percentage-of-incremental-total dimensions - like it already existed for incremental dimensions; fixes #729
Costa Tsaousis committed
Jul 27, 2016 at 13:01 UTC
ddac4532c41f240075431a74d32050208d3df8cb
1 file changed
+11
src/rrd.c
+11
@@ -1049,6 +1049,17 @@ unsigned long long rrdset_done(RRDSET *st)
1049
continue;
1050
}
1051
1052
+ // if the new is smaller than the old (an overflow, or reset), set the old equal to the new
1053
+ // to reset the calculation (it will give zero as the calculation for this second)
1054
+ if(unlikely(rd->last_collected_value > rd->collected_value)) {
1055
+ debug(D_RRD_STATS, "%s.%s: RESET or OVERFLOW. Last collected value = " COLLECTED_NUMBER_FORMAT ", current = " COLLECTED_NUMBER_FORMAT
1056
+ , st->name, rd->name
1057
+ , rd->last_collected_value
1058
+ , rd->collected_value);
1059
+ if(!(rd->flags & RRDDIM_FLAG_DONT_DETECT_RESETS_OR_OVERFLOWS)) storage_flags = SN_EXISTS_RESET;
1060
+ rd->last_collected_value = rd->collected_value;
1061
+ }
1062
+
1063
// the percentage of the current increment
1064
// over the increment of all dimensions together
1065
if(unlikely(st->collected_total == st->last_collected_total))