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

Error boundary metrics with atomic counters. More...

#include <error_boundary.h>

Collaboration diagram for kcenon::monitoring::error_boundary_metrics:
Collaboration graph

Public Member Functions

 error_boundary_metrics ()=default
 
 error_boundary_metrics (const error_boundary_metrics &other)
 
error_boundary_metricsoperator= (const error_boundary_metrics &other)
 
double get_success_rate () const
 

Public Attributes

std::atomic< size_t > total_operations {0}
 
std::atomic< size_t > successful_operations {0}
 
std::atomic< size_t > failed_operations {0}
 
std::atomic< size_t > recovered_operations {0}
 
std::atomic< size_t > recovery_attempts {0}
 

Detailed Description

Error boundary metrics with atomic counters.

Definition at line 48 of file error_boundary.h.

Constructor & Destructor Documentation

◆ error_boundary_metrics() [1/2]

kcenon::monitoring::error_boundary_metrics::error_boundary_metrics ( )
default

◆ error_boundary_metrics() [2/2]

kcenon::monitoring::error_boundary_metrics::error_boundary_metrics ( const error_boundary_metrics & other)
inline

Definition at line 57 of file error_boundary.h.

58 : total_operations(other.total_operations.load())
59 , successful_operations(other.successful_operations.load())
60 , failed_operations(other.failed_operations.load())
61 , recovered_operations(other.recovered_operations.load())
62 , recovery_attempts(other.recovery_attempts.load()) {}

Member Function Documentation

◆ get_success_rate()

double kcenon::monitoring::error_boundary_metrics::get_success_rate ( ) const
inline

Definition at line 75 of file error_boundary.h.

75 {
76 size_t total = total_operations.load();
77 if (total == 0) {
78 return 1.0;
79 }
80 return static_cast<double>(successful_operations.load()) / static_cast<double>(total);
81 }

References successful_operations, and total_operations.

◆ operator=()

error_boundary_metrics & kcenon::monitoring::error_boundary_metrics::operator= ( const error_boundary_metrics & other)
inline

Definition at line 64 of file error_boundary.h.

64 {
65 if (this != &other) {
66 total_operations = other.total_operations.load();
67 successful_operations = other.successful_operations.load();
68 failed_operations = other.failed_operations.load();
69 recovered_operations = other.recovered_operations.load();
70 recovery_attempts = other.recovery_attempts.load();
71 }
72 return *this;
73 }

References failed_operations, kcenon::monitoring::other, recovered_operations, recovery_attempts, successful_operations, and total_operations.

Member Data Documentation

◆ failed_operations

std::atomic<size_t> kcenon::monitoring::error_boundary_metrics::failed_operations {0}

◆ recovered_operations

std::atomic<size_t> kcenon::monitoring::error_boundary_metrics::recovered_operations {0}

Definition at line 52 of file error_boundary.h.

52{0};

Referenced by operator=().

◆ recovery_attempts

std::atomic<size_t> kcenon::monitoring::error_boundary_metrics::recovery_attempts {0}

Definition at line 53 of file error_boundary.h.

53{0};

Referenced by kcenon::monitoring::error_boundary< T >::handle_success(), and operator=().

◆ successful_operations

std::atomic<size_t> kcenon::monitoring::error_boundary_metrics::successful_operations {0}

◆ total_operations

std::atomic<size_t> kcenon::monitoring::error_boundary_metrics::total_operations {0}

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