grpc

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2018 License: Apache-2.0 Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnaryClientInterceptor

func UnaryClientInterceptor(opts ...InterceptorOption) golangGrpc.UnaryClientInterceptor

UnaryClientInterceptor will add tracing to a gprc client.

func UnaryServerInterceptor

func UnaryServerInterceptor(opts ...InterceptorOption) golangGrpc.UnaryServerInterceptor

UnaryServerInterceptor will trace requests to the given grpc server.

Types

type ClientResponseClassifier

type ClientResponseClassifier func(ctx context.Context, method string, req, reply interface{}, err error) ResponseType

ClientResponseClassifier is a method definition for defining custom response types to the limiter algorithm to correctly handle certain types of errors or embedded data.

type InterceptorOption

type InterceptorOption func(*interceptorConfig)

InterceptorOption represents an option that can be passed to the grpc unary client and server interceptors.

func WithClientResponseTypeClassifier

func WithClientResponseTypeClassifier(classifier ClientResponseClassifier) InterceptorOption

WithClientResponseTypeClassifier sets the response classifier for the intercepted client

func WithLimiter

func WithLimiter(limiter core.Limiter) InterceptorOption

WithLimiter sets the given limiter for the intercepted client.

func WithName

func WithName(name string) InterceptorOption

WithName sets the default limiter name if the default limiter is used, otherwise unused.

func WithServerResponseTypeClassifier

func WithServerResponseTypeClassifier(classifier ServerResponseClassifier) InterceptorOption

WithServerResponseTypeClassifier sets the response classifier for the intercepted client

func WithTags

func WithTags(tags []string) InterceptorOption

WithTags sets the default limiter tags if the default limiter is used, otherwise unused.

type ResponseType

type ResponseType int

ResponseType is the type of token release that should be specified to the limiter algorithm.

const (
	// ResponseTypeSuccess represents a successful response for the limiter algorithm
	ResponseTypeSuccess ResponseType = iota
	// ResponseTypeIgnore represents an ignorable error or response for the limiter algorithm
	ResponseTypeIgnore
	// ResponseTypeDropped represents a dropped request type for the limiter algorithm
	ResponseTypeDropped
)

type ServerResponseClassifier

type ServerResponseClassifier func(
	ctx context.Context, req interface{}, info *golangGrpc.UnaryServerInfo, resp interface{}, err error,
) ResponseType

ServerResponseClassifier is a method definition for defining custom response types to the limiter algorithm to correctly handle certain types of errors or embedded data.

Jump to

Keyboard shortcuts

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