Prometheus Client Library for Modern C++
Loading...
Searching...
No Matches
counter.h
1#pragma once
2
3#include "prometheus/client_metric.h"
4#include "prometheus/detail/builder.h" // IWYU pragma: export
5#include "prometheus/detail/core_export.h"
6#include "prometheus/gauge.h"
7#include "prometheus/metric_type.h"
8
9namespace prometheus {
10
26class PROMETHEUS_CPP_CORE_EXPORT Counter {
27 public:
28 static const MetricType metric_type{MetricType::Counter};
29
31 Counter() = default;
32
34 void Increment();
35
39 void Increment(double);
40
42 void Reset();
43
45 double Value() const;
46
50 ClientMetric Collect() const;
51
52 private:
53 Gauge gauge_{0.0};
54};
55
83PROMETHEUS_CPP_CORE_EXPORT detail::Builder<Counter> BuildCounter();
84
85} // namespace prometheus
A counter metric to represent a monotonically increasing value.
Definition counter.h:26
Counter()=default
Create a counter that starts at 0.
A gauge metric to represent a value that can arbitrarily go up and down.
Definition gauge.h:24
Definition client_metric.h:12