|
BDE 4.14.0 Production release
|
Provide a concrete instance of the bdlm metrics adapter.
This component provides a concrete instance, balm::BdlmMetricsAdapter, of the bdlm::MetricsAdapter protocol, enabling registration of metric collection callbacks with a provided balm::MetricsManager. balm::BdlmMetricsAdapter also provides methods to aid in population of default bdlm::MetricDescriptor attribute values.
This class is thread-aware (see {bsldoc_glossary |Thread-Aware}).
This section illustrates intended use of this component.
This example demonstrates the initialization and usage of the balm::BdlmMetricsAdapter object, allowing for registering metric callback functions with the balm monitoring system.
First, we provide a metric function to be used during callback registration with the balm monitoring system:
Then, we construct a balm::MetricsManager object and use it to construct a balm::BdlmMetricsAdapter that will use "bdlm" as its default metric namespace, "svc" as its default object indentifier prefix, and will not attempt to set itself as the default metrics adapter:
Next, we construct a bdlm::MetricsDescriptor object to be used when registering the callback function, using constants from bdlm::MetricDescriptor for the namespace and identifier to indicate the implementation of the bdlm::MetricsAdapter protocol should supply values:
Now, we register the collection callback:
Finally, presumably during shutdown of the application, we remove the callback from the monitoring system, and verify the callback was successfully removed: