server

package
v0.0.0-...-d4bbc0e Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricUnaryServerInterceptor

func MetricUnaryServerInterceptor(serverName string) grpc.UnaryServerInterceptor

记录请求开始的时间,调用原始的处理函数,然后记录请求处理的时间和错误代码

func RateLimitUnaryServerInterceptor

func RateLimitUnaryServerInterceptor(configs map[MethodName]RateLimitConfig) grpc.UnaryServerInterceptor

func RecoveryUnaryServerInterceptor

func RecoveryUnaryServerInterceptor() grpc.UnaryServerInterceptor

func TraceUnaryServerInterceptor

func TraceUnaryServerInterceptor() grpc.UnaryServerInterceptor

Types

type MethodName

type MethodName string

type RateLimitConfig

type RateLimitConfig struct {
	Cap             int64         `json:"cap"`
	Rate            float64       `json:"rate"`
	WaitMaxDuration time.Duration `json:"wait_max_duration"`
}

Jump to

Keyboard shortcuts

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