|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Time-windowed value collection. More...
#include <stream_aggregator.h>

Classes | |
| struct | entry |
Public Types | |
| using | time_point = std::chrono::system_clock::time_point |
| using | duration = std::chrono::system_clock::duration |
Public Member Functions | |
| moving_window_aggregator (std::chrono::milliseconds window_duration, size_t max_size) | |
| Constructor. | |
| void | add_value (const T &value, time_point timestamp) |
| Add a value with timestamp. | |
| size_t | size () const |
| Get current size. | |
| bool | empty () const |
| Check if empty. | |
| std::vector< T > | get_values () const |
| Get all values in the window. | |
| void | clear () |
| Clear all entries. | |
Private Member Functions | |
| void | expire_old_entries (time_point current) |
Private Attributes | |
| std::shared_mutex | mutex_ |
| std::chrono::milliseconds | window_duration_ |
| size_t | max_size_ |
| std::deque< entry > | entries_ |
Time-windowed value collection.
Maintains a sliding window of values with automatic expiration.
| T | The value type |
Definition at line 396 of file stream_aggregator.h.
| using kcenon::monitoring::moving_window_aggregator< T >::duration = std::chrono::system_clock::duration |
Definition at line 399 of file stream_aggregator.h.
| using kcenon::monitoring::moving_window_aggregator< T >::time_point = std::chrono::system_clock::time_point |
Definition at line 398 of file stream_aggregator.h.
|
inline |
Constructor.
| window_duration | Duration of the sliding window |
| max_size | Maximum number of elements |
Definition at line 406 of file stream_aggregator.h.
|
inline |
Add a value with timestamp.
| value | The value to add |
| timestamp | The timestamp |
Definition at line 416 of file stream_aggregator.h.
References kcenon::monitoring::moving_window_aggregator< T >::entries_, kcenon::monitoring::moving_window_aggregator< T >::expire_old_entries(), kcenon::monitoring::moving_window_aggregator< T >::max_size_, and kcenon::monitoring::moving_window_aggregator< T >::mutex_.
Referenced by TEST_F(), and TEST_F().


|
inline |
Clear all entries.
Definition at line 461 of file stream_aggregator.h.
References kcenon::monitoring::moving_window_aggregator< T >::entries_, and kcenon::monitoring::moving_window_aggregator< T >::mutex_.
|
inline |
Check if empty.
Definition at line 440 of file stream_aggregator.h.
References kcenon::monitoring::moving_window_aggregator< T >::entries_, and kcenon::monitoring::moving_window_aggregator< T >::mutex_.
|
inlineprivate |
Definition at line 472 of file stream_aggregator.h.
References kcenon::monitoring::moving_window_aggregator< T >::entries_, and kcenon::monitoring::moving_window_aggregator< T >::window_duration_.
Referenced by kcenon::monitoring::moving_window_aggregator< T >::add_value().

|
inline |
Get all values in the window.
Definition at line 448 of file stream_aggregator.h.
References kcenon::monitoring::moving_window_aggregator< T >::entries_, kcenon::monitoring::moving_window_aggregator< T >::mutex_, and kcenon::monitoring::moving_window_aggregator< T >::entry::value.
Referenced by TEST_F(), and TEST_F().

|
inline |
Get current size.
Definition at line 432 of file stream_aggregator.h.
References kcenon::monitoring::moving_window_aggregator< T >::entries_, and kcenon::monitoring::moving_window_aggregator< T >::mutex_.
Referenced by TEST_F().

|
private |
Definition at line 482 of file stream_aggregator.h.
Referenced by kcenon::monitoring::moving_window_aggregator< T >::add_value(), kcenon::monitoring::moving_window_aggregator< T >::clear(), kcenon::monitoring::moving_window_aggregator< T >::empty(), kcenon::monitoring::moving_window_aggregator< T >::expire_old_entries(), kcenon::monitoring::moving_window_aggregator< T >::get_values(), and kcenon::monitoring::moving_window_aggregator< T >::size().
|
private |
Definition at line 481 of file stream_aggregator.h.
Referenced by kcenon::monitoring::moving_window_aggregator< T >::add_value().
|
mutableprivate |
Definition at line 479 of file stream_aggregator.h.
Referenced by kcenon::monitoring::moving_window_aggregator< T >::add_value(), kcenon::monitoring::moving_window_aggregator< T >::clear(), kcenon::monitoring::moving_window_aggregator< T >::empty(), kcenon::monitoring::moving_window_aggregator< T >::get_values(), and kcenon::monitoring::moving_window_aggregator< T >::size().
|
private |
Definition at line 480 of file stream_aggregator.h.
Referenced by kcenon::monitoring::moving_window_aggregator< T >::expire_old_entries().