Documentation ¶
Overview ¶
Package stats defines a standard interface for cluster statistics.
Index ¶
- type CountsStats
- type LatencyStats
- type PeerStats
- type PeersStats
- type RequestStats
- type Stats
- type TransportStats
- func (ss *TransportStats) BecomeLeader()
- func (ss *TransportStats) Initialize()
- func (ss *TransportStats) JSON() []byte
- func (ss *TransportStats) RecvAppendReq(leader string, reqSize int)
- func (ss *TransportStats) RecvRates() (float64, float64)
- func (ss *TransportStats) SendAppendReq(reqSize int)
- func (ss *TransportStats) SendRates() (float64, float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountsStats ¶
CountsStats encapsulates raft statistics.
type LatencyStats ¶
type LatencyStats struct { Current float64 `json:"current"` Average float64 `json:"average"` StandardDeviation float64 `json:"standardDeviation"` Minimum float64 `json:"minimum"` Maximum float64 `json:"maximum"` // contains filtered or unexported fields }
LatencyStats encapsulates latency statistics.
type PeerStats ¶
type PeerStats struct { Latency LatencyStats `json:"latency"` Counts CountsStats `json:"counts"` sync.Mutex }
PeerStats encapsulates various statistics about a follower in an raft cluster
type PeersStats ¶
type PeersStats struct { // clarify that these are IDs, not names Peers map[string]*PeerStats `json:"peers"` sync.Mutex }
encapsulates statistics about communication with its peers
func NewPeersStats ¶
func NewPeersStats() *PeersStats
func (*PeersStats) JSON ¶
func (ls *PeersStats) JSON() []byte
func (*PeersStats) Peer ¶
func (ls *PeersStats) Peer(name string) *PeerStats
func (*PeersStats) RemovePeer ¶
func (ls *PeersStats) RemovePeer(name string)
type RequestStats ¶
RequestStats represent the stats for a request. It encapsulates the sending time and the size of the request.
type Stats ¶
type Stats interface { // SelfStats returns the struct representing statistics of this server SelfStats() []byte // LeaderStats returns the statistics of all followers in the cluster // if this server is leader. Otherwise, nil is returned. LeaderStats() []byte // StoreStats returns statistics of the store backing this Server StoreStats() []byte }
type TransportStats ¶
type TransportStats struct { Name string `json:"name"` // ID is the raft ID of the node. // TODO(jonboulle): use ID instead of name? ID string `json:"id"` State raft.StateType `json:"state"` StartTime time.Time `json:"startTime"` LeaderInfo struct { Name string `json:"leader"` Uptime string `json:"uptime"` StartTime time.Time `json:"startTime"` } `json:"leaderInfo"` RecvAppendRequestCnt uint64 `json:"recvAppendRequestCnt,"` RecvingPkgRate float64 `json:"recvPkgRate,omitempty"` RecvingBandwidthRate float64 `json:"recvBandwidthRate,omitempty"` SendAppendRequestCnt uint64 `json:"sendAppendRequestCnt"` SendingPkgRate float64 `json:"sendPkgRate,omitempty"` SendingBandwidthRate float64 `json:"sendBandwidthRate,omitempty"` sync.Mutex // contains filtered or unexported fields }
TransportStats encapsulates various statistics about an raft Server and its communication with other members of the cluster
func (*TransportStats) BecomeLeader ¶
func (ss *TransportStats) BecomeLeader()
func (*TransportStats) Initialize ¶
func (ss *TransportStats) Initialize()
Initialize clears the statistics of TransportStats and resets its start time
func (*TransportStats) JSON ¶
func (ss *TransportStats) JSON() []byte
func (*TransportStats) RecvAppendReq ¶
func (ss *TransportStats) RecvAppendReq(leader string, reqSize int)
RecvAppendReq updates the TransportStats in response to an AppendRequest from the given leader being received
func (*TransportStats) RecvRates ¶
func (ss *TransportStats) RecvRates() (float64, float64)
RecvRates calculates and returns the rate of received append requests
func (*TransportStats) SendAppendReq ¶
func (ss *TransportStats) SendAppendReq(reqSize int)
SendAppendReq updates the TransportStats in response to an AppendRequest being sent by this server
func (*TransportStats) SendRates ¶
func (ss *TransportStats) SendRates() (float64, float64)
SendRates calculates and returns the rate of sent append requests