NVIDIA DeepStream SDK API Reference

8.0 Release
prometheus::Registry Class Reference

Detailed Description

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.

Definition at line 41 of file sources/includes/prometheus/registry.h.

Inheritance diagram for prometheus::Registry:
Collaboration diagram for prometheus::Registry:

Public Types

enum  InsertBehavior {
  InsertBehavior::Merge,
  InsertBehavior::Throw,
  InsertBehavior::Merge,
  InsertBehavior::Throw
}
 How to deal with repeatedly added family names for a type. More...
 
enum  InsertBehavior {
  InsertBehavior::Merge,
  InsertBehavior::Throw,
  InsertBehavior::Merge,
  InsertBehavior::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. More...
 
 Registry (const Registry &)=delete
 Deleted copy constructor. More...
 
Registryoperator= (const Registry &)=delete
 Deleted copy assignment. More...
 
 Registry (Registry &&)=delete
 Deleted move constructor. More...
 
Registryoperator= (Registry &&)=delete
 Deleted move assignment. More...
 
 ~Registry () override
 name Destroys a registry. More...
 
std::vector< MetricFamilyCollect () const override
 Returns a list of metrics and their samples. More...
 
template<typename T >
bool Remove (const Family< T > &family)
 Removes a metrics family from the registry. More...
 
 Registry (InsertBehavior insert_behavior=InsertBehavior::Merge)
 name Create a new registry. More...
 
 Registry (const Registry &)=delete
 Deleted copy constructor. More...
 
Registryoperator= (const Registry &)=delete
 Deleted copy assignment. More...
 
 Registry (Registry &&)=delete
 Deleted move constructor. More...
 
Registryoperator= (Registry &&)=delete
 Deleted move assignment. More...
 
 ~Registry () override
 name Destroys a registry. More...
 
std::vector< MetricFamilyCollect () const override
 Returns a list of metrics and their samples. More...
 
template<typename T >
bool Remove (const Family< T > &family)
 Removes a metrics family from the registry. More...
 

Friends

template<typename T >
class detail::Builder
 
template<typename T >
class detail::Builder
 

Member Enumeration Documentation

◆ InsertBehavior [1/2]

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.

Enumerator
Merge 

If a family with the same name and labels already exists return the existing one.

If no family with that name exists create it. Otherwise throw.

Throw 

Throws if a family with the same name already exists.

Merge 

If a family with the same name and labels already exists return the existing one.

If no family with that name exists create it. Otherwise throw.

Throw 

Throws if a family with the same name already exists.

Definition at line 47 of file sources/includes/prometheus/registry.h.

◆ InsertBehavior [2/2]

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.

Enumerator
Merge 

If a family with the same name and labels already exists return the existing one.

If no family with that name exists create it. Otherwise throw.

Throw 

Throws if a family with the same name already exists.

Merge 

If a family with the same name and labels already exists return the existing one.

If no family with that name exists create it. Otherwise throw.

Throw 

Throws if a family with the same name already exists.

Definition at line 47 of file 9.0/sources/includes/prometheus/registry.h.

Constructor & Destructor Documentation

◆ Registry() [1/6]

prometheus::Registry::Registry ( InsertBehavior  insert_behavior = InsertBehavior::Merge)
explicit

name Create a new registry.

Parameters
insert_behaviorHow to handle families with the same name.

◆ Registry() [2/6]

prometheus::Registry::Registry ( const Registry )
delete

Deleted copy constructor.

◆ Registry() [3/6]

prometheus::Registry::Registry ( Registry &&  )
delete

Deleted move constructor.

◆ ~Registry() [1/2]

prometheus::Registry::~Registry ( )
override

name Destroys a registry.

◆ Registry() [4/6]

prometheus::Registry::Registry ( InsertBehavior  insert_behavior = InsertBehavior::Merge)
explicit

name Create a new registry.

Parameters
insert_behaviorHow to handle families with the same name.

◆ Registry() [5/6]

prometheus::Registry::Registry ( const Registry )
delete

Deleted copy constructor.

◆ Registry() [6/6]

prometheus::Registry::Registry ( Registry &&  )
delete

Deleted move constructor.

◆ ~Registry() [2/2]

prometheus::Registry::~Registry ( )
override

name Destroys a registry.

Member Function Documentation

◆ Collect() [1/2]

std::vector<MetricFamily> prometheus::Registry::Collect ( ) const
overridevirtual

Returns a list of metrics and their samples.

Every time the Registry is scraped it calls each of the metrics Collect function.

Returns
Zero or more metrics and their samples.

Implements prometheus::Collectable.

◆ Collect() [2/2]

std::vector<MetricFamily> prometheus::Registry::Collect ( ) const
overridevirtual

Returns a list of metrics and their samples.

Every time the Registry is scraped it calls each of the metrics Collect function.

Returns
Zero or more metrics and their samples.

Implements prometheus::Collectable.

◆ operator=() [1/4]

Registry& prometheus::Registry::operator= ( const Registry )
delete

Deleted copy assignment.

◆ operator=() [2/4]

Registry& prometheus::Registry::operator= ( const Registry )
delete

Deleted copy assignment.

◆ operator=() [3/4]

Registry& prometheus::Registry::operator= ( Registry &&  )
delete

Deleted move assignment.

◆ operator=() [4/4]

Registry& prometheus::Registry::operator= ( Registry &&  )
delete

Deleted move assignment.

◆ Remove() [1/2]

template<typename T >
bool 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.

Template Parameters
TOne of the metric types Counter, Gauge, Histogram or Summary.
Parameters
familyThe family to remove
Returns
True if the family was found and removed.

◆ Remove() [2/2]

template<typename T >
bool 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.

Template Parameters
TOne of the metric types Counter, Gauge, Histogram or Summary.
Parameters
familyThe family to remove
Returns
True if the family was found and removed.

Friends And Related Function Documentation

◆ detail::Builder [1/2]

template<typename T >
friend class detail::Builder
friend

Definition at line 99 of file sources/includes/prometheus/registry.h.

◆ detail::Builder [2/2]

template<typename T >
class detail::Builder
friend

Definition at line 99 of file 9.0/sources/includes/prometheus/registry.h.


The documentation for this class was generated from the following file: