mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-19 03:54:06 -08:00
17 lines
434 B
TypeScript
17 lines
434 B
TypeScript
|
function metricToSeriesName(labels: {[key: string]: string}): string {
|
||
|
if (labels === null) {
|
||
|
return 'scalar';
|
||
|
}
|
||
|
let tsName = (labels.__name__ || '') + '{';
|
||
|
let labelStrings: string[] = [];
|
||
|
for (let label in labels) {
|
||
|
if (label !== '__name__') {
|
||
|
labelStrings.push(label + '="' + labels[label] + '"');
|
||
|
}
|
||
|
}
|
||
|
tsName += labelStrings.join(', ') + '}';
|
||
|
return tsName;
|
||
|
};
|
||
|
|
||
|
export default metricToSeriesName;
|