grpc_prometheus

package
Version: v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unary        grpcType = "unary"
	ClientStream grpcType = "client_stream"
	ServerStream grpcType = "server_stream"
	BidiStream   grpcType = "bidi_stream"
)

Variables

This section is empty.

Functions

func EnableClientHandlingTimeHistogram

func EnableClientHandlingTimeHistogram(opts ...HistogramOption)

EnableClientHandlingTimeHistogram turns on recording of handling time of RPCs. Histogram metrics can be very expensive for Prometheus to retain and query.

func EnableHandlingTimeHistogram

func EnableHandlingTimeHistogram(opts ...HistogramOption)

EnableHandlingTimeHistogram turns on recording of handling time of RPCs for server-side interceptors. Histogram metrics can be very expensive for Prometheus to retain and query.

func Register

func Register(server *grpc.Server)

PreregisterServices takes a gRPC server and pre-initializes all counters to 0. This allows for easier monitoring in Prometheus (no missing metrics), and should be called *after* all services have been registered with the server.

func StreamClientInterceptor

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

StreamServerInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Streaming RPCs.

func StreamServerInterceptor

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

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

func UnaryClientInterceptor

func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

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

func UnaryServerInterceptor

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

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

Types

type HistogramOption

type HistogramOption func(*prom.HistogramOpts)

func WithHistogramBuckets

func WithHistogramBuckets(buckets []float64) HistogramOption

WithHistogramBuckets allows you to specify custom bucket ranges for histograms if EnableHandlingTimeHistogram is on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL