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


##########
core/camel-management-api/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteMBean.java:
##########
@@ -209,4 +209,36 @@ String dumpRouteAsYaml(boolean resolvePlaceholders, 
boolean uriAsParameters, boo
     @ManagedAttribute(description = "Whether the consumer connects to remote 
or local systems")
     boolean isRemoteEndpoint();
 
+    /**
+     * Total number of exchanges the route processed that came from a remote 
endpoint.
+     *
+     * @since 4.24
+     */
+    @ManagedAttribute(description = "Total number of exchanges processed from 
remote endpoints only")
+    long getRemoteExchangesTotal();
+
+    /**
+     * Completed (success) number of exchanges the route processed that came 
from a remote endpoint.
+     *
+     * @since 4.24
+     */
+    @ManagedAttribute(description = "Completed (success) number of exchanges 
processed from remote endpoints only")
+    long getRemoteExchangesCompleted();
+
+    /**
+     * Failed number of exchanges the route processed that came from a remote 
endpoint.
+     *
+     * @since 4.24
+     */
+    @ManagedAttribute(description = "Failed number of exchanges processed from 
remote endpoints only")
+    long getRemoteExchangesFailed();
+
+    /**
+     * Number of exchanges inflight in the route that came from a remote 
endpoint.
+     *
+     * @since 4.24
+     */
+    @ManagedAttribute(description = "Total number of exchanges inflight from 
remote endpoints only")

Review Comment:
   💡 **Misleading description:** The annotation description says `"Total number 
of exchanges inflight"` but an inflight metric is a gauge (a snapshot of 
currently in-progress exchanges), not a total/cumulative count. Using "Total" 
implies accumulation over time, which could confuse monitoring tooling or users 
reading JMX attributes.
   
   The Javadoc above (line 237) correctly says `"Number of exchanges inflight 
in the route that came from a remote endpoint"` — consider aligning the 
`@ManagedAttribute` description with the Javadoc wording:
   
   ```suggestion
       @ManagedAttribute(description = "Number of exchanges inflight from 
remote endpoints only")
   ```



##########
core/camel-management/src/main/java/org/apache/camel/management/mbean/ManagedRoute.java:
##########
@@ -793,6 +801,70 @@ public String dumpRouteSourceLocationsAsXml() throws 
Exception {
     public void reset() {
         super.reset();
         load.reset();
+        remoteExchangesTotal.reset();
+        remoteExchangesCompleted.reset();
+        remoteExchangesFailed.reset();
+        remoteExchangesInflight.reset();

Review Comment:
   ⚠️ **Concurrency concern:** `remoteExchangesInflight.reset()` in `reset()` 
is inconsistent with the parent class `ManagedPerformanceCounter`, which 
deliberately avoids resetting `exchangesInflight` (commented `// do not reset 
exchangesInflight`) to prevent negative gauge values when reset is called while 
exchanges are still in-flight.
   
   If `reset()` is called while remote exchanges are actively being processed, 
the inflight counter will drop to zero mid-flight and then decrement when those 
exchanges complete — producing a negative value. The parent class intentionally 
leaves the inflight gauge alone for exactly this reason.
   
   Consider removing `remoteExchangesInflight.reset()` here to stay consistent 
with the parent's design.



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