CAMEL-24003: Add live activity tracking and CLI command#24600
CAMEL-24003: Add live activity tracking and CLI command#24600davsclaus wants to merge 10 commits into
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
LocalCliConnector now writes {pid}-activity.json with completed
exchange summaries from the BacklogTracer activity queue.
ActivityDevConsole changed to use read-only getActivity() instead
of dumpActivity() so the queue is not cleared on each poll.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
New command that reads {pid}-activity.json and displays a table of
recent completed exchanges with PID, name, exchange ID, route,
status (OK/FAILED), elapsed time, since, and endpoint URI.
Supports --watch, --filter (by route ID), --sort, --limit,
--short-uri, --wide-uri, and --json output.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet
left a comment
There was a problem hiding this comment.
Claude Code review on behalf of @gnodet
Review: CAMEL-24003 — Add live activity tracking and CLI command
Well-structured companion to PR #24598. The CLI command implementation is solid — good sorting, filtering, limiting, JSON output, watch mode. Test coverage is adequate (9 tests total across BacklogTracer and ListActivity). The @since 4.22 tags, generated files, and documentation updates are all present.
Carryover from PR #24598 review
| Issue from #24598 | Status in this PR |
|---|---|
| Text vs JSON asymmetry in DevConsole | ✅ Fixed — both now use getActivity() (non-destructive) |
| JSON field inconsistency (JMX vs DevConsole) | |
| Activity capture requires messageHistory/standby | |
| Activity queue stores full event objects | |
| Missing upgrade guide entry |
Good to see the text/JSON asymmetry was fixed.
Remaining concerns (same as #24598, for reference)
1. [Medium] JSON field inconsistency between JMX and DevConsole
dumpActivityAsJSon() and ActivityDevConsole.doCallJson() build nearly identical JSON but differ:
uidandremoteEndpoint: included in DevConsole, absent in JMXfromRouteId: always included in JMX, conditionally in DevConsole
Consumers parsing JSON from different paths will see different shapes for the same data. Consider factoring the serialization into a shared helper.
2. [Low] Activity queue stores full event objects despite "lightweight" description
The queue stores the same BacklogTracerEventMessage objects (containing full body, headers, properties) as the trace backlog. Only the serialization layer strips to metadata. For 100 entries this is likely acceptable, but the Javadoc claiming "metadata only, no body or headers" is misleading at the storage level.
3. [Low] Missing upgrade guide entry
5 new methods in the BacklogTracer SPI, new camel.trace.activitySize property, new dev console — should be mentioned in camel-4x-upgrade-guide-4_22.adoc.
4. [Low] camel.trace.activitySize prerequisite not documented
Setting activitySize without enabling the tracer (at least in standby mode) silently produces no activity data. The property description should mention that the tracer must be active.
Positive notes
- Thread safety patterns are consistent with existing BacklogTracer code ✅
dumpActivity()respectsremoveOnDump, CLI connector uses non-destructivegetActivity()— good design ✅@Metadataannotation onactivitySizeis consistent with existingbacklogSize✅- CLI command supports
--watch,--json,--sort,--filter,--limit— comprehensive ✅
Overall: Functionally correct, follows existing patterns well. The concerns are design/documentation items that can be addressed at your discretion.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 555 tested, 26 compile-only — current: 552 all testedMaveniverse Scalpel detected 581 affected modules (current approach: 552).
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
… ErrorsTab Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…bels Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
gnodet
left a comment
There was a problem hiding this comment.
Claude Code review on behalf of @gnodet
Re-review after 5 new commits (TUI Activity tab + footer hint fixes)
Important
FQCNs in ActivityTab.java — Three fully qualified class names that violate the project import convention (CI will flag via OpenRewrite):
- Line 136:
org.apache.camel.util.TimeUtils.printSince(...)→ importTimeUtils - Line 267:
org.apache.camel.support.PatternHelper.matchPattern(...)→ importPatternHelper - Line 322:
org.apache.camel.util.TimeUtils.printSince(...)→ same
Minor
-
Dead
filterfield —ActivityTab.javadeclaresprivate String filterand uses it infilteredActivity(), but nothing ever sets it (alwaysnull). Either remove it or wire it to a key handler (like HistoryTab does with/for search). -
hintShowBhpvduplication — The same static method is now copy-pasted identically acrossActivityTab,HistoryTab, andErrorsTab. Could be extracted to a shared utility (e.g.,TuiHelper).
Positive observations
- ✅ Thread safety:
CopyOnWriteArrayListforactivityfield, matching existingerrorspattern - ✅ Good code reuse: detail panel rendering reuses
HistoryTab.addExchangeInfoLines(),addExceptionLines(),addKvLines(),addBodyLines(),renderDetailPanel() - ✅ Tab registration properly wired in
TabRegistrywith correct index constants - ✅
ActivityDevConsolerefactor (replacing inline JSON withevent.asJSon()) is clean - ✅ Footer hint fixes (trailing space, label shortening) are correct across HistoryTab and ErrorsTab
- ✅ F1 help text comprehensive and well-formatted
Summary
Claude Code on behalf of davsclaus
Adds a lightweight activity queue to the BacklogTracer that retains the last N completed exchange summaries, wires it into the CLI connector, provides a
camel get activitycommand, and adds a TUI Activity tab for live monitoring.camel-api,camel-base-engine): New bounded FIFO queue (default 100 entries) capturing metadata-only summaries (exchangeId, routeId, timestamp, elapsed, failed, endpointUri) when exchanges complete. Exposed viagetActivity()/dumpActivity()on theBacklogTracerinterface.camel-console): New dev console (activity) exposing the activity queue as JSON. UsesgetActivity()(non-destructive read) so repeated polling doesn't drain the queue.camel-cli-connector): Writes{pid}-activity.jsonintraceTask()every 2nd cycle using overwrite mode.camel get activitycommand (camel-jbang-core): Table display of recent exchange activity with--sort,--limit,--filter,--short-uri,--wide-uri,--watch, and--jsonoptions.camel-jbang-plugin-tui): New primary tab showing a live table of completed exchanges (EXCHANGE, ROUTE, STATUS, ELAPSED, SINCE, ENDPOINT) with a detail panel showing body, headers, properties, variables, and exception info. Includes sort, toggle keys (b/h/p/v/w), and F1 help.showhint key trailing space for blue background in HistoryTab and ErrorsTab. Changed"scroll detail"to"detail"across all master-detail tabs (Activity, Errors, AiLog, McpLog, MemoryLeak, SqlTrace).Test plan
BacklogTracerActivityTest— 4 tests covering activity capture, overflow with bounded size, clear-on-dump, and failed exchange trackingListActivityTest— 5 tests covering empty output, activity entry display, route filtering, JSON output mode, and row limitingcamel get activitydisplays the table correctly🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com