Loading...
Searching...
No Matches
client_metric.h
#pragma once
#include <cstdint>
#include <string>
#include <tuple>
#include <vector>
#include "prometheus/detail/core_export.h"
namespace prometheus {
struct PROMETHEUS_CPP_CORE_EXPORT ClientMetric {
// Label
struct Label {
std::string name;
std::string value;
bool operator<(const Label& rhs) const {
return std::tie(name, value) < std::tie(rhs.name, rhs.value);
}
bool operator==(const Label& rhs) const {
return std::tie(name, value) == std::tie(rhs.name, rhs.value);
}
};
std::vector<Label> label;
// Counter
struct Counter {
double value = 0.0;
};
Counter counter;
// Gauge
struct Gauge {
double value = 0.0;
};
Gauge gauge;
// Summary
struct Quantile {
double quantile = 0.0;
double value = 0.0;
};
struct Summary {
std::uint64_t sample_count = 0;
double sample_sum = 0.0;
std::vector<Quantile> quantile;
};
Summary summary;
// Histogram
struct Bucket {
std::uint64_t cumulative_count = 0;
double upper_bound = 0.0;
};
struct Histogram {
std::uint64_t sample_count = 0;
double sample_sum = 0.0;
std::vector<Bucket> bucket;
};
Histogram histogram;
// Untyped
struct Untyped {
double value = 0;
};
Untyped untyped;
// Timestamp
std::int64_t timestamp_ms = 0;
};
} // namespace prometheus
prometheus::ClientMetric::Bucket
Definition client_metric.h:59
prometheus::ClientMetric::Counter
Definition client_metric.h:31
prometheus::ClientMetric::Gauge
Definition client_metric.h:38
prometheus::ClientMetric::Histogram
Definition client_metric.h:64
prometheus::ClientMetric::Label
Definition client_metric.h:15
prometheus::ClientMetric::Quantile
Definition client_metric.h:45
prometheus::ClientMetric::Summary
Definition client_metric.h:50
prometheus::ClientMetric::Untyped
Definition client_metric.h:73
prometheus::ClientMetric
Definition client_metric.h:12