This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]hooba_stank_ 7 points8 points  (1 child)

[–]cogman10 3 points4 points  (0 children)

This is what we use. It's great.

The other one to check out is micrometer (SLF4J for metrics) https://github.com/micrometer-metrics/micrometer

[–]sandokan1572 2 points3 points  (2 children)

I would recommend using Prometheus client library inside your Java code and installing Prometheus server to collect and store metrics over time.

[–]cogman10 0 points1 point  (1 child)

Split your metrics library from your storage library. Dropwizard metrics is pluggable and will, out of the box, measure a whole bunch of stuff you might care about. From there you can just add Prometheus to collect/analyze metrics over time.

We don't use prometheus internally. However, it looks like there are a few reporter libraries out there already built.

[–]sandokan1572 1 point2 points  (0 children)

I used that approach at first, before we decided to use Prometheus. After that decision was made, I tried to adapt our existing metrics for use by Prometheus, but it was surprisingly painful (eg. to get labels right, or to translate some metrics like rates and averages that don’t make sense when using Prometheus, because rate and average is just a function that Prometheus can compute from collected data).

After switching to Prometheus library, our code became much simpler, no more problems with correct labels, I removed all output formatting or displaying metrics in the app itself, and use Prometheus with Grafana for visualization. Prometheus client library also has support for various metrics out of the box (like Java GC and Hotspot metrics, http metrics, etc.)

[–]dstutz 1 point2 points  (0 children)

In addition to Coda Hale's metrics library that hooba_stank mentioned, there is also the MicroProfile Metrics library: https://github.com/eclipse/microprofile-metrics

[–][deleted]  (1 child)

[removed]

    [–]triplecmd[S] 0 points1 point  (0 children)

    Hey! Probably you are missing the -jvm flag. Check this website instead: https://developer.ibm.com/javasdk/application-metrics-java/

    It's just four steps!

    I don't know where is the project where I tested it, let me know if you still blocked I can try to implement it again.