|
BDE 4.14.0 Production release
|
Provide a registry for metrics.
This component defines a class, balm::MetricRegistry, that provides operations to register both metric categories and individual metrics. A metric is uniquely identified by its name and category, and the metric registry provides a mapping from those identifying properties to a balm::MetricId. A balm::MetricRegistry object also provides a mapping from a category name to the address of a non-modifiable balm::Category object.
Bloomberg software may alternatively use the GUTS telemetry API, which is integrated into Bloomberg infrastructure.
balm::MetricRegistry is fully thread-safe, meaning that all non-creator operations on a given object can be safely invoked simultaneously from multiple threads.
This section illustrates intended use of this component.
The following example illustrates how to create and use a balm::MetricRegistry. We start by creating a balm::MetricRegistry object, registry, and then using this registry to create a balm::MetricId for a metric named "MetricA" belonging to the category "MyCategory" (i.e., "MyCategory.MetricA").
Now that we have added a metric id, "MyCategory.MetricA", attempting to add the metric id again will return an invalid id. We retrieve the same identifier we have created using either getId or findId:
We use the getId method to add a new metric to the registry, then verify we can lookup the metric:
Next we use getCategory to find the address of the balm::Category object corresponding to "MyCategory":
Finally we use the setCategoryEnabled method to disable the category "MyCategory":