atiaomar1978-hub opened a new pull request, #25491: URL: https://github.com/apache/camel/pull/25491
# Description Phase 2 of [CAMEL-23861](https://issues.apache.org/jira/browse/CAMEL-23861) continues GenAI observability work after Phase 1 (#25337) introduced `camel-ai-observability` and LangChain4j/OpenAI producer span enrichment. This change extends the Camel JBang TUI **AI Usage** panel (Ctrl+U) to combine: - **TUI ask** token metrics (existing `AiPanel` usage history from PR #24362) - **Route** GenAI usage extracted from OTel spans exported by the TUI monitor, using `gen_ai.*` semantic convention attributes from `camel-ai-observability` ## Changes - **`GenAiSpanUsageExtractor`**: maps `SpanEntry` OTel span data into `AiPanel.AiUsageEntry` when `gen_ai.operation.name` is present - **`AiPanel`**: adds `AiUsageSource` (TUI vs ROUTE), combines TUI history with route span data in stats view, and labels models as `[tui]` or `[route:<routeId>]` - **`CamelMonitor`**: wires `dataService.otelSpans()` into `AiPanel` - **Dependency**: `camel-jbang-plugin-tui` depends on `camel-ai-observability-api` for `GenAiAttributes` - **Docs**: Phase 2 TUI integration documented in `ai-observability.adoc` and `camel-jbang-tui.adoc` - **Tests**: 8 new unit tests covering span extraction, combined usage, stats rendering, and empty state ## Testing ```bash ./mvnw -pl dsl/camel-jbang/camel-jbang-plugin-tui -am test \ -Dtest='GenAiSpanUsageExtractorTest,AiPanelGenAiUsageTest' \ -Dsurefire.failIfNoSpecifiedTests=false ``` # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] JIRA issue filed: [CAMEL-23861](https://issues.apache.org/jira/browse/CAMEL-23861) # Apache Camel coding standards and style - [x] Each commit has a meaningful subject line and body - [x] Auto-generated catalog doc changes committed # AI-assisted contributions - [x] Commits include `Co-authored-by: Composer <[email protected]>` trailer - _Composer on behalf of Omar Atie (atiaomar1978-hub)_ -- 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]
