MCPcopy Index your code
hub / github.com/prometheus/client_js / addSumAndCountForExport

Function addSumAndCountForExport

lib/histogram.js:310–340  ·  view source on GitHub ↗
(histogram)

Source from the content-addressed store, hash-verified

308}
309
310function addSumAndCountForExport(histogram) {
311 return (acc, d) => {
312 acc.push(...d.buckets);
313
314 const infLabel = { le: '+Inf' };
315 acc.push(
316 setValuePair(
317 infLabel,
318 d.data.count,
319 `${histogram.name}_bucket`,
320 d.data.bucketExemplars ? d.data.bucketExemplars['-1'] : null,
321 d.data.labels,
322 ),
323 setValuePair(
324 {},
325 d.data.sum,
326 `${histogram.name}_sum`,
327 undefined,
328 d.data.labels,
329 ),
330 setValuePair(
331 {},
332 d.data.count,
333 `${histogram.name}_count`,
334 undefined,
335 d.data.labels,
336 ),
337 );
338 return acc;
339 };
340}
341
342function splayLabels(bucket) {
343 const { sharedLabels, labels, ...newBucket } = bucket;

Callers 1

getForPromStringMethod · 0.85

Calls 2

setValuePairFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected