registry

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	LastUpdated time.Time
	Name        string
	Failures    int
	State       bool
}

Host holds the state of a registered host

func (*Host) IsAlive

func (h *Host) IsAlive() bool

IsAlive reports if the host is up or down. If the host has been unavailable 5 times in a row, it's considered "down". One successful request marks it as "up" again

func (*Host) UpdateStatus

func (h *Host) UpdateStatus(reachable bool)

UpdateStatus updates the status of the host

type Registry

type Registry struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func (*Registry) Cleanup

func (r *Registry) Cleanup()

func (*Registry) Collect

func (r *Registry) Collect(ch chan<- prometheus.Metric)

func (*Registry) Describe

func (r *Registry) Describe(ch chan<- *prometheus.Desc)

func (*Registry) HostState

func (r *Registry) HostState(name string) (bool, bool)

func (*Registry) Hosts

func (r *Registry) Hosts() []*Host

func (*Registry) IsLeading

func (r *Registry) IsLeading() bool

func (*Registry) Leading

func (r *Registry) Leading(leading bool)

func (*Registry) Register

func (r *Registry) Register(name string)

func (*Registry) UpdateHostState

func (r *Registry) UpdateHostState(host string, state bool, reachable bool)

Jump to

Keyboard shortcuts

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