prometheus / client_java

Prometheus instrumentation library for JVM applications
http://prometheus.github.io/client_java/
Apache License 2.0
2.18k stars 799 forks source link

Add Java Flight Recorder based instrumentation as an alternative to MX Bean instrumentation. #832

Open claytonwohl opened 1 year ago

claytonwohl commented 1 year ago

The simpleclient_hotspot library observes metrics about Java applications using Java's old MX bean architecture (JMX). Java versions 14+ offer a newer better way to observe these types of metrics about running Java applications: Java Flight Recorder (JFR) Event Streaming.

The Prometheus Java library should continue offering the JMX-based simpleclient_hotspot for applications running older versions of Java, such as Java 11, but should add a newer alternative, simpleclient_jfr (or something similar) that is based on the newer architecture for applications running Java 17+. Ideally, make this new option JPMS friendly with a module-info.java so end-applications can use jlink packaging which requires dependency libraries to have module-info.java defined.

fstab commented 1 year ago

Awesome idea, thanks a lot.

I am working on a new release that will be compatible with the module system.

However, I didn't find the time to look into JFR metrics yet. If you like to contribute please comment here how you think client_java's JFR monitoring should look like.