mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
13 lines
348 B
TypeScript
13 lines
348 B
TypeScript
import { escapeString } from "./escapeString";
|
|
|
|
export const formatSeries = (labels: { [key: string]: string }): string => {
|
|
if (labels === null) {
|
|
return "scalar";
|
|
}
|
|
|
|
return `${labels.__name__ || ""}{${Object.entries(labels)
|
|
.filter(([k]) => k !== "__name__")
|
|
.map(([k, v]) => `${k}="${escapeString(v)}"`)
|
|
.join(", ")}}`;
|
|
};
|