MCPcopy Create free account
hub / github.com/scality/cloudserver / parseMetric

Function parseMetric

tests/functional/report/monitoring.js:31–35  ·  view source on GitHub ↗
(metrics, name, labels)

Source from the content-addressed store, hash-verified

29 }
30
31 function parseMetric(metrics, name, labels) {
32 const labelsString = Object.entries(labels).map(e => `${e[0]}="${e[1]}"`).join(',');
33 const metric = metrics.match(new RegExp(`^${name}{${labelsString}} (.*)$`, 'm'));
34 return metric ? metric[1] : null;
35 }
36
37 function parseDuration(metrics, labels) {
38 const duration = parseMetric(metrics, 's3_cloudserver_http_request_duration_seconds_sum', labels);

Callers 2

parseDurationFunction · 0.70
parseRequestsCountFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected