C++ Actor Framework 0.18
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
caf::telemetry::metric_registry Class Reference

Manages a collection of metric families. More...

#include <metric_registry.hpp>

Classes

struct  span_type
 Forces the compiler to use the type span<const T> instead of trying to match parameters to a span. More...
 

Public Types

template<class T >
using span_t = typename span_type< T >::type
 Convenience alias to safe some typing.
 

Public Member Functions

 metric_registry (const actor_system_config &cfg)
 
template<class ValueType = int64_t>
metric_family_impl< gauge< ValueType > > * gauge_family (string_view prefix, string_view name, span_t< string_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a gauge metric family.
 
template<class ValueType = int64_t>
metric_family_impl< gauge< ValueType > > * gauge_family (string_view prefix, string_view name, std::initializer_list< string_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a gauge metric family.
 
template<class ValueType = int64_t>
metric_family_impl< gauge< ValueType > > * gauge_family (string_view prefix, string_view name, span_t< label_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a gauge metric family.
 
template<class ValueType = int64_t>
gauge< ValueType > * gauge_instance (string_view prefix, string_view name, span_t< label_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a gauge.
 
template<class ValueType = int64_t>
gauge< ValueType > * gauge_instance (string_view prefix, string_view name, std::initializer_list< label_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a gauge.
 
template<class ValueType = int64_t>
gauge< ValueType > * gauge_singleton (string_view prefix, string_view name, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a gauge metric singleton, i.e., the single instance of a family without label dimensions.
 
template<class ValueType = int64_t>
metric_family_impl< counter< ValueType > > * counter_family (string_view prefix, string_view name, span_t< string_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a counter metric family.
 
template<class ValueType = int64_t>
metric_family_impl< counter< ValueType > > * counter_family (string_view prefix, string_view name, std::initializer_list< string_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a counter metric family.
 
template<class ValueType = int64_t>
metric_family_impl< counter< ValueType > > * counter_family (string_view prefix, string_view name, span_t< label_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a counter metric family.
 
template<class ValueType = int64_t>
counter< ValueType > * counter_instance (string_view prefix, string_view name, span_t< label_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a counter.
 
template<class ValueType = int64_t>
counter< ValueType > * counter_instance (string_view prefix, string_view name, std::initializer_list< label_view > labels, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a counter.
 
template<class ValueType = int64_t>
counter< ValueType > * counter_singleton (string_view prefix, string_view name, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a counter metric singleton, i.e., the single instance of a family without label dimensions.
 
template<class ValueType = int64_t>
metric_family_impl< histogram< ValueType > > * histogram_family (string_view prefix, string_view name, span_t< string_view > label_names, span_t< ValueType > default_upper_bounds, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a histogram metric family.
 
template<class ValueType = int64_t>
metric_family_impl< histogram< ValueType > > * histogram_family (string_view prefix, string_view name, std::initializer_list< string_view > label_names, span_t< ValueType > upper_bounds, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a gauge metric family.
 
template<class ValueType = int64_t>
histogram< ValueType > * histogram_instance (string_view prefix, string_view name, span_t< label_view > labels, span_t< ValueType > upper_bounds, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a histogram.
 
template<class ValueType = int64_t>
histogram< ValueType > * histogram_instance (string_view prefix, string_view name, std::initializer_list< label_view > labels, span_t< ValueType > upper_bounds, string_view helptext, string_view unit="1", bool is_sum=false)
 @copdoc histogram_instance
 
template<class ValueType = int64_t>
histogram< ValueType > * histogram_singleton (string_view prefix, string_view name, span_t< ValueType > upper_bounds, string_view helptext, string_view unit="1", bool is_sum=false)
 Returns a histogram metric singleton, i.e., the single instance of a family without label dimensions.
 
void config (const settings *ptr)
 
template<class Collector >
void collect (Collector &collector) const
 
void merge (metric_registry &other)
 Takes ownership of all metric families in other.
 

Detailed Description

Manages a collection of metric families.

Member Function Documentation

◆ counter_family() [1/3]

template<class ValueType = int64_t>
metric_family_impl< counter< ValueType > > * caf::telemetry::metric_registry::counter_family ( string_view  prefix,
string_view  name,
span_t< label_view >  labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a counter metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ counter_family() [2/3]

template<class ValueType = int64_t>
metric_family_impl< counter< ValueType > > * caf::telemetry::metric_registry::counter_family ( string_view  prefix,
string_view  name,
span_t< string_view labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a counter metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ counter_family() [3/3]

template<class ValueType = int64_t>
metric_family_impl< counter< ValueType > > * caf::telemetry::metric_registry::counter_family ( string_view  prefix,
string_view  name,
std::initializer_list< string_view labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a counter metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ counter_instance() [1/2]

template<class ValueType = int64_t>
counter< ValueType > * caf::telemetry::metric_registry::counter_instance ( string_view  prefix,
string_view  name,
span_t< label_view >  labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a counter.

Creates all objects lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsValues for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ counter_instance() [2/2]

template<class ValueType = int64_t>
counter< ValueType > * caf::telemetry::metric_registry::counter_instance ( string_view  prefix,
string_view  name,
std::initializer_list< label_view >  labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a counter.

Creates all objects lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsValues for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ counter_singleton()

template<class ValueType = int64_t>
counter< ValueType > * caf::telemetry::metric_registry::counter_singleton ( string_view  prefix,
string_view  name,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a counter metric singleton, i.e., the single instance of a family without label dimensions.

Creates all objects lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ gauge_family() [1/3]

template<class ValueType = int64_t>
metric_family_impl< gauge< ValueType > > * caf::telemetry::metric_registry::gauge_family ( string_view  prefix,
string_view  name,
span_t< label_view >  labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a gauge metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ gauge_family() [2/3]

template<class ValueType = int64_t>
metric_family_impl< gauge< ValueType > > * caf::telemetry::metric_registry::gauge_family ( string_view  prefix,
string_view  name,
span_t< string_view labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a gauge metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ gauge_family() [3/3]

template<class ValueType = int64_t>
metric_family_impl< gauge< ValueType > > * caf::telemetry::metric_registry::gauge_family ( string_view  prefix,
string_view  name,
std::initializer_list< string_view labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a gauge metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ gauge_instance() [1/2]

template<class ValueType = int64_t>
gauge< ValueType > * caf::telemetry::metric_registry::gauge_instance ( string_view  prefix,
string_view  name,
span_t< label_view >  labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a gauge.

Creates all objects lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsValues for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ gauge_instance() [2/2]

template<class ValueType = int64_t>
gauge< ValueType > * caf::telemetry::metric_registry::gauge_instance ( string_view  prefix,
string_view  name,
std::initializer_list< label_view >  labels,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a gauge.

Creates all objects lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsValues for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ gauge_singleton()

template<class ValueType = int64_t>
gauge< ValueType > * caf::telemetry::metric_registry::gauge_singleton ( string_view  prefix,
string_view  name,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a gauge metric singleton, i.e., the single instance of a family without label dimensions.

Creates all objects lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ histogram_family() [1/2]

template<class ValueType = int64_t>
metric_family_impl< histogram< ValueType > > * caf::telemetry::metric_registry::histogram_family ( string_view  prefix,
string_view  name,
span_t< string_view label_names,
span_t< ValueType >  default_upper_bounds,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a histogram metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
label_namesNames for all label dimensions of the metric.
default_upper_boundsUpper bounds for the metric buckets.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.
Note
The first call wins when calling this function multiple times with different bucket settings. Later calls skip checking the bucket settings, mainly because this check would be rather expensive.
The actor system config may override upper_bounds.

◆ histogram_family() [2/2]

template<class ValueType = int64_t>
metric_family_impl< histogram< ValueType > > * caf::telemetry::metric_registry::histogram_family ( string_view  prefix,
string_view  name,
std::initializer_list< string_view label_names,
span_t< ValueType >  upper_bounds,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a gauge metric family.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.

◆ histogram_instance()

template<class ValueType = int64_t>
histogram< ValueType > * caf::telemetry::metric_registry::histogram_instance ( string_view  prefix,
string_view  name,
span_t< label_view >  labels,
span_t< ValueType >  upper_bounds,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a histogram.

Creates the family lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
labelsNames for all label dimensions of the metric.
upper_boundsUpper bounds for the metric buckets.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.
Note
The first call wins when calling this function multiple times with different bucket settings. Later calls skip checking the bucket settings, mainly because this check would be rather expensive.
The actor system config may override upper_bounds.

◆ histogram_singleton()

template<class ValueType = int64_t>
histogram< ValueType > * caf::telemetry::metric_registry::histogram_singleton ( string_view  prefix,
string_view  name,
span_t< ValueType >  upper_bounds,
string_view  helptext,
string_view  unit = "1",
bool  is_sum = false 
)

Returns a histogram metric singleton, i.e., the single instance of a family without label dimensions.

Creates all objects lazily if necessary, but fails if the full name already belongs to a different family.

Parameters
prefixThe prefix (namespace) this family belongs to. Usually the application or protocol name, e.g., http. The prefix caf as well as prefixes starting with an underscore are reserved.
nameThe human-readable name of the metric, e.g., requests.
helptextShort explanation of the metric.
unitUnit of measurement. Please use base units such as bytes or seconds (prefer lowercase). The pseudo-unit 1 identifies dimensionless counts.
is_sumSetting this to true indicates that this metric adds something up to a total, where only the total value is of interest. For example, the total number of HTTP requests.
Note
The actor system config may override upper_bounds.

◆ merge()

void caf::telemetry::metric_registry::merge ( metric_registry other)

Takes ownership of all metric families in other.

Precondition
other must not contain any duplicated metric family

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