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
- type Config
- type Monitor
- func (mon *Monitor) Alerts() <-chan *api.Alert
- func (mon *Monitor) LatestMetrics(ctx context.Context, name string) []*api.Metric
- func (mon *Monitor) LogMetric(ctx context.Context, m *api.Metric) error
- func (mon *Monitor) PublishMetric(ctx context.Context, m *api.Metric) error
- func (mon *Monitor) SetClient(c *rpc.Client)
- func (mon *Monitor) Shutdown(ctx context.Context) error
Constants ¶
const (
DefaultCheckInterval = 15 * time.Second
)
Default values for this Config.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.2.0
Config allows to initialize a Monitor and customize some parameters.
func (*Config) ApplyEnvVars ¶ added in v0.10.0
ApplyEnvVars fills in any Config fields found as environment variables.
func (*Config) ConfigKey ¶ added in v0.2.0
ConfigKey provides a human-friendly identifier for this type of Config.
func (*Config) LoadJSON ¶ added in v0.2.0
LoadJSON sets the fields of this Config to the values defined by the JSON representation of it, as generated by ToJSON.
type Monitor ¶ added in v0.2.0
type Monitor struct {
// contains filtered or unexported fields
}
Monitor is a component in charge of monitoring peers, logging metrics and detecting failures
func NewMonitor ¶ added in v0.2.0
NewMonitor creates a new monitor using the given config.
func (*Monitor) Alerts ¶ added in v0.2.0
Alerts returns a channel on which alerts are sent when the monitor detects a failure.
func (*Monitor) LatestMetrics ¶ added in v0.4.0
LatestMetrics 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 peers.
func (*Monitor) PublishMetric ¶ added in v0.4.0
PublishMetric broadcasts a metric to all current cluster peers.