add most basic healthcheck possible (#13)
This commit is contained in:
parent
e061ed0634
commit
9fd68b41e8
|
@ -24,6 +24,10 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
writeBody(w, rootHTML)
|
writeBody(w, rootHTML)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func healthHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
writeBody(w, "OK")
|
||||||
|
}
|
||||||
|
|
||||||
func writeBody(w io.Writer, body string) {
|
func writeBody(w io.Writer, body string) {
|
||||||
if _, err := w.Write([]byte(body)); err != nil {
|
if _, err := w.Write([]byte(body)); err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
|
1
main.go
1
main.go
|
@ -45,6 +45,7 @@ func main() {
|
||||||
parseFlags()
|
parseFlags()
|
||||||
|
|
||||||
http.HandleFunc(metricsPath, metricsHandler(*ipcPathFlag))
|
http.HandleFunc(metricsPath, metricsHandler(*ipcPathFlag))
|
||||||
|
http.HandleFunc("/health", healthHandler)
|
||||||
http.HandleFunc("/", rootHandler)
|
http.HandleFunc("/", rootHandler)
|
||||||
|
|
||||||
listenAddress := fmt.Sprintf("%s:%d", *hostFlag, *portFlag)
|
listenAddress := fmt.Sprintf("%s:%d", *hostFlag, *portFlag)
|
||||||
|
|
Loading…
Reference in New Issue