Skip to content
Snippets Groups Projects
Commit 9d5edc8d authored by ale's avatar ale
Browse files

Add simple liveness endpoint

parent 7ce6a809
No related branches found
No related tags found
No related merge requests found
Pipeline #62731 passed
......@@ -4,6 +4,7 @@ import (
"context"
"crypto/tls"
"flag"
"io"
"log"
"net"
"net/http"
......@@ -47,6 +48,7 @@ func main() {
mux := http.NewServeMux()
mux.Handle("/metrics", promhttp.Handler())
mux.HandleFunc("/health", livenessHandler)
src, err := uri.Source()
if err != nil {
......@@ -133,6 +135,10 @@ func buildListener() (net.Listener, error) {
return l, nil
}
func livenessHandler(w http.ResponseWriter, _ *http.Request) {
io.WriteString(w, "OK") // nolint:errcheck
}
// Instrumentation.
func instrumentedHandler(h http.Handler, name string, withRequestSize bool) http.Handler {
labels := prometheus.Labels{"handler": name}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment