Documentation
¶
Index ¶
- func NewAccessLogger(log *logger.AccessLogger, options ...AccessLoggerOptions) grpc.UnaryServerInterceptor
- func NewOtelServerStatsHandler(opts ...otelgrpc.Option) stats.Handler
- func NewServiceContextUnaryInterceptor(options ServiceContextInterceptorOptions) grpc.UnaryServerInterceptor
- func ValidationErrorToInvalidArgument() grpc.UnaryServerInterceptor
- type AccessLoggerOptions
- type ServiceContextInterceptorOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAccessLogger ¶ added in v1.1.8
func NewAccessLogger(log *logger.AccessLogger, options ...AccessLoggerOptions) grpc.UnaryServerInterceptor
NewAccessLogger 访问日志中间件
设计说明: - 默认跳过 gRPC health check,避免探针请求刷屏访问日志。 - 业务方也可以通过 options 追加自定义的跳过方法列表。
func NewOtelServerStatsHandler ¶ added in v1.1.8
func NewServiceContextUnaryInterceptor ¶ added in v1.4.0
func NewServiceContextUnaryInterceptor(options ServiceContextInterceptorOptions) grpc.UnaryServerInterceptor
NewServiceContextUnaryInterceptor 在请求入口统一建立并注入 service.Context。
func ValidationErrorToInvalidArgument ¶ added in v1.1.7
func ValidationErrorToInvalidArgument() grpc.UnaryServerInterceptor
Types ¶
type AccessLoggerOptions ¶ added in v1.5.2
type AccessLoggerOptions struct {
// SkipMethods 表示需要跳过访问日志记录的完整 gRPC 方法名列表。
// 例如:/grpc.health.v1.Health/Check
SkipMethods []string
}
AccessLoggerOptions 定义 gRPC 访问日志中间件的可选配置。
type ServiceContextInterceptorOptions ¶ added in v1.4.0
ServiceContextInterceptorOptions 定义拦截器选项。
Click to show internal directories.
Click to hide internal directories.