a collector that scrapes JFR events from a JVM target at runtime for Prometheus to use
You can obtain a agent jar by downloading a prebuilt artifact or building from source.
Download the prebuilt jar from the release page.
$ wget https://github.com/tabjy/prometheus-jfr-exporter/releases/latest/download/prometheus-jfr-exporter-1.0-SNAPSHOT-all.jar
This project references libraries from JDK Misson Control project, which is not published on Maven Central. In order to build from source, gradle expects to find JMC artifacts in Maven Local. Follow offical instructions to build JMC.
After packaging JMC, run the following command in JMC root directory to install artifacts to Maven Local.
$ mvn install -DskipTests -Dspotbugs.skip=true
- Clone this repository to local.
$ git clone https://github.com/tabjy/prometheus-jfr-exporter.git
- Run gradle to build a fat jar.
$ cd prometheus-jfr-exporter $ ./gradlew shadowJar
- Find the built jar in
build/libs
directory.$ ls build/libs/prometheus-jfr-exporter*.jar
JFR Prometheus Exporter accesses recordings using JMX connections. Before running this program, make sure you have another JVM instance running and listening for JMX connections.
$ java -jar ./prometheus-jfr-exporter-1.0-SNAPSHOT-all.jar -h
Usage of Prometheus JFR exporter:
program <[jmxHostname]:[jmxPort]> [[httpHostname]:[httpPort]] [option...]
Options:
-eventConfiguration <path> a location where a .jfc configuration can be found
-disk [bool] set this recording to continuously flush to the disk repository
-dumpOnExit [bool] set this recording to dump to disk when the JVM exits
-maxAge <time> how far back data is kept in the disk repository
-maxSize <size> how much data is kept in the disk repository
-name <name> a human-readable name (for example, "My Recording")
$ java -jar ./prometheus-jfr-exporter-1.0-SNAPSHOT-all.jar localhost:9091 0.0.0.0:8080
By default, the exporter endpoint will be running on http://0.0.0.0:8080/metrics
with default.jfc
event configuration.
// TODO
This project is licensed under the GNU GENERAL PUBLIC LICENSE (Version 3).