-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Metrics from Caffeine caches #1608
Conversation
@ben-manes see any reason not to? |
The only limitation is sometimes users add Based on that, I think the push model is nice though polling like Guava's |
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.
Changes look good to me.
metrics-caffeine/src/main/java/com/codahale/metrics/caffeine/MetricsStatsCounter.java
Outdated
Show resolved
Hide resolved
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.
LGTM in general.
Would you please add a page in the documentation similar to the EhCache documentation (https://metrics.dropwizard.io/4.1.2/manual/ehcache.html)?
metrics-caffeine/src/main/java/com/codahale/metrics/caffeine/MetricsStatsCounter.java
Outdated
Show resolved
Hide resolved
metrics-caffeine/src/test/java/com/codahale/metrics/caffeine/MetricsStatsCounterTest.java
Show resolved
Hide resolved
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.
LGTM! Looking forward for Caffeine metrics.
Co-authored-by: Jochen Schalanda <jochen@schalanda.name>
@joschi - added documentation |
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.
@john-karp @ben-manes LGTM, thanks a lot!
Thank you @john-karp for taking my simple example and making it production worthy! :) |
Add ability to gather metrics from Caffeine cache library. An instance of
MetricsStatsCounter
should be passed to the Caffeine cache builder, resulting in Caffeine using that class to publish metrics to the desired metrics registry. (An example of this usage is in the UT.)Code was taken from example given by Caffeine library author provided at https://github.com/ben-manes/caffeine/blob/master/examples/stats-metrics/src/test/java/com/github/benmanes/caffeine/examples/stats/metrics/MetricsStatsCounterTest.java
Adding it into official dropwizard metrics repo should make it easier for dependent projects to take advantage of.
It has the Apache Public License 2.0, same as this project, so I assume it is okay to integrate?
Changes made to copied sources: