diff --git a/prometheus/exporter.py b/prometheus/exporter.py index ba9087d..7b4c811 100644 --- a/prometheus/exporter.py +++ b/prometheus/exporter.py @@ -5,6 +5,8 @@ from subprocess import check_call from prometheus_client import start_http_server, Gauge, Enum import requests +import threading +import sys class AppMetrics: @@ -37,6 +39,10 @@ def run_metrics_loop(self): """Metrics fetching loop""" while True: + if threading.active_count() != 2: + print(f"Unexpected threadcount: {threading.active_count()}, so exit the program") + sys.exit(1) + self.fetch() time.sleep(self.polling_interval_seconds)