Documentation ¶
Index ¶
- Constants
- func EnableClientHandlingTimeHistogram(opts ...HistogramOption)
- func EnableHandlingTimeHistogram(opts ...HistogramOption)
- func Register(server *grpc.Server)
- func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, ...) (grpc.ClientStream, error)
- func StreamServerInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func UnaryClientInterceptor(ctx context.Context, method string, req, reply interface{}, ...) error
- func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- type HistogramOption
Constants ¶
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 ¶
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.