diff --git a/cmd/hw/main.go b/cmd/hw/main.go index 14fd41d..6398684 100644 --- a/cmd/hw/main.go +++ b/cmd/hw/main.go @@ -9,6 +9,7 @@ import ( "os" "github.com/prometheus/client_golang/prometheus/promhttp" + "mcquay.me/hw" "mcquay.me/metrics" ) @@ -53,12 +54,10 @@ func main() { code := codes[rand.Intn(len(codes))] w.WriteHeader(code) })) - http.HandleFunc("/live", m.WrapFunc("/live", ok)) - http.HandleFunc("/ready", m.WrapFunc("/ready", ok)) + http.HandleFunc("/live", m.WrapFunc("/live", hw.OK)) + http.HandleFunc("/ready", m.WrapFunc("/ready", hw.OK)) http.Handle("/metrics", promhttp.Handler()) if err := http.ListenAndServe(":8080", nil); err != nil { log.Fatalf("listen and serve: %v", err) } } - -func ok(w http.ResponseWriter, req *http.Request) {} diff --git a/cmd/hwc/main.go b/cmd/hwc/main.go index 60a57c3..e7dd9c4 100644 --- a/cmd/hwc/main.go +++ b/cmd/hwc/main.go @@ -10,6 +10,7 @@ import ( "time" "github.com/prometheus/client_golang/prometheus/promhttp" + "mcquay.me/hw" "mcquay.me/metrics" ) @@ -88,6 +89,9 @@ func main() { } })) + http.HandleFunc("/live", m.WrapFunc("/live", hw.OK)) + http.HandleFunc("/ready", m.WrapFunc("/ready", hw.OK)) + http.Handle("/metrics", promhttp.Handler()) if err := http.ListenAndServe(":8081", nil); err != nil { diff --git a/hw.go b/hw.go new file mode 100644 index 0000000..de991e1 --- /dev/null +++ b/hw.go @@ -0,0 +1,6 @@ +package hw + +import "net/http" + +// OK simply return 200 +func OK(w http.ResponseWriter, req *http.Request) {}