Documentation
¶
Overview ¶
Package middleware 提供 gRPC 中间件能力。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GrpcAccessLogger ¶
func GrpcAccessLogger(handle func(b []byte, msg string)) grpc.UnaryServerInterceptor
GrpcAccessLogger GRPC访问日志中间件,一般在WithServiceContext之前使用 handle 接收两类日志:b 为结构化 JSON,msg 为人类可读文本行; 字段包含 path/request/response/duration/status/trace_id 等,便于统一采集。
func PropagateIncomingMetadata ¶
func PropagateIncomingMetadata(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
PropagateIncomingMetadata 将入站元数据传播到出站上下文中
func WithServiceContext ¶ added in v0.8.1
func WithServiceContext(conf conf.BootstrapConf) grpc.UnaryServerInterceptor
WithServiceContext 将服务的信息注入到上下文中
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.