Register the metric described by the specified descriptor and associate it with the specified callback to collect data from the metric, and load the specified result with a handle can be used later to unregister the metric. Return 0 on success, and a non‐zero value otherwise. After this operation completes, result‐>isRegistered() will be true. The metric and associated callback remain registered with this registry until either the handle is unregistered or destroyed. When a MetricsAdapter is associated with this registry using setMetricsAdapter, this object registers all the registered metrics and callbacks with that adapter, and similarly unregisters them if the MetricAdapter is later disassociated with this registry (either on this objects destruction, or due to a call to removeMetricsAdapter or setMetricsAdapter). Furthermore, metrics collection can be disable with disableMetricsCollection and enabled with enableMetricsCollection. In this way, a MetricsRegistry serves as an intermediary between users of bdlm that register metrics and the subsystem for collecting and publishing metrics being adapted by a concrete instance of bdlm::MetricAdapter.

Synopsis

Declared in <bdlm_metricsregistry.h>

int
registerCollectionCallback(
    MetricsRegistryRegistrationHandle* result,
    bdlm::MetricDescriptor const& descriptor,
    Callback const& callback);

Created with MrDocs