An exporter that can continuously analyze hotspot gc logs(Parallel, CMS, G1, ZGC, etc.)
Run the exporter as standalone HTTP server, prefer native executable if available:
start with jar:
# jdk require: 11+
# os require: linux, windows
sh bin/run.sh --jar
# background running
sh bin/run.sh --jar --daemon
start with native executable (only linux now, windows is on the way):
# os require: linux
sh bin/run.sh --native
# background running
sh bin/run.sh --native --daemon
A simple config.yml
looks like below:
# wildcard pattern is allowed in any level of paths, most of the time you only need to modify this configuration
fileGlobPattern: /path/to/some*/*.log
Fetch the metrics:
http://0.0.0.0:5898/metrics
Name | Description |
---|---|
hostPort | Host and port that http server binds, default is 0.0.0.0:5898 |
fileGlobPattern | Wildcard pattern of gc log file path, separate multiple paths with commas(,) |
idleTimeout | Milliseconds before closing idle(no update) files, default is 1 hour |
watchInterval | Time interval for scanning matching files (ms) |
readInterval | Time to sleep between files reading empty (ms) |
Name | type | labels | Description |
---|---|---|---|
jgc_log_lines_total | counter | path, host | Number of process log lines |
jgc_event_duration_seconds | summary | path, host, category | Duration of GC events |
jgc_event_pause_duration_seconds | summary | path, host, category | Duration of GC pause events |
jgc_heap_occupancy_before_collection_bytes | gauge | path, host | Heap occupancy before collection |
jgc_heap_occupancy_after_collection_bytes | gauge | path, host | Heap occupancy after collection |
See more metrics related to specific garbage-collection algorithms.
./mvnw clean package
The exporter can be converted into native executables by installing graalvm(17 and 21).
- native dynamic link:
./mvnw -Pnative clean package
- native static link with musl:
./mvnw -Pnative-static-musl clean package
Note: The lack of essential jvm flags may miss some indicators, so we recommend that you set up your target java process as follows:
- jdk8 and previous versions
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps
- jdk9 and later versions
-verbose:gc -Xlog:gc*=info,gc+heap=debug,gc+phases=debug:file=xxx/gc.log:t,tags
The exporter is still iterating frequently, all contributions are welcome. If you want a new feature, please raise an issue first.