feat 链路追踪

This commit is contained in:
2026-01-16 22:01:35 +08:00
parent 7cb057fc91
commit e59d106700
11 changed files with 394 additions and 108 deletions

View File

@@ -2,6 +2,7 @@ package grpc_conn
import (
"git.hlsq.asia/mmorpg/service-common/log"
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/keepalive"
@@ -20,6 +21,7 @@ func NewGrpcConnection(sid string, address string) (*GrpcConnection, error) {
conn, err := grpc.NewClient(
address,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithStatsHandler(otelgrpc.NewClientHandler()),
grpc.WithKeepaliveParams(
keepalive.ClientParameters{
Time: 30 * time.Second, // 保活探测包发送的时间间隔