first commit

This commit is contained in:
2026-09-11 01:41:52 +08:00
commit 9f22e6ccae
263 changed files with 28935 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
package middleware
import (
"git.lzcwy.cn/zhengchiliu/zt-closet-backend/global"
"github.com/gin-gonic/gin"
"go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
)
// GinOTelMiddleware 为每个 HTTP 请求自动开启 server span。
func GinOTelMiddleware() gin.HandlerFunc {
name := "zt-closet-backend"
if global.OtelSetting != nil && global.OtelSetting.ServiceName != "" {
name = global.OtelSetting.ServiceName
}
return otelgin.Middleware(name)
}