stats

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package stats defines a standard interface for cluster statistics.

Index

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 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

func (*PeerStats) Fail

func (fs *PeerStats) Fail()

Fail updates the PeerStats with an unsuccessful send

func (*PeerStats) Succ

func (fs *PeerStats) Succ(d time.Duration)

Succ updates the PeerStats with a successful send

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

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 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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL