add chi metrics middleware.

This commit is contained in:
Miroslav Šedivý 2022-06-15 00:22:27 +02:00
parent 5b7784f2a4
commit 0952be6a94
5 changed files with 162 additions and 0 deletions

View file

@ -5,6 +5,8 @@ import (
"errors"
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
"gitlab.com/demodesk/neko/server/internal/api/members"
"gitlab.com/demodesk/neko/server/internal/api/room"
"gitlab.com/demodesk/neko/server/pkg/auth"
@ -62,6 +64,11 @@ func (api *ApiManagerCtx) Route(r types.Router) {
_, err := w.Write([]byte("true"))
return err
})
r.Get("/metrics", func(w http.ResponseWriter, r *http.Request) error {
promhttp.Handler().ServeHTTP(w, r)
return nil
})
}
func (api *ApiManagerCtx) Authenticate(w http.ResponseWriter, r *http.Request) (context.Context, error) {