Merge pull request #122173 from KubeKyrie/optimize-trace-span-name

change func WithTracing  parameter naming, serviceName to spanName
This commit is contained in:
Kubernetes Prow Robot 2023-12-14 07:26:09 +01:00 committed by GitHub
commit d1f4e93ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,7 @@ func NewProvider(ctx context.Context,
}
// WithTracing adds tracing to requests if the incoming request is sampled
func WithTracing(handler http.Handler, tp oteltrace.TracerProvider, serviceName string) http.Handler {
func WithTracing(handler http.Handler, tp oteltrace.TracerProvider, spanName string) http.Handler {
opts := []otelhttp.Option{
otelhttp.WithPropagators(Propagators()),
otelhttp.WithTracerProvider(tp),
@ -106,7 +106,7 @@ func WithTracing(handler http.Handler, tp oteltrace.TracerProvider, serviceName
})
// With Noop TracerProvider, the otelhttp still handles context propagation.
// See https://github.com/open-telemetry/opentelemetry-go/tree/main/example/passthrough
return otelhttp.NewHandler(wrappedHandler, serviceName, opts...)
return otelhttp.NewHandler(wrappedHandler, spanName, opts...)
}
// WrapperFor can be used to add tracing to a *rest.Config.