mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 13:02:14 +00:00
fix for comments to ignore the request without request info
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
This commit is contained in:
parent
1aeb0ba314
commit
91af1145bf
@ -36,8 +36,8 @@ func WithTracing(handler http.Handler, tp trace.TracerProvider) http.Handler {
|
||||
otelhttp.WithSpanNameFormatter(func(operation string, r *http.Request) string {
|
||||
ctx := r.Context()
|
||||
info, exist := request.RequestInfoFrom(ctx)
|
||||
if !exist {
|
||||
return "KubernetesAPI"
|
||||
if !exist || !info.IsResourceRequest {
|
||||
return r.Method
|
||||
}
|
||||
return getSpanNameFromRequestInfo(info, r)
|
||||
}),
|
||||
@ -56,10 +56,6 @@ func WithTracing(handler http.Handler, tp trace.TracerProvider) http.Handler {
|
||||
}
|
||||
|
||||
func getSpanNameFromRequestInfo(info *request.RequestInfo, r *http.Request) string {
|
||||
if !info.IsResourceRequest {
|
||||
return r.Method + " " + info.Path
|
||||
}
|
||||
|
||||
spanName := "/" + info.APIPrefix
|
||||
if info.APIGroup != "" {
|
||||
spanName += "/" + info.APIGroup
|
||||
|
Loading…
Reference in New Issue
Block a user