Documentation
¶
Index ¶
- func MakeMetricsURL(address string) (string, error)
- func RequireConnectionMetrics(t *testing.T, label string, connMetrics *ConnectionMetrics, ...)
- func WaitForConnections(t *testing.T, p *Provider, name string, requiredCount int)
- type Config
- type ConnectionMetrics
- type ConnectionMetricsOpts
- type ExpectedConn
- type Provider
- func (p *Provider) NewConnectionMetrics(opts ConnectionMetricsOpts) *ConnectionMetrics
- func (p *Provider) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
- func (p *Provider) NewCounterVec(opts prometheus.CounterOpts, labels []string) *prometheus.CounterVec
- func (p *Provider) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
- func (p *Provider) NewGaugeVec(opts prometheus.GaugeOpts, labels []string) *prometheus.GaugeVec
- func (p *Provider) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
- func (p *Provider) NewHistogramVec(opts prometheus.HistogramOpts, labels []string) *prometheus.HistogramVec
- func (p *Provider) NewThroughputCounter(component, subComponent string, direction ThroughputDirection) prometheus.Counter
- func (p *Provider) Registry() *prometheus.Registry
- func (p *Provider) StartPrometheusServer(ctx context.Context, serverConfig *connection.ServerConfig, ...) error
- func (p *Provider) URL() string
- type ThroughputDirection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeMetricsURL ¶
MakeMetricsURL construct the Prometheus metrics URL.
func RequireConnectionMetrics ¶
func RequireConnectionMetrics( t *testing.T, label string, connMetrics *ConnectionMetrics, expected ExpectedConn, )
RequireConnectionMetrics waits for a connection status and a specified number of failures.
Types ¶
type Config ¶
type Config struct {
Server *connection.ServerConfig `mapstructure:"server"`
}
Config represents the monitoring configuration.
type ConnectionMetrics ¶
type ConnectionMetrics struct { Status *prometheus.GaugeVec FailureTotal *prometheus.CounterVec // contains filtered or unexported fields }
ConnectionMetrics supports common connection metrics.
func (*ConnectionMetrics) Connected ¶
func (m *ConnectionMetrics) Connected(grpcTarget string)
Connected observed connected.
func (*ConnectionMetrics) Disconnected ¶
func (m *ConnectionMetrics) Disconnected(grpcTarget string)
Disconnected observe disconnected. The failure count is increased only if the status was connected.
type ConnectionMetricsOpts ¶
ConnectionMetricsOpts describes connection metrics parameters.
type ExpectedConn ¶
ExpectedConn is used to describe the expected connection state.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a prometheus metrics provider.
func NewProvider ¶
func NewProvider() *Provider
NewProvider creates a new prometheus metrics provider.
func (*Provider) NewConnectionMetrics ¶
func (p *Provider) NewConnectionMetrics(opts ConnectionMetricsOpts) *ConnectionMetrics
NewConnectionMetrics supports common connection metrics.
func (*Provider) NewCounter ¶
func (p *Provider) NewCounter(opts prometheus.CounterOpts) prometheus.Counter
NewCounter creates a new prometheus counter.
func (*Provider) NewCounterVec ¶
func (p *Provider) NewCounterVec(opts prometheus.CounterOpts, labels []string) *prometheus.CounterVec
NewCounterVec creates a new prometheus counter vector.
func (*Provider) NewGauge ¶
func (p *Provider) NewGauge(opts prometheus.GaugeOpts) prometheus.Gauge
NewGauge creates a new prometheus gauge.
func (*Provider) NewGaugeVec ¶
func (p *Provider) NewGaugeVec(opts prometheus.GaugeOpts, labels []string) *prometheus.GaugeVec
NewGaugeVec creates a new prometheus gauge vector.
func (*Provider) NewHistogram ¶
func (p *Provider) NewHistogram(opts prometheus.HistogramOpts) prometheus.Histogram
NewHistogram creates a new prometheus histogram.
func (*Provider) NewHistogramVec ¶
func (p *Provider) NewHistogramVec(opts prometheus.HistogramOpts, labels []string) *prometheus.HistogramVec
NewHistogramVec creates a new prometheus histogram vector.
func (*Provider) NewThroughputCounter ¶
func (p *Provider) NewThroughputCounter( component, subComponent string, direction ThroughputDirection, ) prometheus.Counter
NewThroughputCounter creates a new prometheus throughput counter.
func (*Provider) Registry ¶
func (p *Provider) Registry() *prometheus.Registry
Registry returns the prometheus registry.
func (*Provider) StartPrometheusServer ¶
func (p *Provider) StartPrometheusServer( ctx context.Context, serverConfig *connection.ServerConfig, monitor ...func(context.Context), ) error
StartPrometheusServer starts a prometheus server. It also starts the given monitoring methods. Their context will cancel once the server is cancelled. This method returns once the server is shutdown and all monitoring methods returns.
type ThroughputDirection ¶
type ThroughputDirection = string
ThroughputDirection can in or out.
const ( In ThroughputDirection = "in" Out ThroughputDirection = "out" )
Direction constants.