|
PACS System 0.1.0
PACS DICOM system library
|
Unified PACS monitoring implementing IMonitor interface. More...
#include <pacs_monitor.h>

Public Member Functions | |
| pacs_monitor (const pacs_monitor_config &config={}) | |
| Construct a new PACS monitor. | |
| ~pacs_monitor ()=default | |
| Destructor. | |
| pacs_monitor (const pacs_monitor &)=delete | |
| pacs_monitor & | operator= (const pacs_monitor &)=delete |
| pacs_monitor (pacs_monitor &&)=delete | |
| pacs_monitor & | operator= (pacs_monitor &&)=delete |
| void | record_metric (std::string_view name, double value) |
| Record a metric value. | |
| void | record_metric (std::string_view name, double value, const std::unordered_map< std::string, std::string > &tags) |
| Record a metric with tags. | |
| metrics_snapshot | get_metrics () |
| Get current metrics snapshot. | |
| health_check_result | check_health () |
| Perform health check. | |
| void | reset () |
| Reset all metrics. | |
| std::string | to_prometheus () const |
| Export all metrics in Prometheus text format. | |
| std::string | to_json () const |
| Export all metrics as JSON. | |
| void | register_health_check (std::string_view component, std::function< bool()> check) |
| Register a health check for a component. | |
| void | unregister_health_check (std::string_view component) |
| Unregister a health check. | |
| const pacs_monitor_config & | get_config () const |
| Get current configuration. | |
| void | update_config (const pacs_monitor_config &config) |
| Update configuration. | |
| dicom_association_collector & | association_collector () |
| Get the association collector. | |
| dicom_service_collector & | service_collector () |
| Get the service collector. | |
| dicom_storage_collector & | storage_collector () |
| Get the storage collector. | |
| dicom_metrics_collector & | unified_collector () |
| Get the unified CRTP-based metrics collector. | |
| dicom_metrics_snapshot | get_unified_snapshot () const |
| Get a snapshot from the unified collector. | |
Static Public Member Functions | |
| static pacs_monitor & | global_monitor () noexcept |
| Get the global singleton instance. | |
Private Member Functions | |
| void | initialize_collectors () |
| void | collect_all_metrics (metrics_snapshot &snapshot) |
Private Attributes | |
| pacs_monitor_config | config_ |
| std::shared_mutex | config_mutex_ |
| std::unique_ptr< dicom_association_collector > | association_collector_ |
| std::unique_ptr< dicom_service_collector > | service_collector_ |
| std::unique_ptr< dicom_storage_collector > | storage_collector_ |
| std::unique_ptr< dicom_metrics_collector > | unified_collector_ |
| std::mutex | custom_metrics_mutex_ |
| std::vector< metric_value > | custom_metrics_ |
| std::mutex | health_checks_mutex_ |
| std::unordered_map< std::string, std::function< bool()> > | health_checks_ |
Unified PACS monitoring implementing IMonitor interface.
This class provides a unified monitoring interface for the PACS system, integrating all DICOM-specific metric collectors and implementing the IMonitor interface from common_system.
Features:
Thread Safety: All public methods are thread-safe.
Definition at line 223 of file pacs_monitor.h.
|
inlineexplicit |
Construct a new PACS monitor.
| config | Configuration options |
Definition at line 408 of file pacs_monitor.h.
References initialize_collectors().

|
default |
|
delete |
|
delete |
|
inlinenodiscard |
Get the association collector.
Definition at line 622 of file pacs_monitor.h.
References association_collector_.
|
inlinenodiscard |
Perform health check.
Definition at line 501 of file pacs_monitor.h.
References association_collector_, kcenon::pacs::monitoring::health_check_result::check_duration, kcenon::pacs::monitoring::degraded, health_checks_, health_checks_mutex_, kcenon::pacs::monitoring::healthy, kcenon::pacs::monitoring::health_check_result::message, kcenon::pacs::monitoring::health_check_result::metadata, service_collector_, kcenon::pacs::monitoring::health_check_result::status, storage_collector_, kcenon::pacs::monitoring::unhealthy, and unified_collector_.
|
inlineprivate |
Definition at line 459 of file pacs_monitor.h.
References kcenon::pacs::monitoring::metrics_snapshot::add_metric(), association_collector_, config_, config_mutex_, kcenon::pacs::monitoring::counter, custom_metrics_, custom_metrics_mutex_, kcenon::pacs::monitoring::pacs_monitor_config::enable_association_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_service_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_storage_metrics, kcenon::pacs::monitoring::gauge, kcenon::pacs::monitoring::metrics_snapshot::metrics, service_collector_, and storage_collector_.
Referenced by get_metrics().


|
inlinenodiscard |
Get current configuration.
Definition at line 592 of file pacs_monitor.h.
References config_, and config_mutex_.
|
inlinenodiscard |
Get current metrics snapshot.
Definition at line 452 of file pacs_monitor.h.
References kcenon::pacs::monitoring::pacs_monitor_config::ae_title, collect_all_metrics(), config_, and kcenon::pacs::monitoring::metrics_snapshot::source_id.

|
inlinenodiscard |
Get a snapshot from the unified collector.
Definition at line 638 of file pacs_monitor.h.
References unified_collector_.
|
inlinestaticnodiscardnoexcept |
Get the global singleton instance.
Thread-safe lazy initialization using Meyer's singleton pattern.
Definition at line 246 of file pacs_monitor.h.
|
inlineprivate |
Definition at line 413 of file pacs_monitor.h.
References kcenon::pacs::monitoring::pacs_monitor_config::ae_title, association_collector_, config_, kcenon::pacs::monitoring::pacs_monitor_config::enable_association_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_pool_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_service_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_storage_metrics, service_collector_, storage_collector_, and unified_collector_.
Referenced by pacs_monitor().

|
delete |
|
delete |
|
inline |
Record a metric value.
| name | Metric name |
| value | Metric value |
Definition at line 439 of file pacs_monitor.h.
References custom_metrics_, custom_metrics_mutex_, and name.
|
inline |
Record a metric with tags.
| name | Metric name |
| value | Metric value |
| tags | Additional metadata tags |
Definition at line 444 of file pacs_monitor.h.
References custom_metrics_, custom_metrics_mutex_, kcenon::pacs::monitoring::gauge, and name.
|
inline |
Register a health check for a component.
| component | Component name |
| check | Function that returns true if healthy |
Definition at line 580 of file pacs_monitor.h.
References health_checks_, and health_checks_mutex_.
|
inline |
Reset all metrics.
Definition at line 559 of file pacs_monitor.h.
References custom_metrics_, custom_metrics_mutex_, kcenon::pacs::monitoring::pacs_metrics::global_metrics(), and kcenon::pacs::monitoring::pacs_metrics::reset().

|
inlinenodiscard |
Get the service collector.
Definition at line 626 of file pacs_monitor.h.
References service_collector_.
|
inlinenodiscard |
Get the storage collector.
Definition at line 630 of file pacs_monitor.h.
References storage_collector_.
|
inlinenodiscard |
Export all metrics as JSON.
Definition at line 575 of file pacs_monitor.h.
References kcenon::pacs::monitoring::pacs_metrics::global_metrics(), and kcenon::pacs::monitoring::pacs_metrics::to_json().

|
inlinenodiscard |
Export all metrics in Prometheus text format.
Definition at line 570 of file pacs_monitor.h.
References config_, kcenon::pacs::monitoring::pacs_metrics::global_metrics(), kcenon::pacs::monitoring::pacs_monitor_config::metric_prefix, and kcenon::pacs::monitoring::pacs_metrics::to_prometheus().

|
inlinenodiscard |
Get the unified CRTP-based metrics collector.
Definition at line 634 of file pacs_monitor.h.
References unified_collector_.
|
inline |
Unregister a health check.
| component | Component name to unregister |
Definition at line 587 of file pacs_monitor.h.
References health_checks_, and health_checks_mutex_.
|
inline |
Update configuration.
| config | New configuration |
Definition at line 597 of file pacs_monitor.h.
References kcenon::pacs::monitoring::pacs_monitor_config::ae_title, association_collector_, config_, config_mutex_, kcenon::pacs::monitoring::pacs_monitor_config::enable_association_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_pool_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_service_metrics, kcenon::pacs::monitoring::pacs_monitor_config::enable_storage_metrics, service_collector_, storage_collector_, and unified_collector_.
|
private |
Definition at line 386 of file pacs_monitor.h.
Referenced by association_collector(), check_health(), collect_all_metrics(), initialize_collectors(), and update_config().
|
private |
Definition at line 382 of file pacs_monitor.h.
Referenced by collect_all_metrics(), get_config(), get_metrics(), initialize_collectors(), to_prometheus(), and update_config().
|
mutableprivate |
Definition at line 383 of file pacs_monitor.h.
Referenced by collect_all_metrics(), get_config(), and update_config().
|
private |
Definition at line 393 of file pacs_monitor.h.
Referenced by collect_all_metrics(), record_metric(), record_metric(), and reset().
|
mutableprivate |
Definition at line 392 of file pacs_monitor.h.
Referenced by collect_all_metrics(), record_metric(), record_metric(), and reset().
|
private |
Definition at line 397 of file pacs_monitor.h.
Referenced by check_health(), register_health_check(), and unregister_health_check().
|
mutableprivate |
Definition at line 396 of file pacs_monitor.h.
Referenced by check_health(), register_health_check(), and unregister_health_check().
|
private |
Definition at line 387 of file pacs_monitor.h.
Referenced by check_health(), collect_all_metrics(), initialize_collectors(), service_collector(), and update_config().
|
private |
Definition at line 388 of file pacs_monitor.h.
Referenced by check_health(), collect_all_metrics(), initialize_collectors(), storage_collector(), and update_config().
|
private |
Definition at line 389 of file pacs_monitor.h.
Referenced by check_health(), get_unified_snapshot(), initialize_collectors(), unified_collector(), and update_config().