Code change:
Extension API servers do not currently receive the header when requests are proxied through kube-aggregator, so spans are not linked properly. Traces from the extension API sever should be linked to the parent in kube-aggregator. tracing for kube-apiserver tracing for sample-apiserver and aggregate it to kube-apiserver a request to kube-apiserver for one of the resources from sample-apiserver sample-apiserver traces will not be linked to the kube-apiserver traces No response <detailsThis problem currently exists on . </details<details</details<details</details<details</details<details</details<details</details
/sig api-machinery
/cc /triage accepted

Related discussion:
text: } <ins> func TestTracerProvider(t *testing.T) { fakeRecorder := tracetest.NewSpanRecorder() otelTracer := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(fakeRecorder)) target := &targetHTTPHandler{} user := &user.DefaultInfo{ Name:   "username", Groups: []string{"one", "two"}, } path := "/request/path" apiService := &apiregistration.APIService{ ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"}, Spec: apiregistration.APIServiceSpec{ Service:  &apiregistration.ServiceReference{Name: "test-service", Namespace: "test-ns", Port: ptr.To(int32(443))}, Group:    "foo", Version:  "v1", CABundle: testCACrt, }, Status: apiregistration.APIServiceStatus{ Conditions: []apiregistration.APIServiceCondition{ {Type: apiregistration.Available, Status: apiregistration.ConditionTrue}, }, }, } targetServer := httptest.NewUnstartedServer(target) serviceCert := svcCrt if cert, err := tls.X509KeyPair(serviceCert, svcKey); err != nil { t.Fatalf("TestTracerProvider: failed to parse key pair: %v", err) } else { targetServer.TLS = &tls.Config{Certificates: []tls.Certificate{cert}} } targetServer.StartTLS() defer targetServer.Close() serviceResolver := &mockedRouter{destinationHost: targetServer.Listener.Addr().String()} handler := &proxyHandler{ localDelegate:              http.NewServeMux(), serviceResolver:            serviceResolver, proxyCurrentCertKeyContent: func() ([]byte, []byte) { return emptyCert(), emptyCert() }, tracerProvider:             otelTracer, } server := httptest.NewServer(contextHandler(filters.WithTracing(handler, otelTracer), user)) defer server.Close() handler.updateAPIService(apiService) curr := handler.handlingInfo.Load().(proxyHandlingInfo) handler.handlingInfo.Store(curr) var propagator propagation.TraceContext req, err := http.NewRequest(http.MethodGet, server.URL+path, nil) if err != nil { t.Errorf("expected new request: %v", err) return } t.Logf("Sending request: %v", req) _, err = http.DefaultClient.Do(req) if err != nil { t.Errorf("http request failed: %v", err) return } t.Log("Ensure the target server received the traceparent header") id, ok := target.headers["Traceparent"] if !ok { t.Error("expected traceparent header") return } t.Log("Get the span context from the traceparent header") h := http.Header{ "Traceparent": id, } ctx := propagator.Extract(context.Background(), propagation.HeaderCarrier(h)) span := trace.SpanFromContext(ctx) t.Log("Ensure that the span context is valid and remote") if !span.SpanContext().IsValid() { t.Error("expected valid span context") return } if !span.SpanContext().IsRemote() { t.Error("expected remote span context") return } t.Log("Ensure that the span ID and trace ID match the expected values") expectedSpanCtx := fakeRecorder.Ended()[0].SpanContext() if expectedSpanCtx.TraceID() != span.SpanContext().TraceID() { t.Errorf("expected trace id to match. expected: %v, but got %v", expectedSpanCtx.TraceID(), span.SpanContext().TraceID()) return } if expectedSpanCtx.SpanID() != span.SpanContext().SpanID() { t.Errorf("expected span id to match. expected: %v, but got: %v", expectedSpanCtx.SpanID(), span.SpanContext().SpanID()) return } t.Log("Ensure that the expected spans were recorded when sending a request through the proxy") expectedSpanNames := []string{"HTTP GET", "GET"} spanNames := []string{} for _, span := range fakeRecorder.Ended() { spanNames = append(spanNames, span.Name()) } if e, a := expectedSpanNames, spanNames; !reflect.DeepEqual(e, a) { t.Errorf("expected span names %v, got %v", e, a) return } } </ins> func TestNewRequestForProxyWithAuditID(t *testing.T) { tests := []struct { name    string