grpc

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: ISC Imports: 14 Imported by: 0

README

grpc

This package provides utilities for gRPC servers and clients.

Item Description
grpc.ClientInterceptor Providing grpc interceptors for grpc clients for logging, metrics, and tracing.
grpc.ServerInterceptor Providing grpc interceptors for grpc servers for logging, metrics, and tracing.

Quick Start

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

Documentation

Overview

Package grpc provides utility for gRPC servers and clients.

Deprecated: this package has been frozen and deprecated in favor of github.com/moorara/observe/xgrpc

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 ClientInterceptor added in v0.2.8

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

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

func NewClientInterceptor added in v0.2.8

func NewClientInterceptor(logger *log.Logger, mf *metrics.Factory, tracer opentracing.Tracer) *ClientInterceptor

NewClientInterceptor creates a new instance of gRPC server interceptor

func (*ClientInterceptor) StreamInterceptor added in v0.2.8

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 added in v0.2.8

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 ServerInterceptor added in v0.2.8

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

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

func NewServerInterceptor added in v0.2.8

func NewServerInterceptor(logger *log.Logger, mf *metrics.Factory, tracer opentracing.Tracer) *ServerInterceptor

NewServerInterceptor creates a new instance of gRPC server interceptor

func (*ServerInterceptor) StreamInterceptor added in v0.2.8

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 added in v0.2.8

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

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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