From 28b527042659f405330f44576e5aa2b375ec9ce8 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Thu, 29 Dec 2022 16:12:30 +0200 Subject: [PATCH] Include job name in metric group name --- restic_exporter/restic_exporter.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/restic_exporter/restic_exporter.py b/restic_exporter/restic_exporter.py index 1f30793..d3f4efd 100644 --- a/restic_exporter/restic_exporter.py +++ b/restic_exporter/restic_exporter.py @@ -25,6 +25,7 @@ class restic_exporter: self._init_log() self.metric_name = metric_name.replace(' ', '_') + self.job_name = job_name.replace(' ', '_') self.metric_description = metric_description self.labels= {"job_name": job_name} @@ -54,8 +55,8 @@ class restic_exporter: 'total_bytes_processed', 'total_duration' ] - print(f"# HELP {self.metric_name} {self.metric_description}.") - print(f"# TYPE {self.metric_name} counter") + print(f"# HELP {self.metric_name}_{self.job_name} {self.metric_description}.") + print(f"# TYPE {self.metric_name}_{self.job_name} counter") for counter in counters: if counter in self.summary: print(f"{self.metric_name}_{counter}{labels} {float(self.summary[counter])}") # {self.summary['timestamp']}")