Documentation ¶
Index ¶
- func AddHookAfterTableDropped(hk HookAfterTableDropped)
- func AddHookAfterTableStatEmitted(hk HookAfterTableStatEmitted)
- func AllMetrics() (res []string)
- func Start(tom *tomb.Tomb)
- type ClusterStats
- type HookAfterTableDropped
- type HookAfterTableStatEmitted
- type NodeStat
- type PartitionStats
- type PerfClient
- type PerfCounter
- type PerfSession
- type TableStats
- type TableStatsAggregator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHookAfterTableDropped ¶
func AddHookAfterTableDropped(hk HookAfterTableDropped)
AddHookAfterTableDropped adds a hook of event that a table is dropped.
func AddHookAfterTableStatEmitted ¶
func AddHookAfterTableStatEmitted(hk HookAfterTableStatEmitted)
AddHookAfterTableStatEmitted adds a hook of event that a new TableStats is generated.
func AllMetrics ¶
func AllMetrics() (res []string)
AllMetrics returns metrics tracked within this collector. The sets of metrics from cluster level and table level are completely equal.
Types ¶
type ClusterStats ¶
ClusterStats is the aggregated metrics for all the TableStats in this cluster. For example, 3 tables with "write_qps" [25, 70, 100] are summed up to `Stats: {"write_qps" : 195}`.
func SnapshotClusterStats ¶
func SnapshotClusterStats() []ClusterStats
SnapshotClusterStats takes a snapshot from the history. The returned array is ordered by time.
type HookAfterTableDropped ¶
type HookAfterTableDropped func(appID int)
HookAfterTableDropped is a hook of event that a table is dropped.
type HookAfterTableStatEmitted ¶
type HookAfterTableStatEmitted func(stats []TableStats, allStats ClusterStats)
HookAfterTableStatEmitted is a hook of event that new TableStats are generated. Each call of the hook handles a batch of tables.
type NodeStat ¶
type NodeStat struct { // Address of the replica node. Addr string // perfCounter's name -> the value. Stats map[string]float64 }
NodeStat contains the stats of a replica node.
type PartitionStats ¶
type PartitionStats struct { Gpid base.Gpid // Address of the primary where this partition locates. Addr string // perfCounter's name -> the value. Stats map[string]float64 }
PartitionStats is a set of metrics retrieved from this partition.
type PerfClient ¶
type PerfClient struct {
// contains filtered or unexported fields
}
PerfClient manages sessions to all replica nodes.
func NewPerfClient ¶
func NewPerfClient(metaAddrs []string) *PerfClient
NewPerfClient returns an instance of PerfClient.
func (*PerfClient) GetNodeStats ¶
func (m *PerfClient) GetNodeStats(filter string) ([]*NodeStat, error)
GetNodeStats retrieves all the stats matched with `filter` from replica nodes.
func (*PerfClient) GetPartitionStats ¶
func (m *PerfClient) GetPartitionStats() ([]*PartitionStats, error)
GetPartitionStats retrieves all the partition stats from replica nodes. NOTE: Only the primaries are counted.
type PerfCounter ¶
PerfCounter is a Pegasus perf-counter.
func (*PerfCounter) String ¶
func (p *PerfCounter) String() string
type PerfSession ¶
type PerfSession struct { session.NodeSession Address string }
PerfSession is a client to get perf-counters from a Pegasus ReplicaServer.
func NewPerfSession ¶
func NewPerfSession(addr string) *PerfSession
NewPerfSession returns an instance of PerfSession.
func WrapPerf ¶
func WrapPerf(addr string, session session.NodeSession) *PerfSession
WrapPerf returns an instance of PerfSession using an existed session.
func (*PerfSession) GetPerfCounters ¶
func (c *PerfSession) GetPerfCounters(filter string) ([]*PerfCounter, error)
GetPerfCounters retrieves all perf-counters matched with `filter` from the remote node.
type TableStats ¶
type TableStats struct { TableName string AppID int Partitions map[int]*PartitionStats // the time when the stats was generated Timestamp time.Time // The aggregated value of table metrics. // perfCounter's name -> the value. Stats map[string]float64 }
TableStats has the aggregated metrics for this table.
type TableStatsAggregator ¶
type TableStatsAggregator interface { Aggregate() (map[int32]*TableStats, *ClusterStats, error) Close() }
TableStatsAggregator aggregates the metric on each partition into table-level metrics. It's reponsible for all tables in the pegasus cluster. After all TableStats have been collected, TableStatsAggregator sums them up into a ClusterStats. Users of this pacakage can use the hooks to watch every changes of the stats.
func NewTableStatsAggregator ¶
func NewTableStatsAggregator(metaAddrs []string) TableStatsAggregator
NewTableStatsAggregator returns a TableStatsAggregator instance.