Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set precision of TCPCollector's metrics to 2 #622

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ikruglov
Copy link

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.

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
Copy link

Coverage Status

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

Copy link
Member

@shortdudey123 shortdudey123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this a config option instead of changing the hard coded value?

@shortdudey123
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants