|
Prometheus Client Library for Modern C++
|
Manages the collection of a number of metrics. More...
#include <registry.h>


Public Types | |
| enum class | InsertBehavior { Merge , Throw } |
| How to deal with repeatedly added family names for a type. More... | |
Public Member Functions | |
| Registry (InsertBehavior insert_behavior=InsertBehavior::Merge) | |
| name Create a new registry. | |
| Registry (const Registry &)=delete | |
| Deleted copy constructor. | |
| Registry & | operator= (const Registry &)=delete |
| Deleted copy assignment. | |
| Registry (Registry &&)=delete | |
| Deleted move constructor. | |
| Registry & | operator= (Registry &&)=delete |
| Deleted move assignment. | |
| ~Registry () override | |
| name Destroys a registry. | |
| std::vector< MetricFamily > | Collect () const override |
| Returns a list of metrics and their samples. | |
| template<typename T > | |
| bool | Remove (const Family< T > &family) |
| Removes a metrics family from the registry. | |
| template<> | |
| std::vector< std::unique_ptr< Family< Counter > > > & | GetFamilies () |
| template<> | |
| std::vector< std::unique_ptr< Family< Gauge > > > & | GetFamilies () |
| template<> | |
| std::vector< std::unique_ptr< Family< Histogram > > > & | GetFamilies () |
| template<> | |
| std::vector< std::unique_ptr< Family< Info > > > & | GetFamilies () |
| template<> | |
| std::vector< std::unique_ptr< Family< Summary > > > & | GetFamilies () |
Friends | |
| template<typename T > | |
| class | detail::Builder |
Manages the collection of a number of metrics.
The Registry is responsible to expose data to a class/method/function "bridge", which returns the metrics in a format Prometheus supports.
The key class is the Collectable. This has a method - called Collect() - that returns zero or more metrics and their samples. The metrics are represented by the class Family<>, which implements the Collectable interface. A new metric is registered with BuildCounter(), BuildGauge(), BuildHistogram(), BuildInfo() or BuildSummary().
The class is thread-safe. No concurrent call to any API of this type causes a data race.
|
strong |
How to deal with repeatedly added family names for a type.
Adding a family with the same name but different types is always an error and will lead to an exception.
|
explicit |
name Create a new registry.
| insert_behavior | How to handle families with the same name. |
|
overridevirtual |
Returns a list of metrics and their samples.
Every time the Registry is scraped it calls each of the metrics Collect function.
Implements prometheus::Collectable.
| template bool PROMETHEUS_CPP_CORE_EXPORT prometheus::Registry::Remove | ( | const Family< T > & | family | ) |
Removes a metrics family from the registry.
Please note that this operation invalidates the previously returned reference to the Family and all of their added metric objects.
| family | The family to remove |