2
0

stats: fix prometheus label quoting

This commit is contained in:
Stefan Bühler 2023-11-15 17:35:05 +01:00
parent ef6fe53402
commit be7c7891bd

View File

@ -28,8 +28,8 @@ class MetricPrinter:
self._now_str = "" self._now_str = ""
labels = [] labels = []
if self.args.instance: if self.args.instance:
labels.append(f"instance={self.args.instance!r}") labels.append(f"instance=\"{self.args.instance}\"")
labels.append(f"interface={self.args.interface!r}") labels.append(f"interface=\"{self.args.interface}\"")
self._label_str = "{" + ",".join(labels) + "}" self._label_str = "{" + ",".join(labels) + "}"
def print_metric(self, *, name: str, mtype: str, value: typing.Any, help: str | None = None): def print_metric(self, *, name: str, mtype: str, value: typing.Any, help: str | None = None):