Summary
Consolidate multiple buffering implementations in monitoring_system to simplify the codebase for C++20 module migration, following Kent Beck's "Fewest Elements" principle.
Parent Epic
Part of kcenon/common_system#256 (C++20 Module Migration - Cross-System Preparation)
Current State
Buffer Implementation Inventory
| File |
Class |
Purpose |
Status |
core/thread_local_buffer.h |
Thread-local buffer |
Per-thread metric buffering |
✓ Keep (public API) |
utils/time_series_buffer.h |
Time series buffer |
Temporal metric storage |
Refactor needed |
utils/time_series_buffer.h |
load_average_history |
Load average storage |
Consolidate with above |
utils/buffer_manager.h |
Buffer manager |
Buffer lifecycle management |
✓ Keep (internal) |
utils/buffering_strategy.h |
Buffering strategy |
Strategy pattern for buffering |
Refactor needed |
utils/ring_buffer.h |
Ring buffer |
Circular buffer implementation |
✓ Keep (internal) |
Analysis Results
Identified Issues
| Issue |
Kent Beck Principle |
Action |
load_average_history duplicates time_series_buffer<T> |
No Duplication |
Consolidate |
buffering_strategy imports but doesn't use ring_buffer |
Fewest Elements |
Refactor |
| Unclear public vs internal API |
Reveals Intention |
Document |
C++20 Module Impact
Clear separation between public and internal APIs needed for:
export module kcenon.monitoring;
export import :core; // thread_local_buffer, central_collector
export import :buffers; // time_series_buffer (public)
// Internal: ring_buffer, buffering_strategy, buffer_manager
Sub-Issues
Tasks
Acceptance Criteria
Related
Summary
Consolidate multiple buffering implementations in monitoring_system to simplify the codebase for C++20 module migration, following Kent Beck's "Fewest Elements" principle.
Parent Epic
Part of kcenon/common_system#256 (C++20 Module Migration - Cross-System Preparation)
Current State
Buffer Implementation Inventory
core/thread_local_buffer.hutils/time_series_buffer.hutils/time_series_buffer.hutils/buffer_manager.hutils/buffering_strategy.hutils/ring_buffer.hAnalysis Results
Identified Issues
load_average_historyduplicatestime_series_buffer<T>buffering_strategyimports but doesn't usering_bufferC++20 Module Impact
Clear separation between public and internal APIs needed for:
Sub-Issues
Tasks
thread_local_bufferusage and necessity → Keep (used by central_collector)time_series_bufferusage and necessity → Keep (used by system_resource_collector)buffer_managerandbuffering_strategyoverlap → Keep both (different purposes)load_average_historyis redundantAcceptance Criteria
Related