BDE 4.14.0 Production release
|
#include <balm_bdlmmetricsadapter.h>
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION (BdlmMetricsAdapter, bslma::UsesBslmaAllocator) | |
BdlmMetricsAdapter (MetricsManager *metricsManager, const bsl::string_view &metricNamespace, const bsl::string_view &objectIdentifierPrefix, bslma::Allocator *basicAllocator=0) | |
~BdlmMetricsAdapter () BSLS_KEYWORD_OVERRIDE | |
Destroy this BdlmMetricsAdapter object. | |
CallbackHandle | registerCollectionCallback (const bdlm::MetricDescriptor &metricDescriptor, const Callback &callback) BSLS_KEYWORD_OVERRIDE |
int | removeCollectionCallback (const CallbackHandle &handle) BSLS_KEYWORD_OVERRIDE |
const bsl::string & | defaultMetricNamespace () const |
const bsl::string & | defaultObjectIdentifierPrefix () const |
bslma::Allocator * | allocator () const |
Return the allocator used by this object to supply memory. | |
Public Member Functions inherited from bdlm::MetricsAdapter | |
virtual | ~MetricsAdapter ()=0 |
Destroy this MetricsAdapter . | |
Additional Inherited Members | |
Public Types inherited from bdlm::MetricsAdapter | |
typedef int | CallbackHandle |
typedef bsl::function< void(Metric *)> | Callback |
This class implements a pure abstract interface for clients and suppliers of metrics adapters. The implementation registers callbacks with a provided balm::MetricsManager
to enable monitoring of statistics collection objects.
|
inline |
Create a BdlmMetricsAdapter
object that uses the specified metricsManager
to register and unregister collection callback functors, the specified metricNamespace
as the value returned by defaultNamespace()
, and the specified objectIdentifierPrefix
as the value returned by defaultObjectIdentifierPrefix
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
balm::BdlmMetricsAdapter::~BdlmMetricsAdapter | ( | ) |
|
inline |
balm::BdlmMetricsAdapter::BSLMF_NESTED_TRAIT_DECLARATION | ( | BdlmMetricsAdapter | , |
bslma::UsesBslmaAllocator | |||
) |
|
inline |
Return the namespace attribute value to be used as the default value for MetricDescriptor
instances.
|
inline |
Return a string to be used as the default prefix for a MetricDescriptor
object identifier attribute value.
|
virtual |
Register the specified callback
with the metrics manager specified at construction, using the specified metricDescriptor
. If metricDescriptor.metricsNamspace()
equals bdlm::MetricDescriptor::k_USE_METRICS_ADAPTER_NAMESPACE_SELECTION
, use defaultMetricNamespace()
for the namespace attribute during registration. If metricDescriptor.objectIdentifier()
equals bdlm::MetricDescriptor::k_USE_METRICS_ADAPTER_OBJECT_ID_SELECTION
, use the concatination of defaultObjectIdentifierPrefix()
, a period, metricDescriptor.objectTypeAbbreviation()
, a period, and metricDescriptor.instanceNumber()
for the object identifier attribute during registration. The category name supplied to the MetricsManager
provided at construction is the concatenation of the object type name attribute, a period, the metric name attribute, a period, and the object identifier attribute. Return the callback handle to be used with removeCollectionCallback
.
Implements bdlm::MetricsAdapter.
|
inlinevirtual |
Remove the callback associated with the specified handle
. Return 0 on success, or a non-zero value if handle
cannot be found.
Implements bdlm::MetricsAdapter.