Skip to content
Demo of Java Flight Recorder custom events and event streaming
Java HTML
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example-service
jfr-datasource
.gitignore
LICENSE.txt
README.md
docker-compose.yaml
grafana-all-dashboards.yml
grafana-datasource.yml
grafana-todo-dashboard.json
init.sql
jfr_datasource.png
jfr_grafana.png
jfr_jax_rs_events.png
prometheus.yml
servers.json

README.md

Java Flight Recorder Custom Events

Example code accompanying the blog post "Monitoring REST APIs with Java Flight Recorder Custom Events". It shows how to use custom event types with Java Flight Recorder and Mission Control to gain insight into runtime performance of a JAX-RS based REST API. It also demonstrates how to export Flight Recorder events in realtime via MicroProfile Metrics, using the Flight Recorderstreaming API added in Java 14.

Custom Flight Recorder Events in JDK Mission Control

Metrics for Flight Recorder Events in Grafana

Update Feb. 8th: the example has been expanded to show the usage of the JFR datasource for Grafana.

Build

Make sure to have Java 14 installed. Run the following to build this project:

# Example service
mvn clean package -f example-service/pom.xml

# JFR datasource for Grafana
mvn clean package -f jfr-datasource/pom.xml

docker-compose up --build

Open the web application at http://localhost:8080/. You then can connect to the running application on port 1898 using Mission Control, start Flight Recorder and observe "JAX-RS" events in the recording. You also can observe the exported metrics via Grafana at http://localhost:3000/.

Loading JFR Recordings into Grafana

The JFR datasource has been setup in Grafana. To examine a JFR recording, load it into the datasource:

curl -F "file=@/path/to/my/recording.jfr" localhost:8081/load

Then open the "JFR Events" dashboard in Grafana and zoom into the time range of the recording.

JFR Datasource in Grafana

License

This code base is available ander the Apache License, version 2.

You can’t perform that action at this time.