Skip to content

Commit

Permalink
feat: healthz & readyz endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: zufardhiyaulhaq <[email protected]>
  • Loading branch information
zufardhiyaulhaq committed Jun 10, 2024
1 parent 9806981 commit 57aed01
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ func main() {

prometheus.MustRegister(collectorHandler)
http.Handle("/metrics", promhttp.Handler())
http.Handle("/healthz", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("OK"))
}))
http.Handle("/readyz", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("OK"))
}))

err = http.ListenAndServe(":"+strconv.Itoa(settings.Port), nil)
log.Fatal(err)
Expand Down

0 comments on commit 57aed01

Please sign in to comment.