Skip to content

Commit

Permalink
Merge pull request #1 from perfana/add-monitor-and-socket-events
Browse files Browse the repository at this point in the history
Add monitor and socket events
  • Loading branch information
PeterPaul-Perfana authored Jan 22, 2024
2 parents 4d8278e + 8ed41c5 commit b919a0b
Show file tree
Hide file tree
Showing 21 changed files with 3,715 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
java-version: '17'

- name: Maven build
run: ./mvnw clean package
run: ./mvnw -Drevision=LOCAL-SNAPSHOT clean package

10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ jobs:
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

- name: Set up JDK
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Maven build
run: ./mvnw clean package

- name: get tag
uses: olegtarasov/[email protected]
id: tagName
with:
tagRegex: "(.*)"

- name: Maven build
run: ./mvnw -Drevision=${{ env.GIT_TAG_NAME }} -clean package

- uses: ncipollo/release-action@v1
with:
artifacts: "target/jfr-exporter-*.jar"
artifacts: "target/jfr-exporter-${{ env.GIT_TAG_NAME }}.jar"
body: "Release ${{ env.GIT_TAG_NAME }}"
66 changes: 44 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
# JfrExporter

Send JFR events to time series databases.
Send JFR events to time series databases.

Now in "beta", feedback welcome!

See tutorial in this [blog post](https://perfana.io/continuous-deep-dive-with-jfr-events/).

[![JfrExporter tutarial video](https://img.youtube.com/vi/rAq2Xo-VoVc/0.jpg)](https://www.youtube.com/watch?v=rAq2Xo-VoVc)

Makes use of [JFR Event Streaming](https://openjdk.org/jeps/349) as found in hotspot based JDK 14+.

Now in "beta", feedback welcome! The events and stack traces need accuracy checks.
More events can be added. Only InfluxDB time series database is supported
at the moment.
The InfluxDB time series database is used as storage for the metrics.

The metrics can be used in a Grafana dashboard.
The metrics are displayed in a Grafana dashboard, as shown in the following screenshots.

Shows CPU, Heap, Threads and Memory Allocation Rate:
![dashboard overview 1](https://github.com/perfana/jfr-exporter/blob/main/images/dashboard-1.jpg)
CPU, Heap, Threads and Memory Allocation Rate:
![dashboard overview 1](images/dashboard-6.jpg)

Shows Garbage Collection events:
![dashboard overview 2](https://github.com/perfana/jfr-exporter/blob/main/images/dashboard-2.jpg)
Garbage Collection events:
![dashboard overview 2](images/dashboard-8.jpg)

Shows Safepoints and Big Allocations:
![dashboard overview 3](https://github.com/perfana/jfr-exporter/blob/main/images/dashboard-3.jpg)
Large allocation samples and Big Allocations:
![dashboard overview 3](images/dashboard-7.jpg)

And shows the stacktrace of a big allocations (see screenshot below)
Java Monitor waits and enters:
![dashboard overview 4](images/dashboard-4.jpg)

Network reads and writes:
![dashboard overview 5](images/dashboard-5.jpg)

For some events stacktraces are present, such as where in the code a big memory allocation took place.
(see screenshot below)

## Steps

Expand All @@ -34,7 +45,7 @@ To use JfrExporter:

## Download

Direct [download version 0.2.0](https://github.com/perfana/jfr-exporter/releases/download/0.2.0/jfr-exporter-0.1.0.jar)
Direct [download version 0.3.0](https://github.com/perfana/jfr-exporter/releases/download/0.3.0/jfr-exporter-0.3.0.jar)

Download the latest release from the [releases page](https://github.com/perfana/jfr-exporter/releases).

Expand Down Expand Up @@ -86,34 +97,45 @@ use a saved JFR profile in the JDK used, for example saved as `mySettings`: `-XX

## Events

Currently a subset of JFR events are processed.
These JFR events are processed:
* CPU load
* Garbage Collection
* Memory (heap usage, large allocations)
* Thread count
* Classes loaded
* Garbage Collection (GC) events
* Safepoints
* Threads
* Classloaders
* Memory (heap usage, large allocations)
* Network read/write
* Java Monitor waits and enters

For reference: [list of JFR events](https://bestsolution-at.github.io/jfr-doc/index.html).

## Stacktraces

Stack trace for big allocations are sent to InfuxDB.
Via the dashboard you can see the details by clicking in the big allocations table.
Stack traces for several events are sent to InfuxDB.
Via the dashboard you can see the details by clicking in the stacktrace columns.

Example:
![stacktrace example 1](https://github.com/perfana/jfr-exporter/blob/main/images/stacktrace-1.jpg)
Example of a big memory allocation stacktrace:
![stacktrace example 1](images/stacktrace-2.jpg)

## Dashboard

A Grafana dashboard can be imported to view the JFR metrics.

Import the dashboard in the `dashboards` directory into Grafana and
connect to an InfluxDB datasource that points to the `jfr` database.

For version 0.3.0 and above use dashboard `jfr-dashboard-export-share-0.3.json`.

## Troubleshoot

Use `-Dio.perfana.jfr.debug=true` to enable debug logging or `--debug` as argument.

For tracing (more debug logging) use: `-Dio.perfana.jfr.trace=true`

Debug and tracing will output a lot of data, so only use for troubleshooting.

# Releases

### v0.3.0: January 2024
* Added new events: Java Monitor waits and enters, Network read/write
* New dashboard with new events
Loading

0 comments on commit b919a0b

Please sign in to comment.