feat kafka

This commit is contained in:
2026-01-24 22:47:41 +08:00
parent 8de7ab4a67
commit 62ebfa17ea
4 changed files with 12 additions and 5 deletions

View File

@@ -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