python-diamond / Diamond

Diamond is a python daemon that collects system metrics and publishes them to Graphite (and others). It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
http://diamond.readthedocs.org/
MIT License
1.74k stars 601 forks source link

set precision of TCPCollector's metrics to 2 #622

Open ikruglov opened 7 years ago

ikruglov commented 7 years ago

Having precision=0 means that any non frequent metrics will be hidden by diamond. For example: if interval=60 and a counter incremented once a minute we have following math done by derivate():

old=1 new=2 derivative_x = 2-1 = 1 derivative_y = 60 result = 1 / 60 = 0.01666666666667

this value is later passed to Metric class which does following if precision=0:

value = sprintf("%.0f", 0.01666666666667)

as result value becomes 0.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 24.127% when pulling e644b91257b362e0685c28c241af3c2a8634547d on ikruglov:master into 746ed8e27a47c1ab5021b57f35779aefdaf9661e on python-diamond:master.

shortdudey123 commented 7 years ago

Also update docs/collectors/TCPCollector.md with the precision config option