[#BloombergLP-balm-MetricRegistry-setUserData-00] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balm.adoc[balm]::xref:BloombergLP/balm/MetricRegistry.adoc[MetricRegistry]::setUserData :relfileprefix: ../../../ :mrdocs: Associate `value` with `key` on metrics matching `categoryName`. == Synopsis Declared in `<balm_metricregistry.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void setUserData( char const* categoryName, xref:BloombergLP/balm/MetricDescription/UserDataKey.adoc[MetricDescription::UserDataKey] key, void const* value, bool prefixFlag = false); ---- == Description Associate the specified `value` with the specified `key` in any metric belonging to a category having the specified `categoryName`, or a category whose name begins with `categoryName`, as determined by the optionally specified `prefixFlag`. If `prefixFlag` is `false` or is not specified, only those metrics belonging to a category having `categoryName` will be mapped; otherwise, `value` will be associated with `key` for all metrics belonging to any category whose name begins with `categoryName`. This association applies to existing metrics as well as any subsequently created ones. When a metric is created that matches more than one registered category prefix, it is not specified which supplied value will be associated with `key`, unless only one of those values is non‐null, in which case the unique non‐null value is used. The behavior is undefined unless `key` was previously returned from `createUserDataKey`. == Parameters [cols="1,4"] |=== | Name| Description | *categoryName* | category name, or prefix when `prefixFlag` is true | *key* | user‐data key previously obtained from `createUserDataKey` | *value* | opaque user‐data value to associate | *prefixFlag* | if true, match categories by name prefix |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#