feat(backend): add request latency tracking
This commit is contained in:
parent
0a012d75af
commit
c61186b22a
3 changed files with 14 additions and 0 deletions
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/go-chi/cors"
|
||||
"github.com/go-chi/httprate"
|
||||
"github.com/go-chi/render"
|
||||
chiprometheus "github.com/toshi0607/chi-prometheus"
|
||||
)
|
||||
|
||||
// Revision is the git commit, filled at build time
|
||||
|
@ -59,6 +60,12 @@ func New() (*Server, error) {
|
|||
MaxAge: 300,
|
||||
}))
|
||||
|
||||
// enable request latency tracking
|
||||
os.Setenv(chiprometheus.EnvChiPrometheusLatencyBuckets, "10,25,50,100,300,500,1000,5000")
|
||||
prom := chiprometheus.New("pronouns.cc")
|
||||
s.Router.Use(prom.Handler)
|
||||
prom.MustRegisterDefault()
|
||||
|
||||
// enable authentication for all routes (but don't require it)
|
||||
s.Router.Use(s.maybeAuth)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue