From 2ec3dbd02e40d7b5917f46cc35bfc7cc9ecf4787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=8E=89=E6=B6=B5?= Date: Thu, 1 Feb 2024 19:09:41 +0800 Subject: [PATCH] feat: use app.GetHandlerName replace of reflect value --- tracing/utils.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tracing/utils.go b/tracing/utils.go index 00f5242..5927da5 100644 --- a/tracing/utils.go +++ b/tracing/utils.go @@ -33,7 +33,11 @@ import ( // Ref to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/http.md#name // naming rule: $HandlerName:$FullPath func serverSpanNaming(c *app.RequestContext) string { - return c.HandlerName() + ":" + c.FullPath() + handlerName := app.GetHandlerName(c.Handler()) + if handlerName == "" { + handlerName = c.HandlerName() + } + return handlerName + ":" + c.FullPath() } func clientSpanNaming(req *protocol.Request) string {