feat(tvix/store/nar-bridge): Setup OpenTelemetry
Sets up OpenTelemetry integration for nar-bridge. Right now it will export spans for HTTP server requests and all gRPC client requests. Having the spans available will make performance work significantly easier as it provides a high level overview of where time is being spent. In the future we can add application-specifc metrics and integrate logrus. Change-Id: Ie3860675d7ffc626a95673ba062c3c798d8bb2a7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10678 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Autosubmit: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
parent
e8061fc619
commit
d056329412
6 changed files with 200 additions and 34 deletions
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/go-chi/chi/middleware"
|
||||
"github.com/go-chi/chi/v5"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
|
|
@ -46,6 +47,9 @@ func New(
|
|||
priority int,
|
||||
) *Server {
|
||||
r := chi.NewRouter()
|
||||
r.Use(func(h http.Handler) http.Handler {
|
||||
return otelhttp.NewHandler(h, "http.request")
|
||||
})
|
||||
|
||||
if enableAccessLog {
|
||||
r.Use(middleware.Logger)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue