BDE 4.14.0 Production release
|
Provide a representation of a metric category.
This component provides a class, balm::Category
, whose values are used to categorize collected metrics. A metric "category" is an identifier (chosen by the application) that groups together one or more metrics. A balm::Category
object contains the address of a string holding the name of the category and a boolean value indicating whether the category is currently enabled. The balm::Category
class suppresses copy construction and assignment, and does not provide equality operators; applications should use a single balm::Category
object instance per category (such as one provided by the *balm::MetricRegistry
* component).
IMPORTANT: The category name, whose type is const char *
, must remain constant and valid throughout the lifetime of the balm::Category
object.
Bloomberg software may alternatively use the GUTS telemetry API, which is integrated into Bloomberg infrastructure.
balm::Category
is generally const thread-safe, meaning that accessors may be invoked concurrently from different threads, but it is not safe to access or modify a balm::Category
in one thread while another thread modifies the same object. However, it is safe to access the enabled
property on one (or more) thread(s) while the object is being modified on another thread.
This section illustrates intended use of this component.
The following example demonstrates how to create, access, and modify a balm::Category
object. We start by creating three category objects with different names:
Once the category objects have been created, we can use the name
and enabled
methods to access their values:
Finally, we modify the enablement status of one of the categories, and then write all three categories to the console:
With the resulting console output: