BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlm::MetricsRegistry Class Reference

#include <bdlm_metricsregistry.h>

Public Types

typedef MetricsAdapter::Callback Callback
 
typedef MetricsAdapter::CallbackHandle CallbackHandle
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (MetricsRegistry, bslma::UsesBslmaAllocator)
 
 MetricsRegistry (bslma::Allocator *basicAllocator=0)
 
 ~MetricsRegistry ()
 
void registerCollectionCallback (MetricsRegistryRegistrationHandle *result, const bdlm::MetricDescriptor &descriptor, const Callback &callback)
 
void removeMetricsAdapter (MetricsAdapter *adapter)
 
void setMetricsAdapter (MetricsAdapter *adapter)
 
int numRegisteredCollectionCallbacks () const
 Return the number of registered metrics collection callbacks.
 
bslma::Allocatorallocator () const
 Return the allocator used by this object to supply memory.
 

Static Public Member Functions

static MetricsRegistrydefaultInstance ()
 Return a non-const reference to the metrics registry singleton.
 

Detailed Description

This class implements a mechanism that provides a registry of metrics that is transferable to implementations of the bdlm::MetricsAdapter protocol. This class is usually a singleton.

See bdlm_metricsregistry

Member Typedef Documentation

◆ Callback

◆ CallbackHandle

Constructor & Destructor Documentation

◆ MetricsRegistry()

bdlm::MetricsRegistry::MetricsRegistry ( bslma::Allocator basicAllocator = 0)
explicit

Create a MetricsRegistry object that stores the information necessary to forward the registration and unregistration of metrics to an adapter supplied with setMetricsRegistry. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ ~MetricsRegistry()

bdlm::MetricsRegistry::~MetricsRegistry ( )

Unregister all registered metrics and destroy this MetricsRegistry object.

Member Function Documentation

◆ allocator()

bslma::Allocator * bdlm::MetricsRegistry::allocator ( ) const

◆ BSLMF_NESTED_TRAIT_DECLARATION()

bdlm::MetricsRegistry::BSLMF_NESTED_TRAIT_DECLARATION ( MetricsRegistry  ,
bslma::UsesBslmaAllocator   
)

◆ defaultInstance()

static MetricsRegistry & bdlm::MetricsRegistry::defaultInstance ( )
static

◆ numRegisteredCollectionCallbacks()

int bdlm::MetricsRegistry::numRegisteredCollectionCallbacks ( ) const

◆ registerCollectionCallback()

void bdlm::MetricsRegistry::registerCollectionCallback ( MetricsRegistryRegistrationHandle result,
const bdlm::MetricDescriptor descriptor,
const Callback callback 
)

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. 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 objects 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). 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.

◆ removeMetricsAdapter()

void bdlm::MetricsRegistry::removeMetricsAdapter ( MetricsAdapter adapter)

If the specified adapter is the currently associated registrar, remove all registered metrics from it and disassociate the registry. Note that this operation takes an adapter to disambiguate multiple, potentially concurrent, calls to this method and setMetricsAdapter.

◆ setMetricsAdapter()

void bdlm::MetricsRegistry::setMetricsAdapter ( MetricsAdapter adapter)

Configure this metrics registry to register all metrics collection callbacks with the specified adapter. This operation first, if there is already an associated metrics adapter, unregisters all the collection callbacks from that adapter, then registers the collection callbacks with the new adapter.


The documentation for this class was generated from the following file: