Loading...
Searching...
No Matches
gauge.h
#pragma once
#include <atomic>
#include "prometheus/client_metric.h"
#include "prometheus/detail/builder.h" // IWYU pragma: export
#include "prometheus/detail/core_export.h"
#include "prometheus/metric_type.h"
namespace prometheus {
class PROMETHEUS_CPP_CORE_EXPORT Gauge {
public:
static const MetricType metric_type{MetricType::Gauge};
Gauge() = default;
Gauge(double);
void Increment();
void Increment(double);
void Decrement();
void Decrement(double);
void Set(double);
void SetToCurrentTime();
double Value() const;
ClientMetric Collect() const;
private:
void Change(double);
std::atomic<double> value_{0.0};
};
PROMETHEUS_CPP_CORE_EXPORT detail::Builder<Gauge> BuildGauge();
} // namespace prometheus
prometheus::Gauge
A gauge metric to represent a value that can arbitrarily go up and down.
Definition gauge.h:24
prometheus::Gauge::Gauge
Gauge()=default
Create a gauge that starts at 0.
prometheus::ClientMetric
Definition client_metric.h:12