createObservableCounter#

Fully qualified name: omni::observability::createObservableCounter

Defined in omni/observability/IMetrics.h

template<class ValueType>
carb::ObjectPtr<IObservableInstrument> omni::observability::createObservableCounter(
const carb::ObjectPtr<IMeter> &meter,
ObservableInstrumentCallback<ValueType> callback,
void *context,
carb::cpp::string_view name,
carb::cpp::string_view description,
carb::cpp::string_view unit = "",
)#

Create an observable 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.

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

  • callback[in] The callback function to invoke for sampling the counter value.

  • context[in] User-defined context passed to the callback.

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

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

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

Returns:

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