From 78c9672deb755bc1ea2631c21a57f4b87d61d3c9 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 30 Jul 2025 17:12:26 +0000 Subject: [PATCH] migrate tracing tests to use the new otelhttp semantic conventions --- .../apiserver/tracing/tracing_test.go | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/test/integration/apiserver/tracing/tracing_test.go b/test/integration/apiserver/tracing/tracing_test.go index 44120920be9..dc7c9192379 100644 --- a/test/integration/apiserver/tracing/tracing_test.go +++ b/test/integration/apiserver/tracing/tracing_test.go @@ -324,6 +324,8 @@ endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil { } func TestAPIServerTracing(t *testing.T) { + // TODO: remove after updating otelhttp to v0.61.0 + t.Setenv("OTEL_SEMCONV_STABILITY_OPT_IN", "http/dup") // Listen for traces from the API Server before starting it, so the // API Server will successfully connect right away during the test. listener, err := net.Listen("tcp", "localhost:") @@ -391,10 +393,10 @@ endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil { "user_agent.original": func(v *commonv1.AnyValue) bool { return strings.HasPrefix(v.GetStringValue(), "tracing.test") }, - "http.target": func(v *commonv1.AnyValue) bool { + "url.path": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "/api/v1/nodes" }, - "http.method": func(v *commonv1.AnyValue) bool { + "http.request.method": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "POST" }, "audit-id": func(v *commonv1.AnyValue) bool { @@ -510,10 +512,10 @@ endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil { "user_agent.original": func(v *commonv1.AnyValue) bool { return strings.HasPrefix(v.GetStringValue(), "tracing.test") }, - "http.target": func(v *commonv1.AnyValue) bool { + "url.path": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "/api/v1/nodes/fake" }, - "http.method": func(v *commonv1.AnyValue) bool { + "http.request.method": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "GET" }, "audit-id": func(v *commonv1.AnyValue) bool { @@ -617,10 +619,10 @@ endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil { "user_agent.original": func(v *commonv1.AnyValue) bool { return strings.HasPrefix(v.GetStringValue(), "tracing.test") }, - "http.target": func(v *commonv1.AnyValue) bool { + "url.path": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "/api/v1/nodes" }, - "http.method": func(v *commonv1.AnyValue) bool { + "http.request.method": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "GET" }, "audit-id": func(v *commonv1.AnyValue) bool { @@ -712,10 +714,10 @@ endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil { "user_agent.original": func(v *commonv1.AnyValue) bool { return strings.HasPrefix(v.GetStringValue(), "tracing.test") }, - "http.target": func(v *commonv1.AnyValue) bool { + "url.path": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "/api/v1/nodes/fake" }, - "http.method": func(v *commonv1.AnyValue) bool { + "http.request.method": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "PUT" }, "audit-id": func(v *commonv1.AnyValue) bool { @@ -856,10 +858,10 @@ endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil { "user_agent.original": func(v *commonv1.AnyValue) bool { return strings.HasPrefix(v.GetStringValue(), "tracing.test") }, - "http.target": func(v *commonv1.AnyValue) bool { + "url.path": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "/api/v1/nodes/fake" }, - "http.method": func(v *commonv1.AnyValue) bool { + "http.request.method": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "PATCH" }, "audit-id": func(v *commonv1.AnyValue) bool { @@ -977,10 +979,10 @@ endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil { "user_agent.original": func(v *commonv1.AnyValue) bool { return strings.HasPrefix(v.GetStringValue(), "tracing.test") }, - "http.target": func(v *commonv1.AnyValue) bool { + "url.path": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "/api/v1/nodes/fake" }, - "http.method": func(v *commonv1.AnyValue) bool { + "http.request.method": func(v *commonv1.AnyValue) bool { return v.GetStringValue() == "DELETE" }, "audit-id": func(v *commonv1.AnyValue) bool {