[#BloombergLP-balm-MetricRegistry] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balm.adoc[balm]::MetricRegistry :relfileprefix: ../../ :mrdocs: This class defines a thread‐aware mechanism for registering metrics and metric categories. == Synopsis Declared in `<balm_metricregistry.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class MetricRegistry; ---- == Description 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. == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/balm/MetricRegistry/2constructor.adoc[`MetricRegistry`] [.small]#[constructor]# | Create an empty metric registry. | xref:BloombergLP/balm/MetricRegistry/2destructor.adoc[`~MetricRegistry`] [.small]#[destructor]# | Destroy this metric registry. | xref:BloombergLP/balm/MetricRegistry/addCategory.adoc[`addCategory`] | Add `category` to this registry unless it is already registered. | xref:BloombergLP/balm/MetricRegistry/addId.adoc[`addId`] | Add a metric id for `category` and `name` if not already registered. | xref:BloombergLP/balm/MetricRegistry/createUserDataKey.adoc[`createUserDataKey`] | Return a new unique key for associating user data with metrics. | xref:BloombergLP/balm/MetricRegistry/findCategory.adoc[`findCategory`] | Find the registered category named `category`. | xref:BloombergLP/balm/MetricRegistry/findId.adoc[`findId`] | Find the metric id for `category` and `name` in this registry. | xref:BloombergLP/balm/MetricRegistry/getAllCategories.adoc[`getAllCategories`] | Append to the specified `categories` the addresses of all the categories registered by this `balm::MetricRegistry` object. | xref:BloombergLP/balm/MetricRegistry/getCategory.adoc[`getCategory`] | Return the category for `category`, registering it if needed. | xref:BloombergLP/balm/MetricRegistry/getId.adoc[`getId`] | Return a metric id for `category` and `name`, registering if needed. | xref:BloombergLP/balm/MetricRegistry/numCategories.adoc[`numCategories`] | Return the number of categories in this registry. | xref:BloombergLP/balm/MetricRegistry/numMetrics.adoc[`numMetrics`] | Return the number of metrics in this registry. | xref:BloombergLP/balm/MetricRegistry/print.adoc[`print`] | Format this object to the specified output `stream`. | xref:BloombergLP/balm/MetricRegistry/registerCategoryHolder.adoc[`registerCategoryHolder`] | Register `holder` with `category` in this registry. | xref:BloombergLP/balm/MetricRegistry/setAllCategoriesEnabled.adoc[`setAllCategoriesEnabled`] | Set the enabled state of all categories to `value`. | xref:BloombergLP/balm/MetricRegistry/setCategoryEnabled.adoc[`setCategoryEnabled`] | Set whether `category` is enabled to `value`. | xref:BloombergLP/balm/MetricRegistry/setFormat.adoc[`setFormat`] | Set the format for `metricId` to `format`. | xref:BloombergLP/balm/MetricRegistry/setPreferredPublicationType.adoc[`setPreferredPublicationType`] | Set the preferred publication type of `metric` to `type`. | xref:BloombergLP/balm/MetricRegistry/setUserData-0b.adoc[`setUserData`] | `setUserData` overloads | xref:BloombergLP/balm/MetricRegistry/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<MetricRegistry, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#