|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Performance monitor combining profiling and system monitoring. More...
#include <performance_monitor.h>


Classes | |
| struct | metric_data |
| struct | thresholds |
Public Member Functions | |
| performance_monitor (const std::string &name="performance_monitor") | |
| std::string | get_name () const override |
| Get the name of this performance monitor. | |
| bool | is_enabled () const override |
| Check if this performance monitor is enabled. | |
| common::VoidResult | set_enabled (bool enable) override |
| Enable or disable the collector. | |
| common::VoidResult | initialize () override |
| Initialize the collector. | |
| common::VoidResult | cleanup () override |
| Cleanup collector resources. | |
| common::Result< metrics_snapshot > | collect () override |
| Collect metrics. | |
| scoped_timer | time_operation (const std::string &operation_name) |
| Create a scoped timer for an operation. | |
| performance_profiler & | get_profiler () |
| Get performance profiler. | |
| const performance_profiler & | get_profiler () const |
| Get performance profiler (const) | |
| system_monitor & | get_system_monitor () |
| Get system monitor. | |
| const system_monitor & | get_system_monitor () const |
| Get system monitor (const) | |
| void | set_cpu_threshold (double threshold) |
| Set performance thresholds. | |
| void | set_memory_threshold (double threshold) |
| void | set_latency_threshold (std::chrono::milliseconds threshold) |
| thresholds | get_thresholds () const |
| Get current threshold values. | |
| common::Result< bool > | check_thresholds () const |
| Check if any thresholds are exceeded. | |
| void | reset () |
| Reset all performance profiler samples and system metrics. | |
| common::VoidResult | record_counter (const std::string &name, double value, const tag_map &tags={}) |
| common::VoidResult | record_gauge (const std::string &name, double value, const tag_map &tags={}) |
| common::VoidResult | record_histogram (const std::string &name, double value, const tag_map &tags={}) |
| std::vector< tagged_metric > | get_all_tagged_metrics () const |
| Get all recorded tagged metrics. | |
| void | clear_all_metrics () |
| Clear all recorded tagged metrics. | |
Public Member Functions inherited from kcenon::monitoring::metrics_collector | |
| virtual | ~metrics_collector ()=default |
Private Member Functions | |
| common::VoidResult | record_metric_internal (const std::string &name, double value, recorded_metric_type type, const tag_map &tags) |
| Internal method to record a metric with type and tags. | |
Static Private Member Functions | |
| static std::string | make_metric_key (const std::string &name, const tag_map &tags) |
| Generate a unique key from metric name and tags. | |
Private Attributes | |
| performance_profiler | profiler_ |
| system_monitor | system_monitor_ |
| std::string | name_ |
| bool | enabled_ {true} |
| struct kcenon::monitoring::performance_monitor::thresholds | thresholds_ |
| std::mutex | thresholds_mutex_ |
| std::unordered_map< std::string, std::unique_ptr< metric_data > > | tagged_metrics_ |
| std::shared_mutex | metrics_mutex_ |
Performance monitor combining profiling and system monitoring.
Implements kcenon::monitoring::metrics_collector for internal monitoring. For interoperability with common::interfaces::IMonitor, use performance_monitor_adapter.
Definition at line 354 of file performance_monitor.h.
|
inlineexplicit |
Definition at line 382 of file performance_monitor.h.
| common::Result< bool > kcenon::monitoring::performance_monitor::check_thresholds | ( | ) | const |
Check if any thresholds are exceeded.
|
inlineoverridevirtual |
Cleanup collector resources.
Implements kcenon::monitoring::metrics_collector.
Definition at line 413 of file performance_monitor.h.
References kcenon::monitoring::system_monitor::stop_monitoring().
Referenced by main(), and PerformanceMonitoringTest::TearDown().


| void kcenon::monitoring::performance_monitor::clear_all_metrics | ( | ) |
Clear all recorded tagged metrics.
|
overridevirtual |
Collect metrics.
Implements kcenon::monitoring::metrics_collector.
Referenced by main().

| std::vector< tagged_metric > kcenon::monitoring::performance_monitor::get_all_tagged_metrics | ( | ) | const |
Get all recorded tagged metrics.
|
inlineoverridevirtual |
Get the name of this performance monitor.
Implements kcenon::monitoring::metrics_collector.
Definition at line 391 of file performance_monitor.h.
References name_.
|
inline |
Get performance profiler.
Definition at line 434 of file performance_monitor.h.
|
inline |
Get performance profiler (const)
Definition at line 440 of file performance_monitor.h.
|
inline |
Get system monitor.
Definition at line 446 of file performance_monitor.h.
Referenced by main().

|
inline |
Get system monitor (const)
Definition at line 452 of file performance_monitor.h.
|
inline |
Get current threshold values.
Definition at line 477 of file performance_monitor.h.
|
inlineoverridevirtual |
Initialize the collector.
Implements kcenon::monitoring::metrics_collector.
Definition at line 405 of file performance_monitor.h.
References kcenon::monitoring::system_monitor::start_monitoring().
Referenced by main().


|
inlineoverridevirtual |
Check if this performance monitor is enabled.
Implements kcenon::monitoring::metrics_collector.
Definition at line 397 of file performance_monitor.h.
|
staticprivate |
Generate a unique key from metric name and tags.
| common::VoidResult kcenon::monitoring::performance_monitor::record_counter | ( | const std::string & | name, |
| double | value, | ||
| const tag_map & | tags = {} ) |
| common::VoidResult kcenon::monitoring::performance_monitor::record_gauge | ( | const std::string & | name, |
| double | value, | ||
| const tag_map & | tags = {} ) |
| common::VoidResult kcenon::monitoring::performance_monitor::record_histogram | ( | const std::string & | name, |
| double | value, | ||
| const tag_map & | tags = {} ) |
|
private |
Internal method to record a metric with type and tags.
|
inline |
Reset all performance profiler samples and system metrics.
Definition at line 493 of file performance_monitor.h.
References kcenon::monitoring::performance_profiler::clear_all_samples().

|
inline |
Set performance thresholds.
Definition at line 458 of file performance_monitor.h.
|
inlineoverridevirtual |
Enable or disable the collector.
| enable | true to enable, false to disable |
Implements kcenon::monitoring::metrics_collector.
Definition at line 399 of file performance_monitor.h.
References kcenon::monitoring::performance_profiler::set_enabled().
Referenced by PerformanceMonitoringTest::SetUp().


|
inline |
Definition at line 468 of file performance_monitor.h.
|
inline |
Definition at line 463 of file performance_monitor.h.
|
inline |
Create a scoped timer for an operation.
Definition at line 426 of file performance_monitor.h.
Referenced by main().

|
private |
Definition at line 359 of file performance_monitor.h.
|
mutableprivate |
Definition at line 379 of file performance_monitor.h.
|
private |
Definition at line 358 of file performance_monitor.h.
|
private |
Definition at line 356 of file performance_monitor.h.
|
private |
Definition at line 357 of file performance_monitor.h.
|
private |
Definition at line 378 of file performance_monitor.h.
|
private |
|
mutableprivate |
Definition at line 367 of file performance_monitor.h.