from prometheus_client import CollectorRegistry, generate_latest, Counter, disable_created_metrics, Gauge

disable_created_metrics()
# Prometheus metrics registry
registry = CollectorRegistry()

page_requests_counter = Counter(
    "spothole_page_requests",
    "Total number of page requests received",
    registry=registry,
)
api_requests_counter = Counter(
    "spothole_api_requests",
    "Total number of API requests received",
    registry=registry
)
spots_gauge = Gauge(
    "spothole_spots",
    "Number of spots currently in the software",
    registry=registry
)
alerts_gauge = Gauge(
    "spothole_alerts",
    "Number of alerts currently in the software",
    registry=registry
)
memory_use_gauge = Gauge(
    "spothole_memory_usage_bytes",
    "Current memory usage of the software in bytes",
    registry=registry
)


def get_metrics():
    """Get a Prometheus metrics response for the web server"""

    return generate_latest(registry)
