ICounter#

Fully qualified name: omni::observability::ICounter

Defined in omni/observability/IMetrics.h

template<class ValueType_>
class ICounter : public carb::IObject#

Counter instrument for monotonically increasing values.

Remark

Counters are used to measure values that only increase over time, such as request counts, bytes processed, or errors encountered. Values added to a counter must be non-negative.

Public Types

using ValueType = ValueType_#

The value type for this counter (e.g., std::uint64_t or double).

Public Functions

virtual ~ICounter() = default#
virtual void addArr(
ValueType value,
const Attribute attributes[],
std::size_t attributeCount,
) noexcept = 0#

Add a value to the counter with attributes.

Parameters:
  • value[in] The value to add to the counter. Must be non-negative.

  • attributes[in] Array of attributes to associate with this measurement.

  • attributeCount[in] Number of attributes in the array.

template<class T, class ...A>
inline void add(
T value,
A&&... a,
) noexcept#

Add a value to the counter with variadic attributes.

Parameters:
  • value[in] The value to add to the counter. Must be non-negative.

  • a[in] Variadic list of attributes to associate with this measurement.

template<class T>
inline void add(
T value,
std::initializer_list<Attribute> attributes,
) noexcept#

Add a value to the counter with initializer list of attributes.

Parameters:
  • value[in] The value to add to the counter. Must be non-negative.

  • attributes[in] Initializer list of attributes to associate with this measurement.

virtual size_t addRef() = 0#

Atomically add one to the reference count.

Returns:

The current reference count after one was added, though this value may change before read if other threads are also modifying the reference count. The return value is guaranteed to be non-zero.

virtual size_t release() = 0#

Atomically subtracts one from the reference count.

If the result is zero, carb::deleteHandler() is called for this.

Returns:

The current reference count after one was subtracted. If zero is returned, carb::deleteHandler() was called for this.

Public Static Functions

static inline constexpr carb::InterfaceDesc getInterfaceDesc(
) noexcept#

Returns information about this interface.

Auto-generated by CARB_PLUGIN_INTERFACE() or CARB_PLUGIN_INTERFACE_EX.

Returns:

The carb::InterfaceDesc struct with information about this interface.

static inline constexpr carb::InterfaceDesc getLatestInterfaceDesc(
) noexcept#

Returns information about the latest version of this interface.

Auto-generated by CARB_PLUGIN_INTERFACE() or CARB_PLUGIN_INTERFACE_EX.

Returns:

The carb::InterfaceDesc struct with information about the latest version of this interface.