grpc

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

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 NewMetrics

func NewMetrics(p observability.MetricsProvider) *Metrics

NewMetrics 创建 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 追踪配置

func DefaultTracingConfig

func DefaultTracingConfig() TracingConfig

DefaultTracingConfig 默认配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL