{"id":15069316,"url":"https://github.com/perfana/jfr-exporter","last_synced_at":"2025-04-10T16:52:20.350Z","repository":{"id":197749618,"uuid":"697820611","full_name":"perfana/jfr-exporter","owner":"perfana","description":"Capture and analyse JDK Flight Recorder events in time series.","archived":false,"fork":false,"pushed_at":"2024-12-16T09:51:36.000Z","size":2490,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T14:44:33.644Z","etag":null,"topics":["java","jdk","jfr","metrics-gathering"],"latest_commit_sha":null,"homepage":"https://www.perfana.io","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/perfana.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-28T14:42:07.000Z","updated_at":"2024-12-16T09:51:40.000Z","dependencies_parsed_at":"2024-01-22T13:25:52.600Z","dependency_job_id":"975f8bd5-a339-4a62-ae1e-a986b3032feb","html_url":"https://github.com/perfana/jfr-exporter","commit_stats":null,"previous_names":["perfana/jfr-exporter"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perfana%2Fjfr-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perfana%2Fjfr-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perfana%2Fjfr-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/perfana%2Fjfr-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/perfana","download_url":"https://codeload.github.com/perfana/jfr-exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248256238,"owners_count":21073489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","jdk","jfr","metrics-gathering"],"created_at":"2024-09-25T01:41:46.046Z","updated_at":"2025-04-10T16:52:20.323Z","avatar_url":"https://github.com/perfana.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JfrExporter\n\nSend JFR events to time series databases.\n\nNow in \"beta\", feedback welcome!\n\nSee tutorial in this [blog post](https://perfana.io/continuous-deep-dive-with-jfr-events/).\n\n[![JfrExporter tutarial video](https://img.youtube.com/vi/rAq2Xo-VoVc/0.jpg)](https://www.youtube.com/watch?v=rAq2Xo-VoVc)\n\nMakes use of [JFR Event Streaming](https://openjdk.org/jeps/349) as found in hotspot based JDK 14+.\n\nThe InfluxDB time series database is used as storage for the metrics.\n\nThe metrics are displayed in a Grafana dashboard, as shown in the following screenshots.\n\nCPU, Heap, Threads and Memory Allocation Rate:\n![dashboard overview 1](images/dashboard-6.jpg)\n\nGarbage Collection events:\n![dashboard overview 2](images/dashboard-8.jpg)\n\nLarge allocation samples and Big Allocations:\n![dashboard overview 3](images/dashboard-7.jpg)\n\nJava Monitor waits and enters:\n![dashboard overview 4](images/dashboard-4.jpg)\n\nNetwork reads and writes:\n![dashboard overview 5](images/dashboard-5.jpg)\n\nNative memory usage:\n![dashboard overview nmt](images/dashboard-native-memory.jpg)\n\nContainer CPU throttle:\n![dashboard cpu throttle](images/dashboard-container-cpu-throttle.jpg)\n\nFor some events stacktraces are present, such as where in the code a big memory allocation took place.\n(see screenshot below)\n\n## Steps\n\nTo use JfrExporter:\n\n1. create a database in InfluxDB (or use an existing one)\n2. download and put the agent jar on the classpath, point it to InfluxDB\n3. create a datasource in Grafana for the InfluxDB database\n4. import the Grafana dashboard from the `dashboards` directory, choose InfluxDB datasource\n5. start the application\n6. optional: start load test\n\n## Download\n\nDirect [download version 0.5.0](https://github.com/perfana/jfr-exporter/releases/download/0.5.0/jfr-exporter-0.5.0.jar)\n\nDownload the latest release from the [releases page](https://github.com/perfana/jfr-exporter/releases).\n\n## Agent\n\nTo use JfrExporter simply add `-javaagent:/path/to/jfr-exporter.jar` to your JVM arguments.\n\nThere is no need to enable JFR in the JVM arguments (`-XX:StartFlightRecording`).\n\nOptions can be sent as `-javaagent:/path/to/jfr-exporter.jar=option1=value1,option2=value2`.\n\nExample: `-javaagent:/path/to/jfr-exporter.jar=debug,tag=service/afterburner`, which will enable\ndebug logging and set the tag `service` to `afterburner`.\n\nWhen used as agent, there is no need to add JFR activation to the JVM arguments.\n\nBe aware that some shells require a backslash before the equal signs.\n\n## Standalone\n\nJfrExporter can also be used as a standalone application, for example to monitor a running process.\n\nThe monitored process needs to be started with JFR enabled: `-XX:StartFlightRecording`\n\n```bash\nUsage: java JfrExporter \n --debug,-d \n --disableStackTraces\n --processId,-p \u003cprocessId\u003e \n --duration \u003cISO-duration\u003e \n --tag \u003ctag-name\u003e/\u003ctag-value\u003e,\n --bigObjectThreshold \u003cbytes\u003e\n --bigObjectSampleWeightThreshold \u003cbytes\u003e\n --influxUrl \u003cinfluxUrl\u003e \n --influxDatabase \u003cinfluxDatabase\u003e\n --influxUser \u003cinfluxUser\u003e \n --influxPassword \u003cinfluxPassword\u003e\n\n```\n\nMultiple tags can be specified.\n\nThe default InfluxDB database name is `jfr`.\n\nUse `--disableStackTraces` to limit stack traces to only the first three frames.\n\nExample to connect to process with id 1234 and send events with service name afterburner-fe:\n```bash\njava -jar jfr-exporter.jar --processId 1234 \\\n  --tag service/afterburner-fe --tag systemUnderTest/afterburner --tag testEnvironment/performance-test \\\n  --duration PT30s --influxUrl http://localhost:8086\n```\n\nTo enable extra monitoring, such as safe points, or different thresholds, \nuse a saved JFR profile in the JDK used, for example saved as `mySettings`: `-XX:StartFlightRecording:settings=mySettings`\n\n## Events\n\nThese JFR events are processed: \n* CPU load\n* Thread count\n* Classes loaded\n* Garbage Collection (GC) events\n* Safe points\n* Memory (heap usage, large allocations)\n* Network read/write\n* Java Monitor waits and enters\n* Native Memory usage\n* Container CPU and Memory (CPU Throttling, Memory request exceeded count)\n* Thread context switch rate\n\nFor reference: [list of JFR events](https://sap.github.io/SapMachine/jfrevents/).\n\n## Stack traces\n\nStack traces for several events are sent to InfluxDB.\nVia the dashboard you can see the details by clicking in the stacktrace columns.\n\nExample of a big memory allocation stacktrace:\n![stacktrace example 1](images/stacktrace-2.jpg)\n\n## Native Memory\n\nTo see the native memory usage, enable Native Memory Tracking (NMT) on the process command line by adding:\n\n    -XX:NativeMemoryTracking=summary\n    \n## Dashboard\n\nA Grafana dashboard can be imported to view the JFR metrics.\n\nImport the dashboard in the `dashboards` directory into Grafana and\nconnect to an InfluxDB datasource that points to the `jfr` database.\n\nFor the dashboards to work, use the following tags:\n\n    tag=service/\u003cservice\u003e,tag=systemUnderTest/\u003csystemUnderTest\u003e,tag=testEnvironment/\u003ctestEnvironment\u003e\n\nFor example:\n\n    tag=service/afterburner-fe,tag=systemUnderTest/afterburner,tag=testEnvironment/performance-test\n\nThese tags are used to select the proper data for the test runs in the dashboard.\n\nFor version 0.5.0 and above use dashboard `jfr-dashboard-export-share-0.5.json`.\n\n## Troubleshoot\n\nUse `-Dio.perfana.jfr.debug=true` to enable debug logging or `--debug` as argument.\n\nFor tracing (more debug logging) use: `-Dio.perfana.jfr.trace=true`\n\nDebug and tracing will output a lot of data, so only use for troubleshooting.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfana%2Fjfr-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperfana%2Fjfr-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperfana%2Fjfr-exporter/lists"}