Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextForTest ¶ added in v0.2.2
ContextForTest takes in a request context and inserts a RequestID as well as a new Void Logger. For use in tests only, to test functions which expect a logger and RequestID to have been added by the interceptor.
func ServerStreamWithContext ¶
func ServerStreamWithContext(stream grpc.ServerStream, ctx context.Context) grpc.ServerStream
ServerStreamWithContext return new grpc.ServerStream with a new context.
Types ¶
type ClientInterceptor ¶
type ClientInterceptor struct {
// contains filtered or unexported fields
}
ClientInterceptor is a gRPC client interceptor for logging, metrics, and tracing.
func NewClientInterceptor ¶
func NewClientInterceptor(name string, opts ...ClientInterceptorOption) *ClientInterceptor
NewClientInterceptor creates a new instance of gRPC client interceptor.
func (*ClientInterceptor) StreamInterceptor ¶
func (i *ClientInterceptor) StreamInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, fullMethod string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)
StreamInterceptor is the gRPC StreamClientInterceptor for logging, metrics, and tracing.
func (*ClientInterceptor) UnaryInterceptor ¶
func (i *ClientInterceptor) UnaryInterceptor(ctx context.Context, fullMethod string, req, res interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
UnaryInterceptor is the gRPC UnaryClientInterceptor for logging, metrics, and tracing.
type ClientInterceptorOption ¶ added in v0.2.1
type ClientInterceptorOption func(*ClientInterceptor)
ClientInterceptorOption sets optional parameters for client interceptor.
func ClientLogging ¶ added in v0.2.1
func ClientLogging(logger *log.Logger) ClientInterceptorOption
ClientLogging is the option for client interceptor to enable logging for every request.
func ClientMetrics ¶ added in v0.2.1
func ClientMetrics(mf *metrics.Factory) ClientInterceptorOption
ClientMetrics is the option for client interceptor to enable metrics for every request.
func ClientTracing ¶ added in v0.2.1
func ClientTracing(tracer opentracing.Tracer) ClientInterceptorOption
ClientTracing is the option for client interceptor to enable tracing for every request.
type ServerInterceptor ¶
type ServerInterceptor struct {
// contains filtered or unexported fields
}
ServerInterceptor is a gRPC server interceptor for logging, metrics, and tracing.
func NewServerInterceptor ¶
func NewServerInterceptor(opts ...ServerInterceptorOption) *ServerInterceptor
NewServerInterceptor creates a new instance of gRPC server interceptor.
func (*ServerInterceptor) StreamInterceptor ¶
func (i *ServerInterceptor) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
StreamInterceptor is the gRPC StreamServerInterceptor for logging, metrics, and tracing.
func (*ServerInterceptor) UnaryInterceptor ¶
func (i *ServerInterceptor) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
UnaryInterceptor is the gRPC UnaryServerInterceptor for logging, metrics, and tracing.
type ServerInterceptorOption ¶ added in v0.2.1
type ServerInterceptorOption func(*ServerInterceptor)
ServerInterceptorOption sets optional parameters for server interceptor.
func ServerLogging ¶ added in v0.2.1
func ServerLogging(logger *log.Logger) ServerInterceptorOption
ServerLogging is the option for server interceptor to enable logging for every request.
func ServerMetrics ¶ added in v0.2.1
func ServerMetrics(mf *metrics.Factory) ServerInterceptorOption
ServerMetrics is the option for server interceptor to enable metrics for every request.
func ServerTracing ¶ added in v0.2.1
func ServerTracing(tracer opentracing.Tracer) ServerInterceptorOption
ServerTracing is the option for server interceptor to enable tracing for every request.