[#BloombergLP-balm-ConfigurationUtil-setFormatSpec]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balm.adoc[balm]::xref:BloombergLP/balm/ConfigurationUtil.adoc[ConfigurationUtil]::setFormatSpec
:relfileprefix: ../../../
:mrdocs:

Set the format specification for one aggregate of a metric&period;

== Synopsis

Declared in `&lt;balm&lowbar;configurationutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
setFormatSpec(
    char const* category,
    char const* metricName,
    xref:BloombergLP/balm/PublicationType/Value.adoc[PublicationType::Value] publicationType,
    xref:BloombergLP/balm/MetricFormatSpec.adoc[MetricFormatSpec] const& formatSpec,
    xref:BloombergLP/balm/MetricsManager.adoc[MetricsManager]* manager = 0);
----

== Description

Set the format specification for the metric aggregate indicated by the specified `category`, `metricName`, and `publicationType` to the specified `formatSpec`&period; Optionally specify a metrics `manager` to configure&period; If `manager` is 0, configure the default metrics manager&semi; if `manager` is 0 and the default metrics manager has not been initialized, this method has no effect&period; Return 0 on success, or a non&hyphen;zero value if `manager` is 0 and the default metrics manager has not been initialized&period; If a `MetricId` does not exist for `category` and `metricName`, create one and add it to the metric registry of the indicated metrics manager&period; For example a publication type of `e&lowbar;AVG`, and a format spec with a scale of 1000&period;0 and a format of &quot;%&period;2f ms&quot;, indicates that the average value of the indicated metric should be formatted by scaling the value by 1000 and then rounding the value to the second decimal place and appending &quot; ms&quot;&period;

== Return Value

0 on success, or a non&hyphen;zero value if `manager` is 0 and the default metrics manager has not been initialized

== Parameters

[cols="1,4"]
|===
| Name| Description
| *category*
| category of the metric to format
| *metricName*
| name of the metric to format
| *publicationType*
| publication aggregate whose format is set
| *formatSpec*
| format specification to apply
| *manager*
| metrics manager to configure&semi; 0 uses the default
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
