Documentation ¶
Index ¶
- Constants
- func RecalculateNetworkUptimeEvery(d time.Duration) func(m *Monitor)
- func SetCheckIsValidatorInterval(d time.Duration) func(n *Node)
- func SetNumValidatorsUpdateInterval(d time.Duration) func(m *Monitor)
- func UnmarshalEvent(b json.RawMessage) (string, events.EventData, error)
- type Health
- type Monitor
- type Network
- func (n *Network) GetHealthString() string
- func (n *Network) NewBlock(b tmtypes.Header)
- func (n *Network) NewBlockLatency(l float64)
- func (n *Network) NewNode(name string)
- func (n *Network) NodeDeleted(name string)
- func (n *Network) NodeIsDown(name string)
- func (n *Network) NodeIsOnline(name string)
- func (n *Network) RecalculateUptime()
- func (n *Network) StartTime() time.Time
- func (n *Network) UpdateNumValidatorsForHeight(num int, height int64)
- func (n *Network) Uptime() float64
- type Node
- func (n *Node) NotifyAboutDisconnects(ch chan<- bool)
- func (n *Node) NumValidators() (height int64, num int, err error)
- func (n *Node) RestartEventMeterBackoff() error
- func (n *Node) SendBlockLatenciesTo(ch chan<- float64)
- func (n *Node) SendBlocksTo(ch chan<- tmtypes.Header)
- func (n *Node) SetLogger(l log.Logger)
- func (n *Node) Start() error
- func (n *Node) Stop()
- type UptimeData
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func RecalculateNetworkUptimeEvery ¶
RecalculateNetworkUptimeEvery lets you change network uptime update interval.
func SetCheckIsValidatorInterval ¶
SetCheckIsValidatorInterval lets you change interval for checking whenever node is still a validator or not.
func SetNumValidatorsUpdateInterval ¶
SetNumValidatorsUpdateInterval lets you change num validators update interval.
Types ¶
type Health ¶
type Health int
Health describes the health of the network. Note that this applies only to the observed nodes, and not to the entire cluster, which may consist of thousands of machines. It may change in the future.
type Monitor ¶
Monitor keeps track of the nodes and updates common statistics upon receiving new events from nodes.
Common statistics is stored in Network struct.
func NewMonitor ¶
NewMonitor creates new instance of a Monitor. You can provide options to change some default values.
Example:
NewMonitor(monitor.SetNumValidatorsUpdateInterval(1 * time.Second))
func (*Monitor) Monitor ¶
Monitor begins to monitor the node `n`. The node will be started and added to the monitor.
func (*Monitor) NodeByName ¶
NodeByName returns the node and its index if such node exists within the monitor. Otherwise, -1 and nil are returned.
func (*Monitor) NodeIsOnline ¶
NodeIsOnline is called when connection to the node is restored. Must be safe to call multiple times.
func (*Monitor) SetLogger ¶
SetLogger lets you set your own logger
func (*Monitor) Start ¶
Start starts the monitor's routines: recalculating network uptime and updating number of validators.
type Network ¶
type Network struct { Height int64 `json:"height"` AvgBlockTime float64 `json:"avg_block_time" amino:"unsafe"` // ms (avg over last minute) AvgTxThroughput float64 `json:"avg_tx_throughput" amino:"unsafe"` // tx/s (avg over last minute) AvgBlockLatency float64 `json:"avg_block_latency" amino:"unsafe"` // ms (avg over last minute) NumValidators int `json:"num_validators"` NumNodesMonitored int `json:"num_nodes_monitored"` NumNodesMonitoredOnline int `json:"num_nodes_monitored_online"` Health Health `json:"health"` UptimeData *UptimeData `json:"uptime_data"` // contains filtered or unexported fields }
Common statistics for network of nodes
func (*Network) NewNode ¶
NewNode is called when the new node is added to the monitor.
func (*Network) NodeDeleted ¶
NodeDeleted is called when the node is deleted from under the monitor.
func (*Network) NodeIsDown ¶
NodeIsDown is called when the node disconnects for whatever reason. Must be safe to call multiple times.
func (*Network) NodeIsOnline ¶
NodeIsOnline is called when connection to the node is restored. Must be safe to call multiple times.
func (*Network) RecalculateUptime ¶
func (n *Network) RecalculateUptime()
RecalculateUptime calculates uptime on demand.
func (*Network) StartTime ¶
StartTime returns time we started monitoring.
func (*Network) UpdateNumValidatorsForHeight ¶
type Node ¶
type Node struct { IsValidator bool `json:"is_validator"` // validator or non-validator? Name string `json:"name"` Online bool `json:"online"` Height int64 `json:"height"` BlockLatency float64 `json:"block_latency" amino:"unsafe"` // ms, interval between block commits // contains filtered or unexported fields }
func NewNodeWithEventMeterAndRpcClient ¶
func NewNodeWithEventMeterAndRpcClient(rpcAddr string, em eventMeter, rpcClient rpc_client.HTTPClient, options ...func(*Node)) *Node
func (*Node) SetLogger ¶
SetLogger lets you set your own logger