gnodet-bot commented on code in PR #29476:
URL: https://github.com/apache/camel/pull/29476#discussion_r4512814268


##########
core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/DefaultRuntimeEndpointRegistry.java:
##########
@@ -212,6 +214,11 @@ && 
getCamelContext().getManagementStrategy().getManagementAgent() != null) {
             outputSizeStats = new EndpointSizeStatistics(limit);
         }
         if (extended) {
+            // the input hits of a route are counted when an exchange enters 
it through its consumer, as the route
+            // counts its exchanges: the copies EIPs make inside a route 
(circuit breaker, split, multicast, recipient
+            // list) have their own unit of work and ExchangeCreatedEvent but 
are no input, and an exchange that comes
+            // from another route over direct is one without an 
ExchangeCreatedEvent
+            getCamelContext().addRoutePolicyFactory((context, routeId, route) 
-> inputHits);

Review Comment:
   The same `inputHits` instance is returned for every route — this is 
intentional and correct since `InputHits.onExchangeBegin` is stateless (all 
state lives in the thread-safe `inputUtilization`). A brief comment would 
prevent future readers from wondering whether this should be per-route:
   
   ```suggestion
               getCamelContext().addRoutePolicyFactory((context, routeId, 
route) -> inputHits); // one shared stateless instance for all routes
   ```



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