feat: add sentry spans to evaluate proxy performances
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good

This commit is contained in:
2024-09-27 10:46:18 +02:00
parent 867e7c549f
commit 590505e17a
3 changed files with 42 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"forge.cadoles.com/Cadoles/go-proxy"
"forge.cadoles.com/Cadoles/go-proxy/wildcard"
"forge.cadoles.com/cadoles/bouncer/internal/cache"
bouncersentry "forge.cadoles.com/cadoles/bouncer/internal/sentry"
"forge.cadoles.com/cadoles/bouncer/internal/store"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
@ -257,6 +258,7 @@ func (d *Director) Middleware() proxy.Middleware {
}
handler := createMiddlewareChain(next, httpMiddlewares)
handler = bouncersentry.SpanHandler(handler, "director.proxy")
handler.ServeHTTP(w, r)
}

View File

@ -30,6 +30,8 @@ import (
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus/promhttp"
"gitlab.com/wpetit/goweb/logger"
bouncersentry "forge.cadoles.com/cadoles/bouncer/internal/sentry"
)
type Server struct {
@ -189,7 +191,7 @@ func (s *Server) run(parentCtx context.Context, addrs chan net.Addr, errs chan e
proxy.WithDefaultHandler(http.HandlerFunc(s.handleDefault)),
)
r.Handle("/*", handler)
r.Handle("/*", bouncersentry.SpanHandler(handler, "http.proxy"))
})
if err := http.Serve(listener, router); err != nil && !errors.Is(err, net.ErrClosed) {