"""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_configured_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 = 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))

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()
