"""network-diag-app exporter"""

import os
import time
from prometheus_client import start_http_server, Gauge
import requests
import json

class Metrics:
    def __init__(self, app_port=3333, polling_interval_seconds=5):
        self.app_port = app_port
        self.polling_interval_seconds = polling_interval_seconds

        self.num_configured_devices = Gauge("num_configured_devices", "Number of configured devices")
        self.num_reachable_devices = Gauge("num_reachable_devices", "Number of reachable devices")

    def run_metrics_loop(self):
        while True:
            self.fetch()
            time.sleep(self.polling_interval_seconds)

    def fetch(self):
        resp = requests.get(url=f"http://localhost:{self.app_port}/devices")
        self.num_configured_devices.set(len(json.loads(resp.text)))

        resp = requests.get(url=f"http://localhost:{self.app_port}/devices/reachable")
        self.num_reachable_devices.set(len(json.loads(resp.text)))

def main():
    polling_interval_seconds = int(os.getenv("POLLING_INTERVAL_SECONDS", "5"))
    app_port = int(os.getenv("APP_PORT", "3333"))
    exporter_port = int(os.getenv("EXPORTER_PORT", "4444"))

    app_metrics = Metrics(
        app_port=app_port,
        polling_interval_seconds=polling_interval_seconds
    )
    start_http_server(exporter_port)
    app_metrics.run_metrics_loop()

if __name__ == "__main__":
    main()
