davsclaus opened a new pull request, #29883:
URL: https://github.com/apache/camel/pull/29883
## What
CAMEL-26941, a sub-task of CAMEL-26935 (make the Camel CLI faster for AI
agents).
After `camel run` or an edit, an agent checked an integration with `camel
get route`, `get health`, `get error` and `log`, each a JVM of its own: about a
second for one check.
`camel status [name]` shows one integration in one call:
- its state, phase, uptime, Camel version and dev mode, and the exchanges;
- each route with its counters and last error (the fields of `camel get
route --json`);
- the health: up, ready, live, and the checks that are down;
- the HTTP endpoints;
- the last errors (`--errors`, 5), newest first, without their messages and
history;
- the reloads of dev mode, and the outcome of the last one from the log (as
the MCP write tools find it);
- the end of the log (`--log-lines`, 20), the records as `camel_get_log` has
them, newest first.
Without a name it shows the only integration that runs, as `camel cmd reload
--wait` does; more than one, or none, is exit code 3. With `--json` it is one
document, `uptime` in millis. It reads the status, error and log files that are
there already, and sends no action, so it costs the integration nothing. In
`camel --help` it is the first command of the Monitoring group.
```
$ camel status st1
st1 (pid 42429), Camel 4.24.0-SNAPSHOT (Camel): Started, up 4s, dev mode
Exchanges: 7 total, 1 failed, 0 inflight
Routes:
orders Started timer://tick?period=500 (7 total, 1 failed, 0 inflight)
Health: UP, ready, live
Errors (newest first):
2s ago orders java.lang.IllegalStateException: Boom
Reload: 0 reloaded, 0 failed
Log (last 16 records):
21:02:25.992 INFO Apache Camel (JBang) 4.24.0-SNAPSHOT is starting
...
```
```
$ camel status st1 --json --log-lines=2
{"pid":42429,"name":"st1","camelVersion":"4.24.0-SNAPSHOT","platform":"Camel","state":"Started","phase":5,"uptime":5153,"devMode":true,
"exchanges":{"total":9,"failed":1,"inflight":0},
"routes":[{"routeId":"orders","from":"timer://tick?period=500","status":"Started","uptime":5000,"total":9,"failed":1,"inflight":0}],
"health":{"up":true,"ready":true,"live":true,"down":[]},"http":[],
"errors":[{"timestamp":1794600149478,"routeId":"orders","nodeId":"throwException1","exchangeId":"58A41D1FFE93C7B-0000000000000004","handled":false,"exception":{"type":"java.lang.IllegalStateException","message":"Boom"}}],
"reload":{"reloaded":0,"failed":0},
"log":[{"time":"21:02:31.471","level":"INFO","logger":"yaml:8","message":"Processing
","firstTime":"21:02:29.965","repeated":4}, ...]}
```
(the JSON is one line; wrapped here)
## Measured
macOS (M4 Pro), JDK 25, the camel-launcher with the `camel-jbang-core` jar
of this PR: `camel status` takes 0.33 s, and 0.31 s with `--json`. The four
commands it replaces take 0.25-0.5 s each.
## Tests
- `IntegrationStatusTest`: the document from a status file, an error file
and a log file; the limits of the log and the errors (the last reload is found
also when its record is not shown); the text; nothing running.
- `CliHelpGoldenTest`: the golden file has the help of `camel status`, and
the command in the Monitoring group.
- The command page `camel-jbang-status.adoc`, the index of the commands and
the commands metadata are regenerated; `camel-jbang-managing.adoc` has a
section on it.
- The tests of `camel-jbang-core` pass.
Not in this PR: the same as one tool of the MCP server, which the JIRA
mentions as an option.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_012nJsFsjqqFiwroeHRWaKbS
--
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]