grpcx

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ServerRequestDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "grpc_server_request_duration_seconds",
			Help:    "gRPC server request duration in seconds",
			Buckets: []float64{0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10},
		},
		[]string{"method", "code"},
	)

	ServerRequestsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "grpc_server_requests_total",
			Help: "gRPC server requests total",
		},
		[]string{"method", "code"},
	)

	ServerInFlight = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "grpc_server_requests_in_flight",
			Help: "gRPC server requests currently processing",
		},
		[]string{"method"},
	)
)

Functions

func StreamServerLoggerInterceptor

func StreamServerLoggerInterceptor(l *logger.Logger, skipMethods ...string) grpc.StreamServerInterceptor

func StreamServerMetricInterceptor

func StreamServerMetricInterceptor(skipMethods ...string) grpc.StreamServerInterceptor

func StreamServerMetricInterceptorWithMetrics added in v1.2.2

func StreamServerMetricInterceptorWithMetrics(metrics *Metrics, skipMethods ...string) grpc.StreamServerInterceptor

func UnaryServerLoggerInterceptor

func UnaryServerLoggerInterceptor(l *logger.Logger, skipMethods ...string) grpc.UnaryServerInterceptor

func UnaryServerMetricInterceptor

func UnaryServerMetricInterceptor(skipMethods ...string) grpc.UnaryServerInterceptor

func UnaryServerMetricInterceptorWithMetrics added in v1.2.2

func UnaryServerMetricInterceptorWithMetrics(metrics *Metrics, skipMethods ...string) grpc.UnaryServerInterceptor

Types

type Metrics added in v1.2.2

type Metrics struct {
	RequestDuration *prometheus.HistogramVec
	RequestsTotal   *prometheus.CounterVec
	InFlight        *prometheus.GaugeVec
}

func DefaultMetrics added in v1.2.2

func DefaultMetrics() *Metrics

func NewMetrics added in v1.2.2

func NewMetrics(registerer prometheus.Registerer) *Metrics

type RecoveryHandlerContextFunc

type RecoveryHandlerContextFunc func(ctx context.Context, p any) error

Jump to

Keyboard shortcuts

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