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

   _Claude Code on behalf of Croway_
   
   Partial backport of #29139 to `camel-4.18.x` 
([CAMEL-26565](https://issues.apache.org/jira/browse/CAMEL-26565)). Please 
merge it only after #29139 is merged on `main`.
   
   **Only the `getRoute()` part applies.** `camel-4.18.x` does not have #23864 
(CAMEL-23719): its exchange timers already use 
`Timer.builder(...).register(...)`, and since the #28729 backport, nothing in 
the notifier searches the registry per exchange. The cherry-pick conflicted 
only on `getOrCreateTimer()`, a method that does not exist on this branch, so I 
dropped that hunk. Everything else applies unchanged. Because it is not a 
straight cherry-pick, it needs a review.
   
   What remains is the `CamelContext.getRoute(routeId)` call on every event, 
which copies the route list under `routesLock`. The kamelet/template skip 
decision is now taken once per route, in `addInflightMeter()`.
   
   The JMH numbers below come from the 4.22.1 notifier with `register()` 
already in place. That is the same structure as the 4.18.x notifier, so this 
column isolates the effect of this change:
   
   | routes (meters) | µs per exchange, 1 thread | exchanges/s, 4 threads |
   |---|---|---|
   | 10 (131) | 4.6 → **4.1** | 361k → **501k** |
   | 50 (611) | 5.5 → **4.3** | 177k → **533k** |
   | 200 (2,411) | 9.1 → **4.9** | 92k → **383k** |
   
   The single-threaded gain is small. The bigger effect is under concurrency, 
where the list copy under the lock serializes the threads.
   
   ## Testing
   
   - camel-micrometer builds with `-Psourcecheck` and its 79 tests pass on this 
branch.
   - `MicrometerExchangeEventNotifierHotPathTest` is included.
     - Its registry-search assertion already passes on this branch without the 
change, because 4.18.x has no timer search. Here it guards against a regression.
     - Its kamelet assertions cover the new skip set: a kamelet route stays 
unmetered, including one added at runtime, and a regular route reusing a 
removed route's id is metered.
   - The event-notifier tests also pass with `-Dmicrometer-version=1.17.1`.
   


-- 
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