Documentation ¶
Overview ¶
Package basic implements a basic PeerMonitor component for IPFS Cluster. This component is in charge of logging metrics and triggering alerts when a peer goes down.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AlertChannelCap = 256
AlertChannelCap specifies how much buffer the alerts channel has.
var WindowCap = 10
WindowCap specifies how many metrics to keep for given host and metric type
Functions ¶
This section is empty.
Types ¶
type StdPeerMonitor ¶
type StdPeerMonitor struct {
// contains filtered or unexported fields
}
StdPeerMonitor is a component in charge of monitoring peers, logging metrics and detecting failures
func NewStdPeerMonitor ¶
func NewStdPeerMonitor(monIntervalSecs int) *StdPeerMonitor
NewStdPeerMonitor creates a new monitor. It receives the window capacity (how many metrics to keep for each peer and type of metric) and the monitoringInterval (interval between the checks that produce alerts) as parameters
func (*StdPeerMonitor) Alerts ¶
func (mon *StdPeerMonitor) Alerts() <-chan api.Alert
Alerts returns a channel on which alerts are sent when the monitor detects a failure.
func (*StdPeerMonitor) LastMetrics ¶
func (mon *StdPeerMonitor) LastMetrics(name string) []api.Metric
LastMetrics returns last known VALID metrics of a given type. A metric is only valid if it has not expired and belongs to a current cluster peer.
func (*StdPeerMonitor) LogMetric ¶
func (mon *StdPeerMonitor) LogMetric(m api.Metric)
LogMetric stores a metric so it can later be retrieved.
func (*StdPeerMonitor) SetClient ¶
func (mon *StdPeerMonitor) SetClient(c *rpc.Client)
SetClient saves the given rpc.Client for later use
func (*StdPeerMonitor) Shutdown ¶
func (mon *StdPeerMonitor) Shutdown() error
Shutdown stops the peer monitor. It particular, it will not deliver any alerts.