ammachado opened a new pull request, #25173:
URL: https://github.com/apache/camel/pull/25173

   ## Summary
   
   Extends `camel-jfr` to emit runtime JFR events for exchanges, routes, 
processors, endpoint sends, failures, and redeliveries, so operators can attach 
a Flight Recorder to a running Camel application with no restart.
   
   - Six new `jdk.jfr.Event` subclasses under `org.apache.camel.runtime.jfr` 
(`CamelRouteEvent`, `CamelProcessorEvent`, `CamelExchangeEvent`, 
`CamelExchangeSendEvent`, `CamelExchangeFailedEvent`, `CamelRedeliveryEvent`).
   - Three collectors mirroring the `camel-telemetry` `Tracer` three-layer 
design:
     - `CamelJfrEventNotifier` (`EventNotifierSupport`) for 
exchange/send/failure/redelivery events.
     - `CamelJfrRoutePolicy` / `CamelJfrRoutePolicyFactory` 
(`RoutePolicySupport`) for per-route timing.
     - `CamelJfrInterceptStrategy` (`InterceptStrategy`) for per-processor 
timing.
   - `CamelJfrRuntimeInstrumentation` (`LifecycleStrategySupport`) 
auto-installs the collectors from `onContextInitializing`, after management 
setup and before route build.
   - `FlightRecorderStartupStepRecorder` now implements `CamelContextAware` and 
installs the runtime instrumentation from `doStart()`, opt-out via 
`runtimeEnabled` (defaults to `true`).
   - Endpoint URIs are sanitized via `URISupport.sanitizeUri` before being 
stored on an event; exception messages truncated to 256 chars.
   - No new Maven dependency (uses JDK-native `jdk.jfr.*`); `assertj-core` 
added as a test-scoped dependency for AssertJ assertions.
   
   Deviation from the original design spec, flagged for reviewers: the spec had 
the collectors registered directly inside `doStart()`. During implementation 
this proved too early for the `EventNotifier`, since `getManagementStrategy()` 
returns `null` at that point in `AbstractCamelContext.doBuild()`. Registration 
was moved to a `LifecycleStrategy.onContextInitializing` hook (added from 
`doStart()`), which fires after management setup and before routes are built.
   
   Open item: `runtimeEnabled` is currently a programmatic setter only (no 
`camel-main`-style property binding such as 
`camel.main.startup-recorder-runtime-enabled`). Docs describe the setter-based 
opt-out; property binding is left as a possible follow-up.
   
   ## Test plan
   
   - [x] `mvnd clean install -pl components/camel-jfr -Dci.env.name=local` — 
7/7 tests pass
   - [x] `mvn -Psourcecheck validate -pl components/camel-jfr` — clean
   - [x] `git status --porcelain` — no uncommitted/generated file drift
   - [ ] Reviewer: confirm the `onContextInitializing` timing deviation from 
the design spec is acceptable
   - [ ] Reviewer: confirm whether `camel.jfr.runtimeEnabled`-style property 
binding should be added in this PR or a follow-up
   
   ---
   _Claude Sonnet 5 on behalf of Adriano Machado_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to