|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Composite health check that aggregates multiple sub-checks. More...
#include <health_monitor.h>


Public Member Functions | |
| composite_health_check (const std::string &name, health_check_type type, bool all_required=true) | |
| Construct a composite health check. | |
| std::string | get_name () const override |
| Get the human-readable name of this health check. | |
| health_check_type | get_type () const override |
| Get the type of this health check (liveness, readiness, or startup). | |
| void | add_check (std::shared_ptr< health_check > check) |
| Add a child health check to this composite. | |
| health_check_result | check () override |
| Execute all child checks and return the aggregate result. | |
Public Member Functions inherited from kcenon::monitoring::health_check | |
| virtual | ~health_check ()=default |
| virtual std::chrono::milliseconds | get_timeout () const |
| Get the maximum time allowed for this check to complete. | |
| virtual bool | is_critical () const |
| Whether this check is critical for overall system health. | |
Private Member Functions | |
| health_check_result | check_all_required (const std::vector< health_check_result > &results) |
| health_check_result | check_any_required (const std::vector< health_check_result > &results) |
Private Attributes | |
| std::string | name_ |
| health_check_type | type_ |
| bool | all_required_ |
| std::vector< std::shared_ptr< health_check > > | checks_ |
| std::mutex | mutex_ |
Composite health check that aggregates multiple sub-checks.
Evaluates a collection of child health checks and returns an aggregate result. Supports two aggregation modes:
Thread-safe. Uses a mutex to protect the checks_ collection.
Definition at line 219 of file health_monitor.h.
|
inline |
Construct a composite health check.
| name | Human-readable name for this composite check |
| type | The check type (liveness, readiness, or startup) |
| all_required | If true (default), all sub-checks must pass (AND mode); if false, at least one must pass (OR mode) |
Definition at line 228 of file health_monitor.h.
|
inline |
Add a child health check to this composite.
| check | The health check to add |
Definition at line 244 of file health_monitor.h.
References check(), checks_, and mutex_.
Referenced by TEST_F(), and TEST_F().


|
inlineoverridevirtual |
Execute all child checks and return the aggregate result.
Implements kcenon::monitoring::health_check.
Definition at line 253 of file health_monitor.h.
References all_required_, check_all_required(), check_any_required(), checks_, kcenon::monitoring::health_check_result::healthy(), and mutex_.
Referenced by add_check(), TEST_F(), and TEST_F().


|
inlineprivate |
Definition at line 275 of file health_monitor.h.
References kcenon::monitoring::health_check_result::degraded(), kcenon::monitoring::degraded, kcenon::monitoring::health_check_result::healthy(), kcenon::monitoring::health_check_result::unhealthy(), and kcenon::monitoring::unhealthy.
Referenced by check().


|
inlineprivate |
Definition at line 299 of file health_monitor.h.
References kcenon::monitoring::health_check_result::healthy(), kcenon::monitoring::healthy, and kcenon::monitoring::health_check_result::unhealthy().
Referenced by check().


|
inlineoverridevirtual |
Get the human-readable name of this health check.
Implements kcenon::monitoring::health_check.
Definition at line 236 of file health_monitor.h.
References name_.
|
inlineoverridevirtual |
Get the type of this health check (liveness, readiness, or startup).
Implements kcenon::monitoring::health_check.
Definition at line 238 of file health_monitor.h.
References type_.
|
private |
Definition at line 319 of file health_monitor.h.
Referenced by check().
|
private |
Definition at line 320 of file health_monitor.h.
Referenced by add_check(), and check().
|
mutableprivate |
Definition at line 321 of file health_monitor.h.
Referenced by add_check(), and check().
|
private |
Definition at line 317 of file health_monitor.h.
Referenced by get_name().
|
private |
Definition at line 318 of file health_monitor.h.
Referenced by get_type().