createCounter#

Fully qualified name: omni::observability::createCounter

Defined in omni/observability/IMetrics.h

template<class ValueType>
carb::ObjectPtr<ICounter<ValueType>> omni::observability::createCounter(
const carb::ObjectPtr<IMeter> &meter,
carb::cpp::string_view name,
carb::cpp::string_view description,
carb::cpp::string_view unit = "",
)#

Create a counter instrument with the specified ValueType.

Remark

This is a convenience namespace-scope function template that is implemented in terms of the corresponding IMeter member function template. The meter argument is permitted to be null, in which case a null instrument pointer is returned.

Remark

Namespace-scope instrument manipulators (e.g. add) defined further down can be called with a null instrument pointer.

Parameters:
  • meter[in] The meter to create the counter with.

  • name[in] The name of the counter instrument.

  • description[in] A description of what the counter measures.

  • unit[in] The unit of measurement (e.g., “bytes”, “requests”).

Returns:

An carb::ObjectPtr to the created counter, or nullptr on failure.