Skip to content

a collector that scrapes JFR events from a JVM target at runtime for Prometheus to use

License

Notifications You must be signed in to change notification settings

rh-jmc-team/prometheus-jfr-exporter

Repository files navigation

Prometheus JFR Exporter Build Status

a collector that scrapes JFR events from a JVM target at runtime for Prometheus to use

Obtaining the Exporter

You can obtain a agent jar by downloading a prebuilt artifact or building from source.

[Option 1] Using a Prebuilt JAR

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

[Option 2] Building from Source

Requirements

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

Building Instructions

  • 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

Running a Exporter

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.

Usage

$ 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")

Example

$ 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.

Testing

// TODO

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE (Version 3).

About

a collector that scrapes JFR events from a JVM target at runtime for Prometheus to use

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages