Help us shape the future of Go! Take the 2026 Go Developer Survey

metrics

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCheckBuckets

func GenerateCheckBuckets(timeout time.Duration) []float64

GenerateCheckBuckets computes histogram buckets for check durations based on the check timeout. Buckets cover 0 to timeout with linear spacing, plus exponential subdivisions near zero for fine-grained latency visibility. A small overrun bucket beyond nominal timeout captures scheduling jitter.

Types

type Metrics

type Metrics struct {
	Registry *prometheus.Registry

	// VIP state: 0=withdrawn, 1=announced, 2=pessimized
	VIPState *prometheus.GaugeVec
	// VIP transitions counter
	VIPTransitions *prometheus.CounterVec
	// VIP last transition timestamp
	VIPLastTransition *prometheus.GaugeVec
	// VIP priority: AS-path prepend count currently applied (base while
	// announced, base + lower_priority while pessimized)
	VIPPriority *prometheus.GaugeVec
	// VIPLocalAddress is 1 while the VIP address is configured on a local
	// interface; only populated for VIPs with require_local_address.
	VIPLocalAddress *prometheus.GaugeVec

	// Route state: per-peer per-VIP (1=advertised, 0=withdrawn)
	RouteState *prometheus.GaugeVec

	// Check counters by result (success/fail/stale)
	CheckTotal *prometheus.CounterVec
	// Check duration histogram
	CheckDuration *prometheus.HistogramVec
	// Check last result (0=fail, 1=ok)
	CheckLastResult *prometheus.GaugeVec
	// Check timeout exceeded
	CheckTimeoutExceeded *prometheus.CounterVec

	// Per-check-type details, populated only for VIPs with
	// check.detailed_metrics enabled (see ObserveCheckDetails).
	PingRTT            *prometheus.HistogramVec
	PingPacketLoss     *prometheus.GaugeVec
	HTTPResponseStatus *prometheus.GaugeVec
	HTTPTLSCertExpiry  *prometheus.GaugeVec
	DNSRcode           *prometheus.GaugeVec
	DNSAnswers         *prometheus.GaugeVec
	GRPCStatusCode     *prometheus.GaugeVec
	ListenSockets      *prometheus.GaugeVec
	SQLQueryRows       *prometheus.GaugeVec
	SQLQueryDuration   *prometheus.GaugeVec
	SQLQueryPassed     *prometheus.GaugeVec
	KafkaBrokers       *prometheus.GaugeVec
	KafkaLeaderless    *prometheus.GaugeVec

	// Config reload bookkeeping (see internal/reload).
	ConfigReloadTotal         *prometheus.CounterVec
	ConfigLastReloadSuccess   prometheus.Gauge
	ConfigLastReloadTimestamp prometheus.Gauge
	ConfigLoadedTimestamp     prometheus.Gauge
	ConfigFileChanged         prometheus.Gauge
	ConfigReloadPendingVIPs   prometheus.Gauge
}

Metrics holds all pathosd-specific Prometheus metrics.

func New

func New(checkBuckets []float64) *Metrics

New creates a new Metrics instance with all collectors registered. checkBuckets are the histogram bucket boundaries for check duration; pass nil to skip histogram creation.

func (*Metrics) DeleteCheckSeries added in v0.14.0

func (m *Metrics) DeleteCheckSeries(vip, check string)

DeleteCheckSeries drops the series of one check of a VIP.

func (*Metrics) DeleteVIPSeries added in v0.14.0

func (m *Metrics) DeleteVIPSeries(vip string)

DeleteVIPSeries drops every series of a VIP removed by a config reload, so /metrics stops reporting a state for it.

func (*Metrics) ObserveCheckDetails added in v0.12.0

func (m *Metrics) ObserveCheckDetails(vip, nlri, check string, details model.CheckDetails)

ObserveCheckDetails exports check-type-specific observations for a VIP. Callers gate it on check.detailed_metrics; nil details are ignored.

Jump to

Keyboard shortcuts

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