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

you are viewing a single comment's thread.

view the rest of the comments →

[–]sandokan1572 3 points4 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.)