Skip to content

Commit

Permalink
Add / handler for health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanlookpotts committed Nov 5, 2024
1 parent 8aa32a5 commit 596b486
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion robot/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,11 @@ func (svc *webService) initHTTPServer(listenerTCPAddr *net.TCPAddr, options webo
// Initialize multiplexer between http handlers.
func (svc *webService) initMux(options weboptions.Options) *goji.Mux {
mux := goji.NewMux()
mux.Handle(pat.New("/"), http.NotFoundHandler())
// Note: used by viam-agent for health checks
mux.HandleFunc(pat.New("/"), func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(200)
w.Write([]byte("healthy"))
})

if options.Pprof {
mux.HandleFunc(pat.New("/debug/pprof/"), pprof.Index)
Expand Down

0 comments on commit 596b486

Please sign in to comment.