Skip to content

Commit 36bacba

Browse files
committed
add root handler for admin interface
1 parent da708e7 commit 36bacba

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/server/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"fmt"
5+
"io"
56
"net/http"
67
_ "net/http/pprof"
78
"os"
@@ -43,6 +44,13 @@ func main() {
4344

4445
// Admin and profiling server.
4546
go func() {
47+
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
48+
w.WriteHeader(http.StatusOK)
49+
_, err := io.WriteString(w, "consult metrics at /metrics")
50+
if err != nil {
51+
app.Logger.Err(err).Msg("failed to write admin response body")
52+
}
53+
})
4654
http.Handle("/metrics", promhttp.HandlerFor(app.PromRegistry, promhttp.HandlerOpts{
4755
ErrorLog: &app.Logger,
4856
ErrorHandling: promhttp.HTTPErrorOnError,

0 commit comments

Comments
 (0)