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

Investigate buffered MetricSink implementation #18

Closed
56quarters opened this issue Jul 19, 2016 · 3 comments
Closed

Investigate buffered MetricSink implementation #18

56quarters opened this issue Jul 19, 2016 · 3 comments
Assignees
Milestone

Comments

@56quarters
Copy link
Owner

56quarters commented Jul 19, 2016

Per Statsd docs, it's possible to batch up metrics before sending. See if we can introduce some primitive in Cadence that makes this easy to do. Maybe a buffered sink that wraps another sink?

@56quarters 56quarters added this to the 0.7.0 milestone Jul 19, 2016
@56quarters 56quarters self-assigned this Jul 19, 2016
@56quarters
Copy link
Owner Author

Since this buffered sink will be mutable (or the wrapped data structure will be) it'll have to use locking around any critical sections.

@56quarters
Copy link
Owner Author

56quarters commented Jul 20, 2016

The underlying writer used by the metric sink will probably end up being similar to LineWriter or BufWriter.

@56quarters 56quarters modified the milestones: 0.8.0, 0.7.0 Jul 21, 2016
@56quarters
Copy link
Owner Author

In the interest of incremental work, this issue will only cover introducing a buffer. There will be another issue / PR for moving network calls to a separate thread ala threadpool. Both of these things will have to be completed for the 0.8.0 release

56quarters added a commit that referenced this issue Aug 6, 2016
New MetricSink implementation that buffers metrics sent to it up to a certain
size (user configurable) before sending via a UDP socket. Each metric is written
to a shared (mutex guarded) buffer along with a trailing newline (\n). When the
buffer cannot fit the next metric, it will be flushed.

Metrics that are too large for the buffer (unlikely but possible) will be written
directly to the underlying socket.

Current limitations:

* Mutex poisoning is not handled. It has the potential to panic the thread.
* Metrics are still written to the socket in the calling thread.

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

No branches or pull requests

1 participant