grpc

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: ISC Imports: 14 Imported by: 0

README

grpc

This package provides utilities for gRPC servers.

Item Description
grpc.ClientObservabilityInterceptor Providing grpc interceptors for grpc servers for logging, metrics, and tracing.
grpc.ServerObservabilityInterceptor Providing grpc interceptors for grpc clients for logging, metrics, and tracing.

Quick Start

You can see an example of using the server and client observability interceptors here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggerFromContext

func LoggerFromContext(ctx context.Context) (*log.Logger, bool)

LoggerFromContext returns a logger set by grpc server interceptor on each incoming context

func ServerStreamWithContext

func ServerStreamWithContext(stream grpc.ServerStream, ctx context.Context) grpc.ServerStream

ServerStreamWithContext return new grpc.ServerStream with a new context

Types

type ClientObservabilityInterceptor

type ClientObservabilityInterceptor struct {
	// contains filtered or unexported fields
}

ClientObservabilityInterceptor is a gRPC client interceptor for logging, metrics, and tracing

func NewClientObservabilityInterceptor

func NewClientObservabilityInterceptor(logger *log.Logger, mf *metrics.Factory, tracer opentracing.Tracer) *ClientObservabilityInterceptor

NewClientObservabilityInterceptor creates a new instance of gRPC server interceptor for observability

func (*ClientObservabilityInterceptor) StreamInterceptor

func (i *ClientObservabilityInterceptor) 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 (*ClientObservabilityInterceptor) UnaryInterceptor

func (i *ClientObservabilityInterceptor) 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 ServerObservabilityInterceptor

type ServerObservabilityInterceptor struct {
	// contains filtered or unexported fields
}

ServerObservabilityInterceptor is a gRPC server interceptor for logging, metrics, and tracing

func NewServerObservabilityInterceptor

func NewServerObservabilityInterceptor(logger *log.Logger, mf *metrics.Factory, tracer opentracing.Tracer) *ServerObservabilityInterceptor

NewServerObservabilityInterceptor creates a new instance of gRPC server interceptor for observability

func (*ServerObservabilityInterceptor) StreamInterceptor

func (i *ServerObservabilityInterceptor) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

StreamInterceptor is the gRPC StreamServerInterceptor for logging, metrics, and tracing

func (*ServerObservabilityInterceptor) UnaryInterceptor

func (i *ServerObservabilityInterceptor) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

UnaryInterceptor is the gRPC UnaryServerInterceptor for logging, metrics, and tracing

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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