Include job name in metric group name
This commit is contained in:
parent
e3b42b0725
commit
28b5270426
1 changed files with 3 additions and 2 deletions
|
@ -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']}")
|
||||
|
|
Loading…
Reference in a new issue