Documentation
¶
Index ¶
- func StreamLogging(log logger.Logger) grpc.StreamServerInterceptor
- func StreamRecovery(log logger.Logger) grpc.StreamServerInterceptor
- func StreamServerTracing(cfg TracingConfig) grpc.StreamServerInterceptor
- func UnaryClientTracing(cfg TracingConfig) grpc.UnaryClientInterceptor
- func UnaryLogging(log logger.Logger) grpc.UnaryServerInterceptor
- func UnaryRecovery(log logger.Logger) grpc.UnaryServerInterceptor
- func UnaryServerTracing(cfg TracingConfig) grpc.UnaryServerInterceptor
- type Metrics
- type TracingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamLogging ¶
func StreamLogging(log logger.Logger) grpc.StreamServerInterceptor
StreamLogging 流式调用日志拦截器
func StreamRecovery ¶
func StreamRecovery(log logger.Logger) grpc.StreamServerInterceptor
StreamRecovery 流式调用 panic 恢复拦截器
func StreamServerTracing ¶
func StreamServerTracing(cfg TracingConfig) grpc.StreamServerInterceptor
StreamServerTracing 流式 RPC 追踪拦截器
func UnaryClientTracing ¶
func UnaryClientTracing(cfg TracingConfig) grpc.UnaryClientInterceptor
UnaryClientTracing 客户端一元 RPC 追踪拦截器
func UnaryLogging ¶
func UnaryLogging(log logger.Logger) grpc.UnaryServerInterceptor
UnaryLogging 一元调用日志拦截器
func UnaryRecovery ¶
func UnaryRecovery(log logger.Logger) grpc.UnaryServerInterceptor
UnaryRecovery 一元调用 panic 恢复拦截器
func UnaryServerTracing ¶
func UnaryServerTracing(cfg TracingConfig) grpc.UnaryServerInterceptor
UnaryServerTracing 一元 RPC 追踪拦截器
Types ¶
type Metrics ¶
type Metrics struct {
RequestsTotal observability.Counter
RequestDuration observability.Histogram
ActiveRequests observability.Gauge
}
Metrics gRPC 指标
func (*Metrics) StreamInterceptor ¶
func (m *Metrics) StreamInterceptor() grpc.StreamServerInterceptor
StreamInterceptor 流式调用指标拦截器
func (*Metrics) UnaryInterceptor ¶
func (m *Metrics) UnaryInterceptor() grpc.UnaryServerInterceptor
UnaryInterceptor 一元调用指标拦截器
type TracingConfig ¶
type TracingConfig struct {
ServiceName string
SkipMethods []string // 跳过追踪的方法
TracerProvider trace.TracerProvider
}
TracingConfig 追踪配置
Click to show internal directories.
Click to hide internal directories.