|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Processes metric streams and generates aggregated statistics. More...
#include <aggregation_processor.h>

Classes | |
| struct | aggregator_entry |
Public Member Functions | |
| aggregation_processor () | |
| Default constructor. | |
| aggregation_processor (std::shared_ptr< metric_storage > storage) | |
| Constructor with storage backend. | |
| common::VoidResult | add_aggregation_rule (const aggregation_rule &rule) |
| Add an aggregation rule. | |
| common::VoidResult | process_observation (const std::string &metric_name, double value) |
| Process an observation for a metric. | |
| common::Result< streaming_statistics > | get_current_statistics (const std::string &metric_name) const |
| Get current statistics for a metric. | |
| std::vector< std::string > | get_configured_metrics () const |
| Get list of configured metrics. | |
| common::Result< stream_aggregation_result > | force_aggregation (const std::string &metric_name) |
| Force aggregation for a metric. | |
| common::VoidResult | remove_aggregation_rule (const std::string &metric_name) |
| Remove an aggregation rule. | |
| bool | has_rule (const std::string &metric_name) const |
| Check if a metric has an aggregation rule. | |
| size_t | rule_count () const |
| Get the number of configured rules. | |
| void | clear () |
| Clear all aggregation rules. | |
Private Attributes | |
| std::shared_mutex | mutex_ |
| std::shared_ptr< metric_storage > | storage_ |
| std::unordered_map< std::string, aggregator_entry > | aggregators_ |
Processes metric streams and generates aggregated statistics.
The aggregation processor manages multiple stream aggregators, one for each configured metric, and periodically computes and stores aggregated statistics.
Definition at line 87 of file aggregation_processor.h.
|
inline |
Default constructor.
Definition at line 92 of file aggregation_processor.h.
|
inlineexplicit |
Constructor with storage backend.
| storage | Shared pointer to metric storage |
Definition at line 98 of file aggregation_processor.h.
|
inline |
Add an aggregation rule.
| rule | The aggregation rule to add |
Definition at line 106 of file aggregation_processor.h.
References kcenon::monitoring::aggregation_processor::aggregator_entry::aggregator, aggregators_, kcenon::monitoring::already_exists, kcenon::monitoring::aggregation_rule::detect_outliers, kcenon::monitoring::stream_aggregator_config::enable_outlier_detection, kcenon::monitoring::aggregation_processor::aggregator_entry::last_aggregation, mutex_, kcenon::monitoring::aggregation_rule::outlier_threshold, kcenon::monitoring::stream_aggregator_config::outlier_threshold, kcenon::monitoring::aggregation_rule::percentiles, kcenon::monitoring::stream_aggregator_config::percentiles_to_track, kcenon::monitoring::aggregation_processor::aggregator_entry::rule, kcenon::monitoring::aggregation_rule::source_metric, kcenon::monitoring::error_info::to_common_error(), and kcenon::monitoring::aggregation_rule::validate().
Referenced by TEST_F(), TEST_F(), TEST_F(), and TEST_F().


|
inline |
Clear all aggregation rules.
Definition at line 287 of file aggregation_processor.h.
References aggregators_, and mutex_.
|
inline |
Force aggregation for a metric.
| metric_name | The metric name |
Definition at line 196 of file aggregation_processor.h.
References aggregators_, kcenon::monitoring::counter, kcenon::monitoring::gauge, kcenon::monitoring::metric_not_found, mutex_, kcenon::monitoring::stream_aggregation_result::processing_duration, kcenon::monitoring::stream_aggregation_result::samples_processed, kcenon::monitoring::stream_aggregation_result::source_metric, kcenon::monitoring::stream_aggregation_result::statistics, storage_, kcenon::monitoring::stream_aggregation_result::stored_successfully, and kcenon::monitoring::stream_aggregation_result::timestamp.
Referenced by TEST_F().

|
inline |
Get list of configured metrics.
Definition at line 178 of file aggregation_processor.h.
References aggregators_, and mutex_.
Referenced by TEST_F().

|
inline |
Get current statistics for a metric.
| metric_name | The metric name |
Definition at line 161 of file aggregation_processor.h.
References aggregators_, kcenon::monitoring::metric_not_found, and mutex_.
Referenced by TEST_F().

|
inline |
Check if a metric has an aggregation rule.
| metric_name | The metric name |
Definition at line 271 of file aggregation_processor.h.
References aggregators_, and mutex_.
|
inline |
Process an observation for a metric.
| metric_name | The metric name |
| value | The observed value |
Definition at line 144 of file aggregation_processor.h.
References aggregators_, and mutex_.
Referenced by TEST_F(), TEST_F(), and TEST_F().

|
inline |
Remove an aggregation rule.
| metric_name | The metric name |
Definition at line 253 of file aggregation_processor.h.
References aggregators_, kcenon::monitoring::metric_not_found, and mutex_.
|
inline |
Get the number of configured rules.
Definition at line 279 of file aggregation_processor.h.
References aggregators_, and mutex_.
|
private |
Definition at line 301 of file aggregation_processor.h.
Referenced by add_aggregation_rule(), clear(), force_aggregation(), get_configured_metrics(), get_current_statistics(), has_rule(), process_observation(), remove_aggregation_rule(), and rule_count().
|
mutableprivate |
Definition at line 299 of file aggregation_processor.h.
Referenced by add_aggregation_rule(), clear(), force_aggregation(), get_configured_metrics(), get_current_statistics(), has_rule(), process_observation(), remove_aggregation_rule(), and rule_count().
|
private |
Definition at line 300 of file aggregation_processor.h.
Referenced by force_aggregation().