Fix bug in exporter
Change-Id: I61dd306f8692dbf320a9dde852f52bf9185cae4b
diff --git a/exporter.py b/exporter.py
index bb8c2d0..ee8ce88 100644
--- a/exporter.py
+++ b/exporter.py
@@ -12,7 +12,7 @@
self.polling_interval_seconds = polling_interval_seconds
self.num_configured_devices = Gauge("num_configured_devices", "Number of configured devices")
- self.num_configured_devices = Gauge("num_reachable_devices", "Number of reachable devices")
+ self.num_reachable_devices = Gauge("num_reachable_devices", "Number of reachable devices")
def run_metrics_loop(self):
while True:
@@ -21,10 +21,10 @@
def fetch(self):
resp = requests.get(url=f"http://localhost:{self.app_port}/devices")
- self.num_configured_devices = len(json.loads(resp.text))
+ self.num_configured_devices.set(len(json.loads(resp.text)))
resp = requests.get(url=f"http://localhost:{self.app_port}/devices/reachable")
- self.num_configured_devices = len(json.loads(resp.text))
+ self.num_reachable_devices.set(len(json.loads(resp.text)))
def main():
polling_interval_seconds = int(os.getenv("POLLING_INTERVAL_SECONDS", "5"))