MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / humanizeThreshold

Function humanizeThreshold

tests/loadtest/tools/dashboard/app.js:1197–1210  ·  view source on GitHub ↗
(threshold)

Source from the content-addressed store, hash-verified

1195}
1196
1197function humanizeThreshold(threshold) {
1198 const metricName = threshold.metric || "";
1199 const rawLabel = threshold.label || "";
1200 const rule = rawLabel.startsWith(`${metricName} `) ? rawLabel.slice(metricName.length + 1) : rawLabel;
1201 const { baseMetric, tags } = parseMetricName(metricName);
1202 const metricLabel = humanizeMetricName(baseMetric);
1203 const ruleLabel = humanizeThresholdRule(rule, baseMetric);
1204 const tagLabel = humanizeMetricTags(tags);
1205 const cleanedRule =
1206 metricLabel.toLowerCase().endsWith("rate") && ruleLabel.startsWith("Rate ")
1207 ? ruleLabel.slice(5)
1208 : ruleLabel;
1209 return [metricLabel, cleanedRule, tagLabel ? `(${tagLabel})` : ""].filter(Boolean).join(" ");
1210}
1211
1212function parseMetricName(metricName) {
1213 const match = metricName.match(/^([^{}]+)(?:\{([^}]+)\})?$/);

Callers 1

renderThresholdsFunction · 0.85

Calls 4

parseMetricNameFunction · 0.85
humanizeMetricNameFunction · 0.85
humanizeThresholdRuleFunction · 0.85
humanizeMetricTagsFunction · 0.85

Tested by

no test coverage detected