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

   [CAMEL-25716](https://issues.apache.org/jira/browse/CAMEL-25716): **remote 
exchange counters per route**, so that `camel get processor --remote` has 
something to show.
   
   ### Why
   The CamelContext counts the exchanges that came from a remote endpoint, such 
as Kafka or HTTP, apart from the internal ones such as a timer 
([CAMEL-20879](https://issues.apache.org/jira/browse/CAMEL-20879)). The routes 
did not, and the route dev console had no remote counters, so `camel get 
processor --remote` ("Break down counters into remote/total pairs") never 
showed a pair. Found while testing the CLI for CAMEL-23688 (raised in #27974).
   
   ### The change
   - `ManagedRouteMBean` (camel-management-api): `RemoteExchangesTotal`, 
`RemoteExchangesCompleted`, `RemoteExchangesFailed`, `RemoteExchangesInflight`, 
as the context has them (`@since 4.24`).
   - `ManagedRoute` (camel-management):
     - a route whose consumer is remote has only remote exchanges, so its 
remote counters are its own counters: nothing more is counted, at no cost;
     - a route whose consumer is internal (`direct`, `seda`) counts the 
exchanges it processes that came from a remote endpoint 
(`exchange.getFromEndpoint().isRemote()`, as the context does), such as a 
`direct:audit` route called by a Kafka route. An internal exchange costs one 
check per hook; a remote one in such a route costs the counters (the 
`StatisticCounter`s the context uses too). `reset()` resets them.
   - `RouteDevConsole` (camel-console): the statistics of a route have 
`remoteExchangesTotal`, `remoteExchangesFailed` and `remoteExchangesInflight`, 
as the context console has; the dev console metadata and the catalog 
(`dev-consoles/route.json`, `dev-consoles-openapi.json`) are regenerated.
   - The CLI: `camel get processor --remote` shows the remote/total pairs of 
the routes; `camel get route` and `camel top route` have `--remote` too; the 
JSON of `camel get context`, `get route` and `get processor` has `remoteTotal`, 
`remoteFailed` and `remoteInflight`. The managing page of the CLI says what 
`--remote` shows.
   
   ### Tests
   - `ManagedRouteRemoteExchangesTest` (new, camel-management): a remote route 
(a `direct` component whose endpoints are remote), an internal route and a 
`direct:audit` route both call, with one failure: the remote route has all its 
exchanges as remote, the audit route only those of the remote route (3 of 4, 
one failed), the internal route none; `reset()` resets them.
   - `CamelRouteStatusTest`, `CamelProcessorStatusTest`, 
`CamelContextStatusTest`: `--remote` shows the pairs (a processor has none), 
and the JSON has the remote counters.
   
   `mvn test` of the route MBean tests of camel-management (84; 
`ManagedRouteStopWithAbortAfterTimeoutTest` failed once and passed on re-runs: 
it races 5 x 100 ms of work against a 1 s stop timeout, unrelated), the dev 
console tests of camel-console, and the listing tests of camel-jbang-core (49): 
all pass.
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My
   


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