atiaomar1978-hub commented on PR #25491:
URL: https://github.com/apache/camel/pull/25491#issuecomment-5283679076

   ## Phase 2 implementation summary
   
   _Composer on behalf of Omar Atie (atiaomar1978-hub)_
   
   This PR completes **Phase 2** of 
[CAMEL-23861](https://issues.apache.org/jira/browse/CAMEL-23861): the TUI **AI 
Usage** panel (Ctrl+U) now combines TUI ask token metrics with route-level 
GenAI usage from OTel spans using `gen_ai.*` attributes from 
`camel-ai-observability`.
   
   | Area | Implementation |
   |------|----------------|
   | Span extraction | `GenAiSpanUsageExtractor` maps `SpanEntry` → 
`AiUsageEntry` when `gen_ai.operation.name` is present |
   | AI Usage UI | TUI vs route breakdown; model keys labeled `[tui]` or 
`[route:<routeId>]` |
   | Wiring | `CamelMonitor` shares `dataService.otelSpans()` with `AiPanel` |
   | Span refresh | Opening Ctrl+U stats view requests an OTel span dump (fix 
from review) |
   | Tests | 9 unit tests (`GenAiSpanUsageExtractorTest`, 
`AiPanelGenAiUsageTest`) |
   
   ### Automated review (Bugbot + Grok)
   
   **Fixed in commit 4a226fa:**
   - Route usage was empty unless the Spans tab had been refreshed first — now 
`spanRefreshRequested` triggers `refreshSpanData()` when AI Usage stats opens.
   
   **Follow-ups (non-blocking):**
   - Stats view Page Up/Down scroll offset is not applied in `renderStats()` yet
   - Route totals reflect the latest span dump window (500 spans), not session 
cumulative like TUI ask metrics — consider labeling in UI
   - Stable TUI → Preview `camel-ai-observability-api` dependency could be 
replaced with local attribute constants
   
   ### Testing
   
   ```bash
   ./mvnw -pl dsl/camel-jbang/camel-jbang-plugin-tui -am test \
     -Dtest='GenAiSpanUsageExtractorTest,AiPanelGenAiUsageTest' \
     -Dsurefire.failIfNoSpecifiedTests=false
   ```
   
   Branch: `feature/CAMEL-23861-genai-observability-phase2`


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