-
Notifications
You must be signed in to change notification settings - Fork 27
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
StatsdClient
flush functionality
#200
Conversation
Hi! Thanks for the PR. Adding a I'm curious about your opinion @mlowicki since you recently made some
Do you mind opening a separate PR for those changes? Thank you! |
Yeah we didn't see any sinks that flush on a time interval and also figured some manual control would be best for developers who need it. And sure, I will separate out the ToCounterValue changes. Thanks! |
StatsDClient
flush functionality and ToCounterValue
for u64StatsdClient
flush functionality
It should be still possible to manually flush by keeping reference to the underlying sink and calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will defer to users instead of forcing everyone to copy the code from examples/wrapped.rs
Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com>
Sounds good, I've made the changes and everything should be RTG. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last change and I think this is good to merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Problem
The
StatsDClient
utilizes aMetricSink
, which can optionally be buffered. Buffering helps save network bandwidth; however, theBufferedUdpMetricSink
won't be flushed until it is full. For, an application which emits relatively few time-sensitive metrics in conjunction with a large amount of time-insensitive metrics, the default buffer flushing may not give the user enough control and result in faulty metric collection (especially since StatsD does not tag metics with a timestamp).Solution
I have added a
pub fn flush()
to theStatsDClient
which gives users the control they need to flush time-sensitive metrics while also allowing the regular buffer functionality to flush once the buffer is full. Also, I added aToCounterValue
implementation for the u64 type since most counters are unsigned.