17#include <unordered_map>
20namespace kcenon {
namespace monitoring {
55 std::variant<double, int64_t, std::string>
value;
56 std::unordered_map<std::string, std::string>
tags;
62 metric(
const std::string& n,
const std::variant<double, int64_t, std::string>& v,
63 const std::unordered_map<std::string, std::string>& t,
66 timestamp(std::chrono::system_clock::now()) {}
73 hash = hash * 31 +
static_cast<uint32_t
>(c);
78 if (std::holds_alternative<double>(
value)) {
80 }
else if (std::holds_alternative<int64_t>(
value)) {
Common metric type definitions for efficient storage.
metric_type
Metric types supported by exporters.
@ gauge
Instantaneous value that can go up and down.
Memory-efficient metric value storage.
Statistics about metric collection.
std::chrono::milliseconds avg_collection_time
double success_rate() const
std::chrono::system_clock::time_point last_collection
Basic metric structure for interface compatibility.
metric(const std::string &n, const std::variant< double, int64_t, std::string > &v, const std::unordered_map< std::string, std::string > &t, metric_type mt=metric_type::gauge)
compact_metric_value to_compact() const
std::chrono::system_clock::time_point timestamp
std::variant< double, int64_t, std::string > value
std::unordered_map< std::string, std::string > tags