Documentation
¶
Index ¶
- Variables
- func RequestDurationMetricHTTPMiddleware(next http.Handler) http.Handler
- func RequestDurationMetricUnaryServerInterceptor(serviceName string) grpc.UnaryServerInterceptor
- func SetRegisterer(r prometheus.Registerer)
- type Config
- type Counter
- type CounterOpts
- type CounterVec
- type GRPCConnectionMonitor
- type GRPCService
- type Gauge
- type GaugeOpts
- type GaugeVec
- type Histogram
- type HistogramOpts
- type HistogramVec
- type Option
- type Server
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyHost = errors.New("host cannot be empty") ErrZeroPort = errors.New("port cannot be zero") )
var ( // Registerer allows custom metric registration. Registerer = prometheus.DefaultRegisterer )
Functions ¶
func RequestDurationMetricHTTPMiddleware ¶
RequestDurationMetricHTTPMiddleware tracks HTTP request duration and count.
func RequestDurationMetricUnaryServerInterceptor ¶
func RequestDurationMetricUnaryServerInterceptor(serviceName string) grpc.UnaryServerInterceptor
RequestDurationMetricUnaryServerInterceptor tracks gRPC request duration and count.
func SetRegisterer ¶
func SetRegisterer(r prometheus.Registerer)
SetRegisterer sets a custom Prometheus registerer.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config defines the metrics server configuration.
type CounterOpts ¶
type CounterOpts = prometheus.CounterOpts
Metric types (aliases from Prometheus).
type CounterVec ¶
type CounterVec = prometheus.CounterVec
Metric types (aliases from Prometheus).
func NewCounterVec ¶
func NewCounterVec(opts CounterOpts, labels []string) *CounterVec
NewCounterVec creates a CounterVec metric.
type GRPCConnectionMonitor ¶
type GRPCConnectionMonitor struct {
// contains filtered or unexported fields
}
GRPCConnectionMonitor periodically checks gRPC service health.
func NewGRPCConnectionMonitor ¶
func NewGRPCConnectionMonitor( service GRPCService, pingTimer time.Duration, serviceFrom string, serviceTo string, ) *GRPCConnectionMonitor
NewGRPCConnectionMonitor creates a new monitor.
func (*GRPCConnectionMonitor) Close ¶
func (s *GRPCConnectionMonitor) Close() error
Close stops the monitor.
func (*GRPCConnectionMonitor) IsAvailable ¶ added in v1.0.2
func (s *GRPCConnectionMonitor) IsAvailable() bool
IsAvailable returns the current connection status.
func (*GRPCConnectionMonitor) Start ¶
func (s *GRPCConnectionMonitor) Start(ctx context.Context)
Start begins health checks.
type GRPCService ¶
type GRPCService interface {
Connection() grpc.ClientConnInterface
}
GRPCService defines the interface for gRPC connections.
type GaugeVec ¶
type GaugeVec = prometheus.GaugeVec
Metric types (aliases from Prometheus).
func NewGaugeVec ¶
NewGaugeVec creates a GaugeVec metric.
type Histogram ¶
type Histogram = prometheus.Histogram
Metric types (aliases from Prometheus).
func NewHistogram ¶
func NewHistogram(opts HistogramOpts) Histogram
NewHistogram creates a Histogram metric.
type HistogramOpts ¶
type HistogramOpts = prometheus.HistogramOpts
Metric types (aliases from Prometheus).
type HistogramVec ¶
type HistogramVec = prometheus.HistogramVec
Metric types (aliases from Prometheus).
func NewHistogramVec ¶
func NewHistogramVec(opts HistogramOpts, labels []string) *HistogramVec
NewHistogramVec creates a HistogramVec metric.
type Option ¶
type Option func(*Config)
Option configures the Config.
func WithReadHeaderTimeout ¶
WithReadHeaderTimeout sets the read header timeout (default: 5s).
func WithReadTimeout ¶
WithReadTimeout sets the read timeout (default: 10s).
func WithWriteTimeout ¶
WithWriteTimeout sets the write timeout (default: 10s).