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

Fix for wrapper function returning 0ms timings #41

Closed
wants to merge 1 commit into from
Closed

Fix for wrapper function returning 0ms timings #41

wants to merge 1 commit into from

Conversation

anthroprose
Copy link

DEBUG: Bad line: 0,ms in msg "production.timer:0|ms"
https://github.com/etsy/statsd/blob/5b900711191a9c5cfd536c877a3c119d1df5679a/lib/helpers.js#L35
return isNumber(fields[0]) && Number(fields[0]) > 0;

statsD expects a > 0 number for ms counters.

DEBUG: Bad line: 0,ms in msg "production.timer:0|ms"
https://github.com/etsy/statsd/blob/5b900711191a9c5cfd536c877a3c119d1df5679a/lib/helpers.js#L35
return isNumber(fields[0]) && Number(fields[0]) > 0;

statsD expects a > 0 number for ms counters.
@jsocol
Copy link
Owner

jsocol commented Mar 9, 2014

That's interesting. I'd actually argue that's an issue with StatsD. Dropping a sub millisecond time that the application submitted changes the measured value. Unless they've specifically rejected changing that it seems like the fix belongs there.

@anthroprose
Copy link
Author

I know this could spiral down code philosophical hell, but the official statsD implementation does in fact reject 0ms times, as well, its not theoretically possible to run something in less than the unit of time that it measures (which is actually 10ms).

I would change it in my code, but I am using the wrapper function, not the .timer() so I cannot apply logic, and is also why I did not change the actual call, only the function.

I will fix the tests and rebase.

@jsocol
Copy link
Owner

jsocol commented Mar 9, 2014

 its not theoretically possible to run something in less than the unit of time that it measures (which is actually 10ms).

I don't understand that, obviously it's possible to run something in less than a millisecond or else you never would have seen this. 

I'm saying the "official" implementation—which is only a de facto standard—is wrong. If you look at the commit that added the >0 check, it wasn't specifically supposed to do that, just to more liberally validate that the value was actually a number. 

Since the timers are averaged, dropping 0 values in a client (or the server, really) systematically skews the data. 

Sent from my phone, please excuse the occasional typo.

On Sat, Mar 8, 2014 at 7:16 PM, Alex Corley notifications@github.com
wrote:

I know this could spiral down code philosophical hell, but the official statsD implementation does in fact reject 0ms times, as well, its not theoretically possible to run something in less than the unit of time that it measures (which is actually 10ms).
I would change it in my code, but I am using the wrapper function, not the .timer() so I cannot apply logic, and is also why I did not change the actual call, only the function.

I will fix the tests and rebase.

Reply to this email directly or view it on GitHub:
#41 (comment)

@anthroprose
Copy link
Author

I meant the original simply drops them, so this was an attempt to save network i/o, and statsd error handling, but honestly after reading through all the tests, I am tending to lean towards moving this up to statsd with a 'allowZeroTiming' option for those of us who rely on the aggregate timing functions of counting.

@anthroprose anthroprose closed this Mar 9, 2014
@jsocol
Copy link
Owner

jsocol commented Mar 9, 2014

I'm happy to open a pull req upstream as well. I'm sold that they shouldn't drop 0 times--

Sent from my phone, please excuse the occasional typo.

On Sat, Mar 8, 2014 at 7:44 PM, Alex Corley notifications@github.com
wrote:

Closed #41.

Reply to this email directly or view it on GitHub:
#41

@anthroprose
Copy link
Author

statsd/statsd#397

Seems there were a few of us on it, I just started a bit downstream instead of from the source ;)

@jsocol
Copy link
Owner

jsocol commented Mar 13, 2014

Ah, looked at the python-statsd pull req, and the timing floor WoLpH mentioned is actually 10µs, not 10ms (just for myself/posterity).

@anthroprose
Copy link
Author

One of the more thorough people I've encountered... many thanks for your info as well as guidance... honestly learned more digging through code and this issue than blinding running services for a while.

csestelo pushed a commit to Destygo/pystatsd that referenced this pull request Jul 18, 2022
* Update docker-compose ports and remove import List and Dict from typing

* Add buttons field in AnswerData

* Add extensive tests for buttons data validation

* Remove TODO

* Split too long test in function

* Remove useless required_field helper

* Add a default_factory list for buttons

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

Successfully merging this pull request may close these issues.

None yet

2 participants