grpclogging

package
v0.0.0-...-6cad993 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package grpclogging provides client and server interceptors to log grpc requests, responses, errors and other metadata which is helpful for debugging and analysis. This package assumes the caller is running in a skia-infra managed GKE cluster, such that stdout is parsed as newline-delimited json and passed to StackDriver logging for storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCLogger

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

GRPCLogger provides interceptor methods for grpc clients and servers to log the request and response activity going through them.

func New

func New(projectID string, w io.Writer) *GRPCLogger

New returns a new GRPCLogger instance that will write json-encoded log lines to w, using projectID to format the exported trace key as projects/<projectID>/traces/<traceID>, described in more detail here: https://cloud.google.com/logging/docs/structured-logging#structured_logging_special_fields

func (*GRPCLogger) ClientStreamLoggingInterceptor

func (l *GRPCLogger) ClientStreamLoggingInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)

ClientStreamLoggingInterceptor implements grpc.StreamClientInterceptor.

func (*GRPCLogger) ClientUnaryLoggingInterceptor

func (l *GRPCLogger) ClientUnaryLoggingInterceptor(ctx context.Context, method string, req, resp any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

ClientUnaryLoggingInterceptor implements grpc.UnaryClientInterceptor.

func (*GRPCLogger) ServerUnaryLoggingInterceptor

func (l *GRPCLogger) ServerUnaryLoggingInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)

ServerUnaryLoggingInterceptor implements grpc.UnaryServerInterceptor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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