const ( Corrupt = "CORRUPT" NoSpace = "NOSPACE" )
var ( // Variables that are to be registered with prometheus. promauto automactically registers // the variable with prometheus. If promauto is not used variable needs to be registered // using prometheus.register. The following variable is of type Gauge metric. EtcdClusterHealth = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "edge_etcd_manager_cluster_health", Help: "Whether the etcd cluster is healthy and has quorum", }, []string{}) EtcdAlarmStateCorrupt = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "edge_etcd_alarm_state_corrupt", Help: "Whether the etcd cluster has a corrupt alarm raised or not", }, []string{}) EtcdAlarmStateNospace = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "edge_etcd_alarm_state_nospace", Help: "Whether the etcd cluster has a nospace alarm raised or not", }, []string{}) )
func ReportAlarmMetrics(alarms []*etcdserverpb.AlarmMember)
ReportAlarmMetrics reports the status of the alarms for each member in the etcd cluster
func ReportHealthMetrics(isHealthy bool)
ReportHealthMetrics exposes the cluster's health as a metric to Prometheus
type Server struct { Router *gin.Engine Port int }
func NewServer(port int) *Server
NewServer creates an etcdmanager metrics server that runs on the desired port.
func (s *Server) Run() error
Run runs the metrics server on the configured port
Builder Object for Server
type ServerBuilder struct { Router *gin.Engine Port int }
func NewServerBuilder() *ServerBuilder
Constructor for ServerBuilder
func (b *ServerBuilder) Build() *Server
Build Method which creates Server
func (b *ServerBuilder) WithPort(port int) *ServerBuilder
WithPort method sets the Port for the ServerBuilder
func (b *ServerBuilder) WithRouter(router *gin.Engine) *ServerBuilder
WithRouter method sets the Router for the ServerBuilder
StateLogger stores the state of the cluster when it was last logged
type StateLogger struct {
// contains filtered or unexported fields
}
func NewStateLogger(level int) StateLogger
NewStateLogger creates a new StateLogger with the given log level
func (sl *StateLogger) HasStateChanged(state bool) bool
HasStateChanged returns true if the state has changed since the last time it was logged
func (sl *StateLogger) Log(state bool)
Log the current state of the cluster
func (sl *StateLogger) LogIfStateChanged(state bool)
LogIfStateChanged logs the current state of the cluster if it has changed since the last time it was logged