middleware

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRPCRetryInterceptorFactory

func NewRPCRetryInterceptorFactory(opt RetryOptions) psrpc.RPCInterceptorFactory

func NewStreamRetryInterceptorFactory

func NewStreamRetryInterceptorFactory(opt RetryOptions) psrpc.StreamInterceptorFactory

func WithClientMetrics added in v0.2.10

func WithClientMetrics(observer MetricsObserver) psrpc.ClientOption

func WithRPCRetries

func WithRPCRetries(opt RetryOptions) psrpc.ClientOption

func WithServerMetrics added in v0.2.10

func WithServerMetrics(observer MetricsObserver) psrpc.ServerOption

func WithStreamRetries

func WithStreamRetries(opt RetryOptions) psrpc.ClientOption

Types

type MetricRole added in v0.2.10

type MetricRole int
const (
	ClientRole MetricRole
	ServerRole
)

func (MetricRole) String added in v0.2.10

func (r MetricRole) String() string

type MetricsObserver added in v0.2.10

type MetricsObserver interface {
	OnUnaryRequest(role MetricRole, info psrpc.RPCInfo, duration time.Duration, err error)
	OnMultiRequest(role MetricRole, info psrpc.RPCInfo, duration time.Duration, responseCount int, errorCount int)
	OnStreamSend(role MetricRole, info psrpc.RPCInfo, duration time.Duration, err error)
	OnStreamRecv(role MetricRole, info psrpc.RPCInfo, err error)
	OnStreamOpen(role MetricRole, info psrpc.RPCInfo)
	OnStreamClose(role MetricRole, info psrpc.RPCInfo)
}

type RetryOptions

type RetryOptions struct {
	MaxAttempts   int
	Timeout       time.Duration
	Backoff       time.Duration
	IsRecoverable func(err error) bool
}

Jump to

Keyboard shortcuts

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