diff --git a/internal/server/handlers.go b/internal/server/handlers.go index b71d86a..6cebeec 100644 --- a/internal/server/handlers.go +++ b/internal/server/handlers.go @@ -39,6 +39,12 @@ func (genericHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.Error(w, "not found", http.StatusNotFound) } +type healthHandler struct{} + +func (healthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + _, _ = w.Write([]byte("OK")) +} + type bulkHandler struct { log logger.Logger metrics *trapmetrics.TrapMetrics diff --git a/internal/server/server.go b/internal/server/server.go index 1ef147a..2a76451 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -64,6 +64,7 @@ func New(cfg *config.Config) (*Server, error) { mux := http.NewServeMux() mux.Handle("/", genericHandler{}) + mux.Handle("/health", healthHandler{}) mux.Handle("/_bulk", http.TimeoutHandler(bulkHandler{ dest: cfg.Destination, log: logger.LogWrapper{