Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::health_check Class Referenceabstract

Abstract base class for health checks. More...

#include <health_monitor.h>

Inheritance diagram for kcenon::monitoring::health_check:
Inheritance graph
Collaboration diagram for kcenon::monitoring::health_check:
Collaboration graph

Public Member Functions

virtual ~health_check ()=default
 
virtual std::string get_name () const =0
 Get the human-readable name of this health check.
 
virtual health_check_type get_type () const =0
 Get the type of this health check (liveness, readiness, or startup).
 
virtual health_check_result check ()=0
 Execute the health check and return the result.
 
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.
 

Detailed Description

Abstract base class for health checks.

Subclass this to implement custom health checks. Override check() to perform the actual health verification, and optionally override get_timeout() and is_critical() to customize behavior.

See also
functional_health_check For a lambda-based implementation
composite_health_check For aggregating multiple checks
health_check_builder For convenient construction
Examples
production_monitoring_example.cpp.

Definition at line 110 of file health_monitor.h.

Constructor & Destructor Documentation

◆ ~health_check()

virtual kcenon::monitoring::health_check::~health_check ( )
virtualdefault

Member Function Documentation

◆ check()

virtual health_check_result kcenon::monitoring::health_check::check ( )
pure virtual

Execute the health check and return the result.

Returns
A health_check_result indicating the current health status

Implemented in database_health_check, external_api_health_check, kcenon::monitoring::composite_health_check, kcenon::monitoring::functional_health_check, and test_health_check.

◆ get_name()

virtual std::string kcenon::monitoring::health_check::get_name ( ) const
pure virtual

Get the human-readable name of this health check.

Returns
The health check name

Implemented in database_health_check, external_api_health_check, kcenon::monitoring::composite_health_check, kcenon::monitoring::functional_health_check, and test_health_check.

◆ get_timeout()

virtual std::chrono::milliseconds kcenon::monitoring::health_check::get_timeout ( ) const
inlinevirtual

Get the maximum time allowed for this check to complete.

Returns
Timeout duration (default: 1000ms)

Reimplemented in kcenon::monitoring::functional_health_check.

Definition at line 136 of file health_monitor.h.

136 {
137 return std::chrono::milliseconds(1000);
138 }

◆ get_type()

virtual health_check_type kcenon::monitoring::health_check::get_type ( ) const
pure virtual

Get the type of this health check (liveness, readiness, or startup).

Returns
The health check type

Implemented in database_health_check, external_api_health_check, kcenon::monitoring::composite_health_check, kcenon::monitoring::functional_health_check, and test_health_check.

◆ is_critical()

virtual bool kcenon::monitoring::health_check::is_critical ( ) const
inlinevirtual

Whether this check is critical for overall system health.

Returns
true if failure of this check should mark the system as unhealthy (default: false)

Reimplemented in database_health_check, external_api_health_check, and kcenon::monitoring::functional_health_check.

Definition at line 144 of file health_monitor.h.

144 {
145 return false;
146 }

The documentation for this class was generated from the following file: