|
Common System 0.2.0
Common interfaces and patterns for system integration
|
Interface for components that expose statistics. More...
#include <stats_interface.h>


Public Member Functions | |
| virtual | ~IStats ()=default |
| virtual auto | get_stats () const -> std::unordered_map< std::string, stats_value >=0 |
| Get current statistics as key-value pairs. | |
| virtual auto | to_json () const -> std::string=0 |
| Get statistics as JSON string. | |
| virtual auto | name () const -> std::string_view=0 |
| Get component name for identification. | |
| virtual auto | get_snapshot () const -> stats_snapshot |
| Get a complete statistics snapshot with metadata. | |
Interface for components that expose statistics.
All systems that want to provide metrics for monitoring should implement this interface. This enables the monitoring_system to generically collect stats from any component.
Usage Example:
Thread Safety:
Definition at line 73 of file stats_interface.h.
|
virtualdefault |
|
inlinenodiscardvirtual |
Get a complete statistics snapshot with metadata.
Convenience method that bundles stats with component name and timestamp. Useful for monitoring systems that need full context.
Definition at line 121 of file stats_interface.h.
References get_stats(), and name().
Referenced by kcenon::common::resilience::circuit_breaker::to_json().


|
nodiscardpure virtual |
Get current statistics as key-value pairs.
Returns a snapshot of current metrics. Keys should be descriptive and stable across calls (use snake_case naming convention).
Common metric names:
Implemented in kcenon::common::resilience::circuit_breaker.
Referenced by get_snapshot().

|
nodiscardpure virtual |
Get component name for identification.
Returns a unique identifier for this component. Used by monitoring systems to distinguish stats from different sources.
Implemented in kcenon::common::resilience::circuit_breaker.
Referenced by get_snapshot().

|
nodiscardpure virtual |
Get statistics as JSON string.
Serializes current statistics to JSON format for logging, monitoring, or API responses.
Implemented in kcenon::common::resilience::circuit_breaker.