interceptors

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func FullMethod

func FullMethod(service, method string) string

func StreamClientInterceptor

func StreamClientInterceptor(reportable ClientReportable) grpc.StreamClientInterceptor

StreamClientInterceptor is a gRPC client-side interceptor that provides reporting for Stream RPCs.

func StreamServerInterceptor

func StreamServerInterceptor(reportable ServerReportable) grpc.StreamServerInterceptor

StreamServerInterceptor is a gRPC server-side interceptor that provides reporting for Streaming RPCs.

func UnaryClientInterceptor

func UnaryClientInterceptor(reportable ClientReportable) grpc.UnaryClientInterceptor

UnaryClientInterceptor is a gRPC client-side interceptor that provides reporting for Unary RPCs.

func UnaryServerInterceptor

func UnaryServerInterceptor(reportable ServerReportable) grpc.UnaryServerInterceptor

UnaryServerInterceptor is a gRPC server-side interceptor that provides reporting for Unary RPCs.

Types

type ClientReportable

type ClientReportable interface {
	ClientReporter(ctx context.Context, reqProtoOrNil interface{}, typ GRPCType, service string, method string) (Reporter, context.Context)
}

type GRPCType

type GRPCType string
const (
	Unary        GRPCType = "unary"
	ClientStream GRPCType = "client_stream"
	ServerStream GRPCType = "server_stream"
	BidiStream   GRPCType = "bidi_stream"
)

type NoopReporter

type NoopReporter struct{}

func (NoopReporter) PostCall

func (NoopReporter) PostCall(error, time.Duration)

func (NoopReporter) PostMsgReceive

func (NoopReporter) PostMsgReceive(interface{}, error, time.Duration)

func (NoopReporter) PostMsgSend

func (NoopReporter) PostMsgSend(interface{}, error, time.Duration)

type Reporter

type Reporter interface {
	PostCall(err error, rpcDuration time.Duration)

	PostMsgSend(reqProto interface{}, err error, sendDuration time.Duration)
	PostMsgReceive(replyProto interface{}, err error, recvDuration time.Duration)
}

type ServerReportable

type ServerReportable interface {
	ServerReporter(ctx context.Context, reqProtoOrNil interface{}, typ GRPCType, service string, method string) (Reporter, context.Context)
}

Jump to

Keyboard shortcuts

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