Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
Loading...
Searching...
No Matches
kcenon::monitoring::health_check_result Struct Reference

Result of a health check operation. More...

#include <monitoring_core.h>

Collaboration diagram for kcenon::monitoring::health_check_result:
Collaboration graph

Public Member Functions

 health_check_result ()
 
bool is_healthy () const
 
bool is_operational () const
 

Static Public Member Functions

static health_check_result healthy (const std::string &msg="OK")
 
static health_check_result unhealthy (const std::string &msg)
 
static health_check_result degraded (const std::string &msg)
 

Public Attributes

health_status status = health_status::unknown
 
std::string message
 
std::vector< std::string > issues
 
std::chrono::system_clock::time_point check_time
 
std::chrono::system_clock::time_point timestamp
 
std::chrono::milliseconds check_duration {0}
 
std::unordered_map< std::string, std::string > metadata
 
std::optional< std::exception_ptr > error
 

Detailed Description

Constructor & Destructor Documentation

◆ health_check_result()

kcenon::monitoring::health_check_result::health_check_result ( )
inline
Examples
/home/runner/work/monitoring_system/monitoring_system/include/kcenon/monitoring/interfaces/monitoring_core.h.

Definition at line 134 of file monitoring_core.h.

135 : check_time(std::chrono::system_clock::now()),
136 timestamp(std::chrono::system_clock::now()) {}
std::chrono::system_clock::time_point timestamp
std::chrono::system_clock::time_point check_time

Member Function Documentation

◆ degraded()

static health_check_result kcenon::monitoring::health_check_result::degraded ( const std::string & msg)
inlinestatic

Definition at line 165 of file monitoring_core.h.

165 {
166 health_check_result result;
167 result.status = health_status::degraded;
168 result.message = msg;
169 result.timestamp = std::chrono::system_clock::now();
170 result.check_time = result.timestamp;
171 return result;
172 }

References check_time, kcenon::monitoring::degraded, message, status, and timestamp.

Referenced by kcenon::monitoring::composite_health_check::check_all_required(), kcenon::monitoring::health_dependency_graph::check_with_dependencies(), demonstrate_health_monitoring(), and TEST_F().

Here is the caller graph for this function:

◆ healthy()

static health_check_result kcenon::monitoring::health_check_result::healthy ( const std::string & msg = "OK")
inlinestatic

◆ is_healthy()

bool kcenon::monitoring::health_check_result::is_healthy ( ) const
inline
Examples
/home/runner/work/monitoring_system/monitoring_system/include/kcenon/monitoring/interfaces/monitoring_core.h.

Definition at line 138 of file monitoring_core.h.

References kcenon::monitoring::healthy, and status.

Referenced by TEST_F().

Here is the caller graph for this function:

◆ is_operational()

bool kcenon::monitoring::health_check_result::is_operational ( ) const
inline

◆ unhealthy()

static health_check_result kcenon::monitoring::health_check_result::unhealthy ( const std::string & msg)
inlinestatic

Definition at line 156 of file monitoring_core.h.

156 {
157 health_check_result result;
158 result.status = health_status::unhealthy;
159 result.message = msg;
160 result.timestamp = std::chrono::system_clock::now();
161 result.check_time = result.timestamp;
162 return result;
163 }

References check_time, message, status, timestamp, and kcenon::monitoring::unhealthy.

Referenced by kcenon::monitoring::composite_health_check::check_all_required(), kcenon::monitoring::composite_health_check::check_any_required(), kcenon::monitoring::health_dependency_graph::check_with_dependencies(), demonstrate_health_monitoring(), TEST_F(), and TEST_F().

Here is the caller graph for this function:

Member Data Documentation

◆ check_duration

std::chrono::milliseconds kcenon::monitoring::health_check_result::check_duration {0}

◆ check_time

std::chrono::system_clock::time_point kcenon::monitoring::health_check_result::check_time

◆ error

std::optional<std::exception_ptr> kcenon::monitoring::health_check_result::error

◆ issues

std::vector<std::string> kcenon::monitoring::health_check_result::issues

◆ message

◆ metadata

std::unordered_map<std::string, std::string> kcenon::monitoring::health_check_result::metadata

◆ status

◆ timestamp


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