Template Class Counter

Inheritance Relationships

Derived Types

Class Documentation

template<class T>
class Counter

Subclassed by opentelemetry::metrics::NoopCounter< T >, opentelemetry::sdk::metrics::DoubleCounter, opentelemetry::sdk::metrics::LongCounter< T >

Public Functions

virtual void Add(T value) noexcept = 0

Add adds the value to the counter’s sum

Parameters:

value – The increment amount. MUST be non-negative.

virtual void Add(T value, const context::Context &context) noexcept = 0
virtual void Add(T value, const common::KeyValueIterable &attributes) noexcept = 0

Add adds the value to the counter’s sum. The attributes should contain the keys and values to be associated with this value. Counters only accept positive valued updates.

Parameters:
  • value – The increment amount. MUST be non-negative.

  • attributes – the set of attributes, as key-value pairs

virtual void Add(T value, const common::KeyValueIterable &attributes, const context::Context &context) noexcept = 0
template<class U, nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value>* = nullptr>
inline void Add(T value, const U &attributes) noexcept
template<class U, nostd::enable_if_t<common::detail::is_key_value_iterable<U>::value>* = nullptr>
inline void Add(T value, const U &attributes, const context::Context &context) noexcept
inline void Add(T value, std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes) noexcept
inline void Add(T value, std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>> attributes, const context::Context &context) noexcept