From ff38670c315a701365f5c9aad1554fcb7e2d7c9f Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Wed, 6 May 2026 10:58:19 +0200 Subject: [PATCH] server: add health endpoint to metrics listener There are already facilities to run the metrics listener on a fixed port, so this makes for a useful endpoint to have metrics and a health check in Kubernetes without exposing them to the world. In the long run, I would like to remove the metrics endpoint from the public listener, but that will take more work. --- server/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/server.go b/server/server.go index 4bbf350ef80e2e9e949fcd1541ca2e559dc4001c..326a13f8e72efc96948a1a95b1b6eb542871f401 100644 --- a/server/server.go +++ b/server/server.go @@ -438,6 +438,9 @@ func (server *Server) Run() { mux := &http.ServeMux{} mux.Handle("/metrics", promhttp.Handler()) + mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { + w.Write([]byte("OK")) + }) pserver := &http.Server{Handler: mux} plisten, err := net.Listen("tcp", server.metricsAddr) if err != nil {