diff --git a/go.mod b/go.mod index d8f33f675..992b8cce9 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( k8s.io/client-go v0.35.2 knative.dev/eventing v0.48.1-0.20260316031422-ce3fe6b62f97 knative.dev/hack v0.0.0-20260310014051-c448fdb867e2 - knative.dev/pkg v0.0.0-20260316154451-5d1c12d99335 + knative.dev/pkg v0.0.0-20260317082650-91e176852006 ) require ( diff --git a/go.sum b/go.sum index 03dc719a7..b8051da77 100644 --- a/go.sum +++ b/go.sum @@ -352,8 +352,8 @@ knative.dev/eventing v0.48.1-0.20260316031422-ce3fe6b62f97 h1:igxNyYW2+LxPspTqGp knative.dev/eventing v0.48.1-0.20260316031422-ce3fe6b62f97/go.mod h1:UR5qyT/4a68s4HJ+ZEourVWJ7pS7um8PCW4COjeOyxE= knative.dev/hack v0.0.0-20260310014051-c448fdb867e2 h1:b35SGLEp03D8oGf8mE9HBt3yfNgYpAK0fw46hFXs9w4= knative.dev/hack v0.0.0-20260310014051-c448fdb867e2/go.mod h1:L5RzHgbvam0u8QFHfzCX6MKxu/a/gIGEdaRBqNiVbl0= -knative.dev/pkg v0.0.0-20260316154451-5d1c12d99335 h1:OpR5LNa0m34T8KOzGLwObjmMkxuuenSFU51oiNcfKRw= -knative.dev/pkg v0.0.0-20260316154451-5d1c12d99335/go.mod h1:o/XS1E/hYh9IR8deEEiJG4kKtQfqnf9Gwt5bwp2x4AU= +knative.dev/pkg v0.0.0-20260317082650-91e176852006 h1:kigmOSaEWOddCfoyH1+Mx0w1kwnZrl3CbPAN+9/+Kx4= +knative.dev/pkg v0.0.0-20260317082650-91e176852006/go.mod h1:o/XS1E/hYh9IR8deEEiJG4kKtQfqnf9Gwt5bwp2x4AU= sigs.k8s.io/gateway-api v1.1.0 h1:DsLDXCi6jR+Xz8/xd0Z1PYl2Pn0TyaFMOPPZIj4inDM= sigs.k8s.io/gateway-api v1.1.0/go.mod h1:ZH4lHrL2sDi0FHZ9jjneb8kKnGzFWyrTya35sWUTrRs= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= diff --git a/vendor/knative.dev/pkg/webhook/webhook.go b/vendor/knative.dev/pkg/webhook/webhook.go index 4af32228e..866729047 100644 --- a/vendor/knative.dev/pkg/webhook/webhook.go +++ b/vendor/knative.dev/pkg/webhook/webhook.go @@ -37,7 +37,6 @@ import ( "knative.dev/pkg/observability/semconv" "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" - "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -313,19 +312,11 @@ func (wh *Webhook) Run(stop <-chan struct{}) error { } otelHandler := otelhttp.NewHandler( - drainer, + &routeLabeler{next: drainer}, wh.Options.ServiceName, // Note this service is k8s service name otelhttp.WithMeterProvider(wh.Options.MeterProvider), otelhttp.WithTracerProvider(wh.Options.TracerProvider), otelhttp.WithPropagators(wh.Options.TextMapPropagator), - otelhttp.WithMetricAttributesFn(func(r *http.Request) []attribute.KeyValue { - if r.URL.Path == "" { - return nil - } - return []attribute.KeyValue{ - semconv.HTTPRoute(r.URL.Path), - } - }), otelhttp.WithFilter(func(r *http.Request) bool { // Don't trace kubelet probes return !network.IsKubeletProbe(r) @@ -406,3 +397,16 @@ func (wh *Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) { wh.mux.ServeHTTP(w, r) } + +type routeLabeler struct { + next http.Handler +} + +func (rl *routeLabeler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "" { + labeler, _ := otelhttp.LabelerFromContext(r.Context()) + labeler.Add(semconv.HTTPRoute(r.URL.Path)) + } + + rl.next.ServeHTTP(w, r) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index d9423a827..70f9edf7f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1129,7 +1129,7 @@ knative.dev/eventing/pkg/utils # knative.dev/hack v0.0.0-20260310014051-c448fdb867e2 ## explicit; go 1.24 knative.dev/hack -# knative.dev/pkg v0.0.0-20260316154451-5d1c12d99335 +# knative.dev/pkg v0.0.0-20260317082650-91e176852006 ## explicit; go 1.25.0 knative.dev/pkg/apis knative.dev/pkg/apis/duck