monitoring

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeMetricsURL

func MakeMetricsURL(address string, tlsConf *connection.TLSConfig) (string, error)

MakeMetricsURL construct the Prometheus metrics URL. based on the secure level, we set the url scheme to http or https.

func RegisterMonitoringServer added in v1.0.0

func RegisterMonitoringServer(mux *http.ServeMux, p *Provider)

RegisterMonitoringServer registers the monitoring endpoints with the provided HTTP mux. It sets up Prometheus metrics endpoint and pprof profiling handlers. It uses the similar signature as GRPC server registration to allow common language for all server<->service interfaces.

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.

func WaitForConnections

func WaitForConnections(t *testing.T, p *Provider, name string, requiredCount int)

WaitForConnections waits for a connection metric to have the required number of connected labels.

Types

type ConnectionMetrics

type ConnectionMetrics struct {
	Status       *prometheus.GaugeVec
	FailureTotal *prometheus.CounterVec
	// contains filtered or unexported fields
}

ConnectionMetrics supports common connection metrics.

func NewConnectionMetrics added in v1.0.0

func NewConnectionMetrics(p *Provider, params MetricsParameters) *ConnectionMetrics

NewConnectionMetrics 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 ExpectedConn

type ExpectedConn struct {
	Status       int
	FailureTotal int
}

ExpectedConn is used to describe the expected connection state.

type MetricsParameters added in v1.0.0

type MetricsParameters struct {
	Namespace string
	Subsystem string
}

MetricsParameters describes metrics namespace and subsystem.

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) 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) Registry

func (p *Provider) Registry() *prometheus.Registry

Registry returns the prometheus registry.

type ThroughputMetrics added in v1.0.0

type ThroughputMetrics struct {
	Input  prometheus.Counter
	Output prometheus.Counter
}

ThroughputMetrics supports common throughput metrics.

func NewThroughputMetrics added in v1.0.0

func NewThroughputMetrics(p *Provider, params MetricsParameters) *ThroughputMetrics

NewThroughputMetrics creates a new prometheus throughput counter.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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