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

Added custom reservoir support #104

Merged
merged 1 commit into from May 27, 2016
Merged

Added custom reservoir support #104

merged 1 commit into from May 27, 2016

Conversation

sunng87
Copy link
Contributor

@sunng87 sunng87 commented May 27, 2016

Reservoir as an important feature is missing in current metrics-clojure. It allows histogram based metrics (histogram and timer) to drop some data based on custom strategy (uniform, sliding window, etc). This is helpful when we want to collect timer for last minute, for example.

The bad part is upstream API doesn't provide entry point for custom reservoir in MetricRegistry, so there is no way to use this feature with MetricRegistry's get-or-add API. Duplicated creation will lead to IllegalArgumentException. So I created new function for timer and histogram.

@michaelklishin @sjl PTAL

(defn uniform-reservior
"Create a uniform reservior, which uses Vitter's Algorithm R to
produce a statistically representative sample. Default size: 1028."
([] (UniformReservoir.))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry to nitpick but can we keep the argument vector and function body on separate lines, here and everywhere else?

Signed-off-by: Ning Sun <sunng@about.me>
@sunng87
Copy link
Contributor Author

sunng87 commented May 27, 2016

@michaelklishin Thanks for fast response. I just updated the style.

@michaelklishin michaelklishin self-assigned this May 27, 2016
@michaelklishin michaelklishin merged commit 04cf684 into clj-commons:master May 27, 2016
@michaelklishin
Copy link
Collaborator

Thank you!

@sunng87 sunng87 deleted the feature/reservoir branch May 27, 2016 09:50
@sunng87
Copy link
Contributor Author

sunng87 commented May 27, 2016

@michaelklishin possible to make a release for this?

@michaelklishin
Copy link
Collaborator

@sunng87 I'll try making one over the weekend.

@michaelklishin
Copy link
Collaborator

@sunng87 2.7.0 is up on Clojars.

@sunng87
Copy link
Contributor Author

sunng87 commented Jun 1, 2016

@michaelklishin Excellent! Thank you!

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