MCPcopy
hub / github.com/prometheus/client_js / flattenSharedLabels

Function flattenSharedLabels

lib/registry.js:217–227  ·  view source on GitHub ↗
(labels)

Source from the content-addressed store, hash-verified

215
216const sharedLabelCache = new WeakMap();
217function flattenSharedLabels(labels) {
218 const cached = sharedLabelCache.get(labels);
219 if (cached) {
220 return cached;
221 }
222
223 const formattedLabels = formatLabels(labels);
224 const flattened = formattedLabels.join(',');
225 sharedLabelCache.set(labels, flattened);
226 return flattened;
227}
228function escapeLabelValue(str) {
229 if (typeof str !== 'string') {
230 return str;

Callers 1

getMetricsAsStringMethod · 0.85

Calls 3

formatLabelsFunction · 0.85
setMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected