8#include "prometheus/collectable.h"
9#include "prometheus/detail/core_export.h"
10#include "prometheus/family.h"
11#include "prometheus/labels.h"
12#include "prometheus/metric_family.h"
58 explicit Registry(InsertBehavior insert_behavior = InsertBehavior::Merge);
81 std::vector<MetricFamily>
Collect()
const override;
98 friend class detail::Builder;
100 template <
typename T>
101 std::vector<std::unique_ptr<Family<T>>>& GetFamilies();
103 template <
typename T>
104 bool NameExistsInOtherType(
const std::string& name)
const;
106 template <
typename T>
107 Family<T>& Add(
const std::string& name,
const std::string& help,
108 const Labels& labels);
111 std::vector<std::unique_ptr<Family<Counter>>> counters_;
112 std::vector<std::unique_ptr<Family<Gauge>>> gauges_;
113 std::vector<std::unique_ptr<Family<Histogram>>> histograms_;
114 std::vector<std::unique_ptr<Family<Summary>>> summaries_;
115 mutable std::mutex mutex_;
Interface implemented by anything that can be used by Prometheus to collect metrics.
Definition collectable.h:17
A counter metric to represent a monotonically increasing value.
Definition counter.h:26
A metric of type T with a set of labeled dimensions.
Definition family.h:61
A gauge metric to represent a value that can arbitrarily go up and down.
Definition gauge.h:24
A histogram metric to represent aggregatable distributions of events.
Definition histogram.h:31
Manages the collection of a number of metrics.
Definition registry.h:40
Registry & operator=(Registry &&)=delete
Deleted move assignment.
~Registry() override
name Destroys a registry.
Registry(const Registry &)=delete
Deleted copy constructor.
Registry(InsertBehavior insert_behavior=InsertBehavior::Merge)
name Create a new registry.
Definition registry.cc:40
Registry(Registry &&)=delete
Deleted move constructor.
std::vector< MetricFamily > Collect() const override
Returns a list of metrics and their samples.
Definition registry.cc:45
bool Remove(const Family< T > &family)
Removes a metrics family from the registry.
Definition registry.cc:155
Registry & operator=(const Registry &)=delete
Deleted copy assignment.
InsertBehavior
How to deal with repeatedly added family names for a type.
Definition registry.h:46
A summary metric samples observations over a sliding window of time.
Definition summary.h:41