Loading...
Searching...
No Matches
histogram.h
#pragma once
#include <mutex>
#include <vector>
#include "prometheus/client_metric.h"
#include "prometheus/counter.h"
#include "prometheus/detail/builder.h" // IWYU pragma: export
#include "prometheus/detail/core_export.h"
#include "prometheus/gauge.h"
#include "prometheus/metric_type.h"
namespace prometheus {
class PROMETHEUS_CPP_CORE_EXPORT Histogram {
public:
using BucketBoundaries = std::vector<double>;
static const MetricType metric_type{MetricType::Histogram};
Histogram(const BucketBoundaries& buckets);
void Observe(double value);
void ObserveMultiple(const std::vector<double>& bucket_increments,
const double sum_of_values);
ClientMetric Collect() const;
private:
const BucketBoundaries bucket_boundaries_;
mutable std::mutex mutex_;
std::vector<Counter> bucket_counts_;
Gauge sum_;
};
PROMETHEUS_CPP_CORE_EXPORT detail::Builder<Histogram> BuildHistogram();
} // namespace prometheus
prometheus::Gauge
A gauge metric to represent a value that can arbitrarily go up and down.
Definition gauge.h:24
prometheus::Histogram
A histogram metric to represent aggregatable distributions of events.
Definition histogram.h:31
prometheus::ClientMetric
Definition client_metric.h:12