Documentation
¶
Overview ¶
Package stats defines a standard interface for etcd cluster statistics.
Index ¶
- type CountsStats
- type FollowerStats
- type LatencyStats
- type LeaderStats
- type RequestStats
- type ServerStats
- func (ss *ServerStats) BecomeLeader()
- func (ss *ServerStats) Initialize()
- func (ss *ServerStats) JSON() []byte
- func (ss *ServerStats) RecvAppendReq(leader string, reqSize int)
- func (ss *ServerStats) RecvRates() (float64, float64)
- func (ss *ServerStats) SendAppendReq(reqSize int)
- func (ss *ServerStats) SendRates() (float64, float64)
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountsStats ¶
type CountsStats struct {
Fail uint64 `json:"fail"`
Success uint64 `json:"success"`
}
CountsStats encapsulates raft statistics.
type FollowerStats ¶
type FollowerStats struct {
Latency LatencyStats `json:"latency"`
Counts CountsStats `json:"counts"`
sync.Mutex
}
FollowerStats encapsulates various statistics about a follower in an etcd cluster
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 LeaderStats ¶
type LeaderStats struct {
// Leader is the ID of the leader in the etcd cluster.
// TODO(jonboulle): clarify that these are IDs, not names
Leader string `json:"leader"`
Followers map[string]*FollowerStats `json:"followers"`
sync.Mutex
}
LeaderStats is used by the leader in an etcd cluster, and encapsulates statistics about communication with its followers
func NewLeaderStats ¶
func NewLeaderStats(id string) *LeaderStats
NewLeaderStats generates a new LeaderStats with the given id as leader
type RequestStats ¶
type RequestStats struct {
SendingTime time.Time
Size int
}
RequestStats represent the stats for a request. It encapsulates the sending time and the size of the request.
type ServerStats ¶
type ServerStats 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
}
ServerStats encapsulates various statistics about an EtcdServer and its communication with other members of the cluster
func (*ServerStats) BecomeLeader ¶
func (ss *ServerStats) BecomeLeader()
func (*ServerStats) Initialize ¶
func (ss *ServerStats) Initialize()
Initialize clears the statistics of ServerStats and resets its start time
func (*ServerStats) RecvAppendReq ¶
func (ss *ServerStats) RecvAppendReq(leader string, reqSize int)
RecvAppendReq updates the ServerStats in response to an AppendRequest from the given leader being received
func (*ServerStats) RecvRates ¶
func (ss *ServerStats) RecvRates() (float64, float64)
RecvRates calculates and returns the rate of received append requests
func (*ServerStats) SendAppendReq ¶
func (ss *ServerStats) SendAppendReq(reqSize int)
SendAppendReq updates the ServerStats in response to an AppendRequest being sent by this server
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 EtcdServer
StoreStats() []byte
}