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

   _Claude Code on behalf of davsclaus_
   
   [CAMEL-26780](https://issues.apache.org/jira/browse/CAMEL-26780)
   
   The runtime endpoint registry (extended statistics mode: the 
`RuntimeEndpointRegistry` MBean, the endpoints dev console, and the Endpoints 
view of the Camel CLI) counted the input hits of a route on 
`ExchangeCreatedEvent`. That event also fires for exchanges that are no input 
of the route:
   
   - **Circuit breaker**: `ResilienceProcessor` runs a correlated copy with its 
own unit of work, which fires `ExchangeCreatedEvent` with the same from route 
and endpoint, so every message was counted twice (seen in the CLI: 4358 timer 
hits for 2205 exchanges).
   - **Split, Multicast, Recipient List**: the sub-exchanges get their own unit 
of work too; a split of 3 counted 4 input hits.
   - **direct**: the same exchange goes into the next route, no 
`ExchangeCreatedEvent` fires, so a route consuming from `direct` (or a 
`ProducerTemplate` sending to it) had 0 input hits.
   
   The input hits are now counted when an exchange enters the route through its 
consumer, the point where the route counts its exchanges: in extended mode the 
registry adds a `RoutePolicyFactory` whose policy counts in `onExchangeBegin`, 
under the URI of the route's consumer as before (rest-openapi / platform-http). 
The input message sizes moved along. `ExchangeCreatedEvent` itself is 
unchanged, so the events console still shows the sub-exchanges. An earlier 
double count, of `ProducerTemplate` exchanges (#23338), stays fixed.
   
   The route policy is attached when a route is created, so the registry has to 
be set up before the routes (as `CamelContext` does when the statistics level 
is extended, and camel-main does).
   
   Tests (failing before the change: split 8 instead of 2, multicast 3 instead 
of 1, recipient list 6 instead of 2, direct 0 instead of 3, circuit breaker 6 
instead of 3):
   - `ManagedEndpointInputHitsTest` (camel-management): split, multicast, 
recipient list, direct.
   - `ResilienceInputHitsTest` (camel-resilience4j): a circuit breaker calling 
a route over direct.
   
   The whole camel-management suite passes (595), as do the camel-core route 
policy and registry tests and the touched resilience4j tests. Upgrade guide 
4.24: the input hits are now the messages a route received.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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