From ed6b9bd568f04d90ffa4709d38b3535d83981125 Mon Sep 17 00:00:00 2001 From: Rhys Bailey Date: Mon, 6 Mar 2023 15:45:55 +1100 Subject: [PATCH] refactor --- prometheus_frigate_exporter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prometheus_frigate_exporter.py b/prometheus_frigate_exporter.py index a7f1b10..87fdb5f 100644 --- a/prometheus_frigate_exporter.py +++ b/prometheus_frigate_exporter.py @@ -20,7 +20,7 @@ def add_metric(metric, label, stats, key, multiplier=1.0): class CustomCollector(object): def __init__(self, _url): - self.url = _url + self.stats_url = _url self.process_stats = {} def add_metric_process(self, metric, stats, camera_name, pid_name, process_name, cpu_or_memory, process_type): @@ -33,7 +33,7 @@ class CustomCollector(object): pass def collect(self): - stats = json.loads(urlopen(self.url).read()) + stats = json.loads(urlopen(self.stats_url).read()) self.process_stats = stats['cpu_usages'] # process stats for cameras, detectors and other