mirror of
https://github.com/zitadel/zitadel.git
synced 2026-07-25 18:28:00 +00:00
Updates all dependencies to latests versions (apart from the ones where there are already issues to solve their updates). Some updates required minor changes.
34 lines
909 B
Go
34 lines
909 B
Go
package middleware
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
|
"go.opentelemetry.io/otel"
|
|
|
|
"github.com/zitadel/zitadel/backend/v3/instrumentation"
|
|
http_utils "github.com/zitadel/zitadel/internal/api/http"
|
|
)
|
|
|
|
func DefaultTraceHandler(handler http.Handler) http.Handler {
|
|
return TraceHandler(http_utils.Probes...)(handler)
|
|
}
|
|
|
|
func TraceHandler(ignoredPrefix ...string) func(http.Handler) http.Handler {
|
|
return func(handler http.Handler) http.Handler {
|
|
return otelhttp.NewHandler(handler,
|
|
"zitadel",
|
|
otelhttp.WithFilter(instrumentation.RequestFilter(ignoredPrefix...)),
|
|
otelhttp.WithPublicEndpointFn(func(_ *http.Request) bool {
|
|
return true
|
|
}),
|
|
otelhttp.WithSpanNameFormatter(spanNameFormatter),
|
|
otelhttp.WithMeterProvider(otel.GetMeterProvider()),
|
|
)
|
|
}
|
|
}
|
|
|
|
func spanNameFormatter(_ string, r *http.Request) string {
|
|
return r.URL.Path
|
|
}
|