Skip to content

CAMEL-24003: Add live activity tracking, CLI command, and TUI Activity tab#24600

Draft
davsclaus wants to merge 13 commits into
mainfrom
feature/CAMEL-24003-cli-activity-connector
Draft

CAMEL-24003: Add live activity tracking, CLI command, and TUI Activity tab#24600
davsclaus wants to merge 13 commits into
mainfrom
feature/CAMEL-24003-cli-activity-connector

Conversation

@davsclaus

@davsclaus davsclaus commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a complete activity tracking pipeline for Apache Camel integrations:

  • CLI connector: camel cmd activity command to query activity data from running integrations
  • TUI Activity tab: Live view of recently completed exchanges with:
    • Summary stats panel (total/OK/failed counts, sends, avg/max elapsed, time window)
    • Table of exchanges with route, status, elapsed time, and consumer endpoint
    • Detail view with endpoint sends, exception info, headers, properties, variables, body
    • Pause/resume (Space key) to freeze the feed for inspection
    • Time filter (t key) to narrow view to last 1m/5m/15m/30m/1h
    • Sort by exchange, route, elapsed, or since columns
    • Toggle sections (b/h/p/v keys) and word wrap (w key)
  • StatusParser: Parses endpointSends array from ActivityDevConsole JSON output

Built on top of the BacklogTracer activity queue (merged in prior PRs) and the EventNotifier-based span enrichment (PR #24606).

Claude Code on behalf of davsclaus

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) ⚠️ Still present
Activity capture requires messageHistory/standby ⚠️ Still present
Activity queue stores full event objects ⚠️ Still present
Missing upgrade guide entry ⚠️ Still present

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:

  • uid and remoteEndpoint: included in DevConsole, absent in JMX
  • fromRouteId: 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() respects removeOnDump, CLI connector uses non-destructive getActivity() — good design ✅
  • @Metadata annotation on activitySize is consistent with existing backlogSize
  • 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.

@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • docs
  • dsl/camel-cli-connector
  • dsl/camel-jbang/camel-jbang-core
  • dsl/camel-jbang/camel-jbang-plugin-tui

🔬 Scalpel shadow comparison — Scalpel: 10 tested, 8 compile-only — current: 8 all tested

Maveniverse Scalpel detected 18 affected modules (current approach: 8).

⚠️ Modules only in Scalpel (10)
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-launcher
  • coverage
  • docs

Skip-tests mode would test 10 modules (4 direct + 6 downstream), skip tests for 8 (generated code, meta-modules)

Modules Scalpel would test (10)
  • camel-cli-connector
  • camel-cli-debug
  • camel-jbang-core
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • docs
Modules with tests skipped (8)
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-launcher
  • coverage

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • dsl/camel-jbang/camel-jbang-core: 1 test(s) disabled on GitHub Actions

💡 Manual integration tests recommended:

You modified dsl/camel-jbang/camel-jbang-core. The related integration tests in dsl/camel-jbang/camel-jbang-it are excluded from CI. Consider running them manually:

mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
All tested modules (18 modules)
  • Camel :: Coverage
  • Camel :: DSL :: CLI Connector
  • Camel :: DSL :: CLI Debug
  • Camel :: Docs
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Launcher
  • Camel :: Launcher :: Container

⚙️ View full build and test results

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(...) → import TimeUtils
  • Line 267: org.apache.camel.support.PatternHelper.matchPattern(...) → import PatternHelper
  • Line 322: org.apache.camel.util.TimeUtils.printSince(...) → same

Minor

  1. Dead filter fieldActivityTab.java declares private String filter and uses it in filteredActivity(), but nothing ever sets it (always null). Either remove it or wire it to a key handler (like HistoryTab does with / for search).

  2. hintShowBhpv duplication — The same static method is now copy-pasted identically across ActivityTab, HistoryTab, and ErrorsTab. Could be extracted to a shared utility (e.g., TuiHelper).

Positive observations

  • ✅ Thread safety: CopyOnWriteArrayList for activity field, matching existing errors pattern
  • ✅ Good code reuse: detail panel rendering reuses HistoryTab.addExchangeInfoLines(), addExceptionLines(), addKvLines(), addBodyLines(), renderDetailPanel()
  • ✅ Tab registration properly wired in TabRegistry with correct index constants
  • ActivityDevConsole refactor (replacing inline JSON with event.asJSon()) is clean
  • ✅ Footer hint fixes (trailing space, label shortening) are correct across HistoryTab and ErrorsTab
  • ✅ F1 help text comprehensive and well-formatted

@davsclaus davsclaus marked this pull request as draft July 11, 2026 19:42
@davsclaus davsclaus force-pushed the feature/CAMEL-24003-cli-activity-connector branch from 5b6512a to 2f452fa Compare July 12, 2026 08:23
@davsclaus davsclaus changed the title CAMEL-24003: Add live activity tracking and CLI command CAMEL-24003: Add live activity tracking, CLI command, and TUI Activity tab Jul 12, 2026
davsclaus and others added 12 commits July 12, 2026 22:12
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>
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>
…s, pause and time filter

- Parse and display endpointSends data from ActivityDevConsole
- Add summary stats panel showing total/OK/failed counts, sends, avg/max elapsed, time window
- Add Space key to pause/resume the data feed for inspection
- Add t key to cycle time filter (all/1m/5m/15m/30m/1h)
- Update help text documenting all new features

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Activity data only captures exchange metadata (ID, route, elapsed, failed,
endpoint sends, exception message) - not message content. Remove the
body/headers/properties/variables fields, toggle keys, and rendering
that were carried over from the History tab pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…panel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
…er field

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@davsclaus davsclaus force-pushed the feature/CAMEL-24003-cli-activity-connector branch from d335908 to 42646d1 Compare July 12, 2026 20:12
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants