|
Common System 0.2.0
Common interfaces and patterns for system integration
|
Abstract interface for collecting metrics across modules. More...
#include <metric_collector_interface.h>


Public Member Functions | |
| virtual | ~IMetricCollector ()=default |
| virtual void | increment (std::string_view name, double value=1.0, const metric_labels &labels={})=0 |
| Increment a counter metric. | |
| virtual void | gauge (std::string_view name, double value, const metric_labels &labels={})=0 |
| Set a gauge metric to an absolute value. | |
| virtual void | histogram (std::string_view name, double value, const metric_labels &labels={})=0 |
| Record a histogram observation. | |
| virtual void | timing (std::string_view name, std::chrono::nanoseconds duration, const metric_labels &labels={})=0 |
| Record a timing measurement. | |
| virtual std::string | get_implementation_name () const |
| Get the implementation name for logging/debugging. | |
Abstract interface for collecting metrics across modules.
This interface defines the contract for metric collection implementations, allowing modules to emit metrics without direct dependencies on specific monitoring backends (e.g., Prometheus, StatsD, OpenTelemetry).
Example usage:
Definition at line 68 of file metric_collector_interface.h.
|
virtualdefault |
|
pure virtual |
Set a gauge metric to an absolute value.
Gauges represent instantaneous values that can go up or down, such as temperature, memory usage, or active connections.
| name | Metric name |
| value | Current value (can be negative) |
| labels | Optional dimensional labels |
Implemented in kcenon::common::interfaces::null_metric_collector.
|
inlinenodiscardvirtual |
Get the implementation name for logging/debugging.
Implemented in kcenon::common::interfaces::null_metric_collector.
Definition at line 132 of file metric_collector_interface.h.
|
pure virtual |
Record a histogram observation.
Histograms track the distribution of values across configurable buckets, useful for measuring sizes, counts, or any discrete values.
| name | Metric name |
| value | Observed value |
| labels | Optional dimensional labels |
Implemented in kcenon::common::interfaces::null_metric_collector.
|
pure virtual |
Increment a counter metric.
Counters are monotonically increasing values, typically used for counting events (requests, errors, completed jobs, etc.).
| name | Metric name (should follow naming conventions, e.g., snake_case) |
| value | Increment value (default: 1.0, must be non-negative) |
| labels | Optional dimensional labels for filtering/grouping |
Implemented in kcenon::common::interfaces::null_metric_collector.
|
pure virtual |
Record a timing measurement.
Timing metrics are specialized histograms for duration measurements. Implementations may convert to appropriate units (ms, s, etc.).
| name | Metric name |
| duration | Duration measurement |
| labels | Optional dimensional labels |
Implemented in kcenon::common::interfaces::null_metric_collector.
Referenced by kcenon::common::interfaces::scoped_timer::~scoped_timer().
