Add API metric collection

This commit is contained in:
Kevin Kandlbinder 2022-03-01 14:15:03 +01:00
parent ff7339d88f
commit 801cf8d84c
3 changed files with 10 additions and 0 deletions

View file

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"errors"
chiprometheus "github.com/766b/chi-prometheus"
"github.com/go-chi/chi/v5"
"net/http"
"strings"
@ -12,6 +13,9 @@ import (
func SetupAPI() chi.Router {
router := chi.NewRouter()
m := chiprometheus.NewMiddleware("api")
router.Use(m)
router.NotFound(notFoundHandler)
router.MethodNotAllowed(methodNotAllowedHandler)