influxdb - Should counters in telemetry be monotonically increasing -


hello
i wondering standard best practice storing counter values time series database. should increasing value 10, 20, 30 showing @ each time total value of counter. or should 10, 10, 10 showing value of counter during particular time interval , resetting 0 once value has been reported tsdb. problem first approach server restart etc. counter value reset 0 point counter value might overflow.

it's better use monotonically increasing counters every time it's possible. reason way, if lose points, lose resolution, still have information on lower resolution.

as downsides, in opentsdb can specify metric counter, , server take care of overflows , reset 0 you.

from opentsdb docs:

opentsdb 2.0 provides support special monotonically increasing counter data handling including ability set "rollover" value , suppress anomalous fluctuations. when countermax value specified in query, if data point approaches value , point after less previous, max value used calculate accurate rate given 2 points. example, if recording integer counter on 2 bytes, maximum value 65,535. if value @ t0 64000 , value @ t1 1000, resulting rate per second calculated -63000. know it's counter rolled on can set max 65535 , calculation 65535 - t0 + t1 give 2535.

systems track data in counters revert 0 when restarted. when happens , spurious result when using max counter feature. example, if counter has reached 2000 @ t0 , reboots server, next value may 500 @ t1. if set our max 65535 result 65535 - 2000 + 500 give 64035. if normal rate few points per second, particular spike, 30s between points, create rate spike of 2,134.5! avoid this, can set resetvalue will, when rate exceeds value, return data point of 0 avoid spikes in either direction. example above, if know our rate never exceeds 100, configure resetvalue of 100 , when data point above calculated, return 0 instead of 2,134.5. default value of 0 means reset value ignored, no rates suppressed.


Comments