Use "counter" type of value instead of gauge.
Isn't more adapted to use "counter" type of value and let collectd compute the delta between value ?
It simplify the code and also make metric being "per second".
With old code, metric are "number of writes since last measurement" (which is usually 10 seconds). When using counter, collectd compute the delta for us and make the metric per second.
What do you think of this change ?
It's been a while since I wrote this, but I remember trying to use counter originally and something wonky happened. Maybe I was just too impatient to have to use derivatives everywhere in Graphite in order to produce usable graphs.
Like it or not, users of this code expect the current behavior. This change is backwards incompatible and too invasive. If you refactor this to make it a configurable option, I'll accept the pull request. But the current behavior needs to be retained as the default behavior.
I've updated the pull request to include a 'DeltaPerSecond' configuration parameter.
It defaults to 'no' : old behavior.
Their is only one little change in old behavior : io_inprogress is always sent, including the very first time. It means that unlike before, when collectd start io_inprogress will be sent immediately and alone. It break the assumption that all metrics are always sent together. I could fix this, but I think it minor enough and it reduces the number of if-then-else.