gnodet opened a new pull request, #24502:
URL: https://github.com/apache/camel/pull/24502
## Summary
Re-applies the TUI chart-side throughput scaling that was introduced in
`5c468034481` (CAMEL-23865) but lost when commit `065fd8314d9` ("Improve mouse
support in TUI") rewrote `MetricsCollector`, `OverviewTab`, and `EndpointsTab`.
The backend EWMA smoothing in `LoadThroughput` survived, but the TUI charts
still use integer division that truncates sub-1.0 msg/s rates to zero — making
the throughput chart empty for development workloads (e.g.,
`timer://foo?period=5000` producing 0.2 msg/s).
### Changes
- **MetricsCollector**: Use the EWMA throughput from the status JSON
(already smoothed by `LoadThroughput`) scaled by 100x instead of integer
division. Add `formatThroughput()` and `niceMax()` utilities
- **OverviewTab**: Format chart title and Y-axis labels using
`MetricsCollector.formatThroughput()` instead of `%d`
- **EndpointsTab**: Same formatting fix for endpoint in/out rate labels
- **Tests**: Add `MetricsCollectorThroughputTest` (10 tests for
formatting/scaling utilities) and `OverviewTabThroughputRenderTest` (4
screen-capture render tests that verify the chart title shows fractional rates)
### Before/After
| Scenario | Before | After |
|---|---|---|
| timer with 5s period | Chart empty, title: `0 msg/s` | Chart visible,
title: `0.20 msg/s` |
| timer with 60s period | Chart empty, title: `0 msg/s` | Chart visible,
title: `0.02 msg/s` |
| 42 msg/s production | `42 msg/s` | `42 msg/s` (unchanged) |
### Related
- [tamboui PR #396](https://github.com/tamboui/tamboui/pull/396) adds
`yAxisFormatter` to `DualSparkline` — once tamboui 0.5.0 ships, `EndpointsTab`
can use it for Y-axis labels on sparkline charts
## Test plan
- [x] `MetricsCollectorThroughputTest` — 10 tests for `formatThroughput()`,
`niceMax()`, and `THROUGHPUT_SCALE`
- [x] `OverviewTabThroughputRenderTest` — 4 screen-capture render tests
verifying fractional throughput in chart title
- [x] `MetricsCollectorConcurrencyTest` — existing concurrency tests still
pass
- [x] `OverviewTabRenderTest` — existing render tests still pass
_Claude Code on behalf of Luigi De Masi_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]