INNER CODE UNIT · Python

health_endpoint

pab1it0/prometheus-mcp-server · src/prometheus_mcp_server/server.py:35

async def health_endpoint(request: Request) -> JSONResponse:
    return JSONResponse({"status": "ok"})

# Cache for metrics list to improve completion performance
_metrics_cache = {"data": None, "timestamp": 0}
_CACHE_TTL = 300  # 5 minutes

def clear_metrics_cache():
    """Reset the metrics cache, forcing the next fetch to hit Prometheus."""
    _metrics_cache["data"] = None
    _metrics_cache["timestamp"] = 0

# Get logger instance
logger = get_logger()

# Health check tool for Docker containers and monitoring
@mcp.tool(
    name=_tool_name("health_check"),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…