|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Central collector for aggregating metrics from thread-local buffers. More...
#include <central_collector.h>

Classes | |
| struct | profile_data |
| Internal structure for profile data with LRU tracking. More... | |
| struct | stats |
| Get statistics about the collector. More... | |
Public Member Functions | |
| central_collector (size_t max_profiles=DEFAULT_MAX_PROFILES) | |
| Construct a central collector. | |
| void | receive_batch (const std::vector< metric_sample > &samples) |
| Receive a batch of samples from a thread-local buffer. | |
| common::Result< performance_profile > | get_profile (const std::string &operation_name) const |
| Get aggregated profile for an operation. | |
| std::unordered_map< std::string, performance_profile > | get_all_profiles () const |
| Get all aggregated profiles. | |
| void | clear () |
| Clear all collected data. | |
| size_t | get_operation_count () const |
| Get the number of tracked operations. | |
| size_t | get_total_sample_count () const |
| Get total number of samples received. | |
| stats | get_stats () const |
Static Public Attributes | |
| static constexpr size_t | DEFAULT_MAX_PROFILES = 10000 |
Private Member Functions | |
| void | process_sample (const metric_sample &sample) |
| Process a single sample into a profile. | |
| void | evict_lru () |
| Evict least recently used profile. | |
Private Attributes | |
| std::shared_mutex | profiles_mutex_ |
| std::unordered_map< std::string, std::unique_ptr< profile_data > > | profiles_ |
| size_t | max_profiles_ |
| std::atomic< size_t > | total_samples_ {0} |
| std::atomic< size_t > | batches_received_ {0} |
| std::atomic< size_t > | lru_evictions_ {0} |
Central collector for aggregating metrics from thread-local buffers.
Receives batches of metric samples from multiple thread-local buffers and aggregates them into performance profiles.
Definition at line 35 of file central_collector.h.
|
explicit |
Construct a central collector.
| max_profiles | Maximum number of operation profiles to maintain |
| void kcenon::monitoring::central_collector::clear | ( | ) |
Clear all collected data.
|
private |
Evict least recently used profile.
| std::unordered_map< std::string, performance_profile > kcenon::monitoring::central_collector::get_all_profiles | ( | ) | const |
Get all aggregated profiles.
| size_t kcenon::monitoring::central_collector::get_operation_count | ( | ) | const |
Get the number of tracked operations.
| common::Result< performance_profile > kcenon::monitoring::central_collector::get_profile | ( | const std::string & | operation_name | ) | const |
Get aggregated profile for an operation.
| operation_name | Name of the operation |
| stats kcenon::monitoring::central_collector::get_stats | ( | ) | const |
|
inline |
Get total number of samples received.
Definition at line 96 of file central_collector.h.
References total_samples_.
|
private |
Process a single sample into a profile.
| sample | Metric sample to process |
| void kcenon::monitoring::central_collector::receive_batch | ( | const std::vector< metric_sample > & | samples | ) |
Receive a batch of samples from a thread-local buffer.
| samples | Vector of metric samples to process |
|
private |
Definition at line 150 of file central_collector.h.
|
staticconstexpr |
Definition at line 37 of file central_collector.h.
|
private |
Definition at line 151 of file central_collector.h.
|
private |
Definition at line 146 of file central_collector.h.
|
private |
Definition at line 145 of file central_collector.h.
|
mutableprivate |
Definition at line 144 of file central_collector.h.
|
private |