diff --git a/app/app.go b/app/app.go index dd2b231..1add745 100644 --- a/app/app.go +++ b/app/app.go @@ -22,7 +22,7 @@ func (p *Program) Init(_ svc.Environment) error { return err } p.moduleList = append(p.moduleList, base) - p.moduleList = append(p.moduleList, (&module.DB{}).Bind(config.Get().DB, common.KeyDiscoverServiceNameGateway)) + p.moduleList = append(p.moduleList, (&module.DB{}).Bind(config.Get().DB)) p.moduleList = append(p.moduleList, &ModuleWebServer{}) p.moduleList = append(p.moduleList, &ModuleWebsocketServer{}) p.moduleList = append(p.moduleList, &ModuleLoginQueue{}) diff --git a/go.mod b/go.mod index e52fcbf..011c430 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.24.0 require ( bou.ke/monkey v1.0.2 - git.hlsq.asia/mmorpg/service-common v0.0.0-20260124134614-b45df9c4eec1 + git.hlsq.asia/mmorpg/service-common v0.0.0-20260124144615-81e422d3049f github.com/alicebob/miniredis/v2 v2.35.0 github.com/gin-contrib/cors v1.7.6 github.com/gin-gonic/gin v1.11.0 diff --git a/go.sum b/go.sum index b181aa5..20855d6 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ bou.ke/monkey v1.0.2 h1:kWcnsrCNUatbxncxR/ThdYqbytgOIArtYWqcQLQzKLI= bou.ke/monkey v1.0.2/go.mod h1:OqickVX3tNx6t33n1xvtTtu85YN5s6cKwVug+oHMaIA= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -git.hlsq.asia/mmorpg/service-common v0.0.0-20260124134614-b45df9c4eec1 h1:GHxUzY1eJ5Qk0V8lwB4iOHirBEXrJ+ZGT4oo+f08YO4= -git.hlsq.asia/mmorpg/service-common v0.0.0-20260124134614-b45df9c4eec1/go.mod h1:mMhZcumphj6gaVTppVYsMTkd+5HupmQgAc53Pd4MH9I= +git.hlsq.asia/mmorpg/service-common v0.0.0-20260124144615-81e422d3049f h1:ZJGMfG3MD5Oll7aFZ5HIXID8snSIea0qPcjMI8kFLg0= +git.hlsq.asia/mmorpg/service-common v0.0.0-20260124144615-81e422d3049f/go.mod h1:mMhZcumphj6gaVTppVYsMTkd+5HupmQgAc53Pd4MH9I= github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/IBM/sarama v1.46.3 h1:njRsX6jNlnR+ClJ8XmkO+CM4unbrNr/2vB5KK6UA+IE= diff --git a/internal/net/http_gateway/router.go b/internal/net/http_gateway/router.go index 9351b14..8a1a54c 100644 --- a/internal/net/http_gateway/router.go +++ b/internal/net/http_gateway/router.go @@ -14,6 +14,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin" "google.golang.org/protobuf/encoding/protojson" + "strings" ) func InitServeMux() *runtime.ServeMux { @@ -49,7 +50,13 @@ func InitRouter() *gin.Engine { gin.Recovery(), ginLogger(log.GetLogger().Named("GIN")), cors.New(corsConfig()), - otelgin.Middleware(common.KeyDiscoverServiceNameGateway), + otelgin.Middleware( + common.KeyDiscoverServiceNameGateway, + otelgin.WithSpanNameFormatter(func(c *gin.Context) string { + method := strings.ToUpper(c.Request.Method) + return method + " " + c.Request.URL.Path + }), + ), ) r.HandleMethodNotAllowed = true