[#BloombergLP-balm-MetricsManager-collectSample-0c] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balm.adoc[balm]::xref:BloombergLP/balm/MetricsManager.adoc[MetricsManager]::collectSample :relfileprefix: ../../../ :mrdocs: `collectSample` overloads == Synopses Declared in `<balm_metricsmanager.h>` Load into the specified `sample` a metric sample collected from the indicated categories, and append to `records` those collected records which are referred to by `sample`. Optionally specify a sequence of `categories` of length `numCategories`. If a sequence of categories is not supplied, a sample is collected from all registered categories. Optionally specify a `resetFlag` that determines if the collected metrics are reset as part of this operation. This operation will collect aggregated metric values for each _enabled_ category in the indicated categories from registered callbacks as well as from its own `CollectorRepository`, and then append those values to `records` and update `sample` with the addresses of those collected `records`. If `resetFlag` is `true`, the metrics being collected are reset to their default state. This operation also populates the `sample` with the time interval is computed as the elapsed time since the interval over which the sampled metrics were collected. This last time the metrics were reset (either through a call to the `publish` or `collectSample` methods). If `category` has not previously been reset then this interval is taken to be the elapsed time since the creation of this metrics manager. The behavior is undefined unless `0 <= numCategories`, `categories` refers to a contiguous sequence of (at least) `numCategories`, and each category in `categories` appears only once. Note that `sample` is loaded with the _addresses_ of the metric records appended to `records`, and modifying `records` after this call returns may invalidate `sample`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void xref:BloombergLP/balm/MetricsManager/collectSample-01.adoc[collectSample]( xref:BloombergLP/balm/MetricSample.adoc[MetricSample]* sample, xref:bsl/vector-00d.adoc[bsl::vector<MetricRecord>]* records, bool resetFlag = false); ---- [.small]#xref:BloombergLP/balm/MetricsManager/collectSample-01.adoc[_» more..._]# Same as the preceding overload, collecting from the specified `categories` sequence. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- void xref:BloombergLP/balm/MetricsManager/collectSample-06.adoc[collectSample]( xref:BloombergLP/balm/MetricSample.adoc[MetricSample]* sample, xref:bsl/vector-00d.adoc[bsl::vector<MetricRecord>]* records, xref:BloombergLP/balm/Category.adoc[Category] const const* categories[], int numCategories, bool resetFlag = false); ---- [.small]#xref:BloombergLP/balm/MetricsManager/collectSample-06.adoc[_» more..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#