package grpc import ( "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics" grpcprom "github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus" "github.com/prometheus/client_golang/prometheus" "google.golang.org/grpc" ) var serverMetrics *grpcprom.ServerMetrics = grpcprom.NewServerMetrics( grpcprom.WithServerHandlingTimeHistogram( grpcprom.WithHistogramBuckets(prometheus.DefBuckets), ), ) func init() { metrics.Register(serverMetrics) } // NewUnaryServerInterceptor returns server interceptor to collect metrics from unary RPCs. func NewUnaryServerInterceptor() grpc.UnaryServerInterceptor { return serverMetrics.UnaryServerInterceptor() } // NewStreamServerInterceptor returns server interceptor to collect metrics from stream RPCs. func NewStreamServerInterceptor() grpc.StreamServerInterceptor { return serverMetrics.StreamServerInterceptor() }