Documentation ¶
Overview ¶
Package metrics is grpc's server-side and client-side metrics can continue to be captured using prometheus.
Index ¶
- func ClientHTTPService(addr string) *http.Server
- func ClientRegister(mux *http.ServeMux)
- func Register(mux *http.ServeMux, grpcServer *grpc.Server)
- func ServerHTTPService(addr string, grpcServer *grpc.Server) *http.Server
- func SetClientPattern(pattern string)
- func SetServerPattern(pattern string)
- func StreamClientMetrics() grpc.StreamClientInterceptor
- func StreamServerMetrics(opts ...Option) grpc.StreamServerInterceptor
- func UnaryClientMetrics() grpc.UnaryClientInterceptor
- func UnaryServerMetrics(opts ...Option) grpc.UnaryServerInterceptor
- type ConnectionOption
- type CustomConn
- type CustomListener
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientHTTPService ¶
ClientHTTPService initialize the client's prometheus exporter service and use http://ip:port/metrics to fetch data
func ClientRegister ¶ added in v1.2.0
ClientRegister for http routing and grpc methods
func ServerHTTPService ¶ added in v1.2.0
ServerHTTPService initialize the prometheus exporter service on the server side and fetch data using http://ip:port/metrics
func SetClientPattern ¶ added in v1.2.0
func SetClientPattern(pattern string)
SetClientPattern set the client pattern
func SetServerPattern ¶ added in v1.2.0
func SetServerPattern(pattern string)
SetServerPattern set the server pattern
func StreamClientMetrics ¶
func StreamClientMetrics() grpc.StreamClientInterceptor
StreamClientMetrics metrics stream interceptor
func StreamServerMetrics ¶
func StreamServerMetrics(opts ...Option) grpc.StreamServerInterceptor
StreamServerMetrics metrics stream interceptor
func UnaryClientMetrics ¶
func UnaryClientMetrics() grpc.UnaryClientInterceptor
UnaryClientMetrics metrics unary interceptor
func UnaryServerMetrics ¶
func UnaryServerMetrics(opts ...Option) grpc.UnaryServerInterceptor
UnaryServerMetrics metrics unary interceptor
Types ¶
type ConnectionOption ¶ added in v1.10.2
type ConnectionOption func(*connectionOptions)
ConnectionOption set connection option
func WithConnectionsGauge ¶ added in v1.10.2
func WithConnectionsGauge() ConnectionOption
WithConnectionsGauge set prometheus gauge for connections
func WithConnectionsLogger ¶ added in v1.10.2
func WithConnectionsLogger(l *zap.Logger) ConnectionOption
WithConnectionsLogger set logger for connection
type CustomConn ¶ added in v1.10.2
CustomConn custom connections, intercept disconnected behavior
func (*CustomConn) Close ¶ added in v1.10.2
func (c *CustomConn) Close() error
Close closes the listener, any blocked except operations will be unblocked and return errors.
type CustomListener ¶ added in v1.10.2
CustomListener custom listener for counting connections
func NewCustomListener ¶ added in v1.10.2
func NewCustomListener(listener net.Listener, opts ...ConnectionOption) *CustomListener
NewCustomListener creates a new custom listener.
func (*CustomListener) Accept ¶ added in v1.10.2
func (l *CustomListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener.
func (*CustomListener) GetActiveConnections ¶ added in v1.10.2
func (l *CustomListener) GetActiveConnections() int
GetActiveConnections returns the number of active connections.
type Option ¶ added in v1.2.0
type Option func(*options)
Option set metrics
func WithCounterMetrics ¶
func WithCounterMetrics(metrics ...*prometheus.CounterVec) Option
WithCounterMetrics add Counter type indicator
func WithGaugeMetrics ¶
func WithGaugeMetrics(metrics ...*prometheus.GaugeVec) Option
WithGaugeMetrics add Gauge type indicator
func WithHistogramMetrics ¶
func WithHistogramMetrics(metrics ...*prometheus.HistogramVec) Option
WithHistogramMetrics adding Histogram type indicators
func WithSummaryMetrics ¶
func WithSummaryMetrics(metrics ...*prometheus.SummaryVec) Option
WithSummaryMetrics add Summary type indicator