This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch feature/CAMEL-24328-jfr-tui-data in repository https://gitbox.apache.org/repos/asf/camel.git
commit b6d03b5a8c70e3d8017b90a614e8652198bb2565 Author: Claus Ibsen <[email protected]> AuthorDate: Mon Aug 3 15:33:49 2026 +0200 CAMEL-24328: Document JFR snapshot command and TUI profiling Co-Authored-By: Claude Opus 4.6 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- components/camel-jfr/src/main/docs/jfr.adoc | 57 +++++++++++++++++++++- .../modules/ROOT/pages/camel-jbang-tui.adoc | 28 +++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/components/camel-jfr/src/main/docs/jfr.adoc b/components/camel-jfr/src/main/docs/jfr.adoc index 91f09529eecc..fff95280def1 100644 --- a/components/camel-jfr/src/main/docs/jfr.adoc +++ b/components/camel-jfr/src/main/docs/jfr.adoc @@ -119,7 +119,7 @@ JVM-wide recorder settings such as the repository path and stack depth. === The `jfr` dev console -When `camel-jfr` is on the classpath, a `jfr` dev console is available with four commands +When `camel-jfr` is on the classpath, a `jfr` dev console is available with five commands (pass as the `command` option): [cols="1,3",options="header"] @@ -138,6 +138,11 @@ When `camel-jfr` is on the classpath, a `jfr` dev console is available with four | `jfc` | Generates a `.jfc` overlay for the six events, honoring an optional comma-separated `disable` option, and a ready-to-copy `jcmd JFR.start settings=...` line. + +| `snapshot` +| Takes a point-in-time snapshot of the active JFR recording and aggregates Camel + runtime events into per-route, per-processor, and per-endpoint duration statistics, + plus recent failures and redeliveries. Accepts optional `routeId` and `limit` options. |=== The console is reachable wherever dev consoles are, for example over HTTP when the @@ -150,3 +155,53 @@ curl "http://localhost:8080/q/dev/jfr?command=status" It is also available as a *JFR* tab in the CLI terminal UI (`camel tui`), which renders the status and binds `E` / `D` / `J` to enable all, disable all, and generate a `.jfc`. + +=== Snapshot + +The `snapshot` command captures the current state of a running JFR recording without +stopping it, and returns aggregated statistics for Camel runtime events. This gives you +a lightweight alternative to exporting a `.jfr` file and opening it in Java Mission Control. + +A recording must be active for the snapshot to contain data. If no recording is running, +the command returns an error message. + +==== Options + +[cols="1,1,3",options="header"] +|=== +| Option | Default | Description +| `routeId` | _(all)_ | Filter results to a single route. Applies to routes, processors, failures, and redeliveries. +| `limit` | `50` | Maximum number of failure and redelivery entries to return. +|=== + +==== Example + +[source,bash] +---- +curl "http://localhost:8080/q/dev/jfr?command=snapshot" +curl "http://localhost:8080/q/dev/jfr?command=snapshot&routeId=order-in&limit=20" +---- + +==== Response + +The JSON response contains five sections: + +[cols="1,3",options="header"] +|=== +| Section | Description +| `routes` | Per-route totals, failure counts, and min/mean/max duration in milliseconds. Sorted by total descending. +| `processors` | Per-processor statistics with processor type and owning route. Sorted by mean duration descending (slowest first). +| `endpoints` | Per-endpoint send statistics with duration. Sorted by total descending. +| `failures` | Recent exchange failures with exception type and message. Newest first, capped at `limit`. +| `redeliveries` | Recent redelivery attempts with attempt number and max attempts. Newest first, capped at `limit`. +|=== + +The top-level `eventCount` field reports the total number of Camel events found in the +snapshot. + +==== TUI integration + +In the CLI terminal UI (`camel tui`), the *JFR* tab shows the snapshot data in five +navigable table views. Press `F5` to take a snapshot, and use keys `1`–`5` to switch +between Routes, Processors, Endpoints, Failures, and Redeliveries. Press `Enter` on +a route to drill down into its processors, and `Esc` to go back. diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-tui.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang-tui.adoc index 6cd09de2a64c..8d7d1ef7471b 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang-tui.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-tui.adoc @@ -608,6 +608,34 @@ in your running integration. It runs two sequential recordings and compares obje classifying each class as growing, stable, shrinking, new, or gone. This is lightweight and safe for production use. +=== JFR Runtime Profiling + +The JFR tab (under More > JVM) gives you a lightweight profiling view of your running integration +using Java Flight Recorder. JFR is built into the JVM with very low overhead, making it suitable +for near-production use cases where you need timing data without impacting throughput. + +Start your integration with JFR runtime instrumentation enabled: + +[source,bash] +---- +camel run my-route.yaml --jfr +---- + +The JFR tab shows the recording status and event configuration. Press *F5* to take a snapshot +of the active recording -- the TUI aggregates all Camel events and presents them in five views: + +* *Routes* (key *1*) -- per-route totals, failure counts, and min/mean/max duration +* *Processors* (key *2*) -- per-processor statistics with type and owning route, sorted by slowest first +* *Endpoints* (key *3*) -- per-endpoint send statistics with duration +* *Failures* (key *4*) -- recent exchange failures with exception type and message +* *Redeliveries* (key *5*) -- recent redelivery attempts with attempt and max counts + +Press *Enter* on a route to drill down into its processors filtered by that route. +Press *s* to cycle sort columns, and *Esc* to go back. + +Each snapshot is a point-in-time read -- the recording keeps running, so you can press *F5* +again at any time to see updated statistics as more messages flow through the system. + === Catalog The Catalog tab (under More > Project) lets you browse the full Camel component catalog from within
