Giter Club home page Giter Club logo

jfr-custom-events's Introduction

JDK Flight Recorder Custom Events

Example code accompanying the blog post "Monitoring REST APIs with JDK Flight Recorder Custom Events". It shows how to use custom event types with JDK 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 JDK Flight Recorder event streaming API (JEP 349) 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/.

Dev Mode

When working on the example service, it can be started in the Quarkus dev mode instead of packaging it as a container image for faster feedback;

docker-compose up --build --scale example-service=0

mvn compile quarkus:dev -f example-service/pom.xml

When starting a recording, make sure to use the process for target/flight-recorder-demo-dev.jar.

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.

jfr-custom-events's People

Contributors

gunnarmorling avatar janhendrikdolling avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.