Documentation
¶
Index ¶
- Constants
- Variables
- func GetIndexRule(metric string) string
- type Cluster
- type ClusterCache
- type ClusterItem
- type Context
- type DbItem
- type DbItemCache
- type EsStore
- type MacItem
- type MacItemCache
- type Message
- type Metric
- type NodeThreshold
- type ProcessItem
- type ProcessItemCache
- type RangeThreshold
- type SlowLogItem
- type SqlStore
- type Store
- type TableItem
- type TableItemCache
- type TaskItem
- type ThresholdConfig
Constants ¶
View Source
const ( Type_Cluster = iota Type_Mac Type_Process Type_DB Type_Table )
View Source
const ( TYPE_SQL = "sql" TYPE_ELASTICSEARCH = "elasticsearch" NAMESPACE_CLUSTER = "cluster" NAMESPACE_MAC = "mac" NAMESPACE_PROCESS = "process" NAMESPACE_DB = "db" NAMESPACE_TABLE = "table" NAMESPACE_TASK = "task" NAMESPACE_SCHEDULE = "schedule" NAMESPACE_HOTSPOT = "hotspot" NAMESPACE_NODE = "node" NAMESPACE_RANGE = "range" METRIC_TASK_STATS = "task_stats" METRIC_CLUSTER_META = "cluster_meta" METRIC_CLUSTER_NET = "cluster_net" METRIC_CLUSTER_SLOWLOG = "cluster_slowlog" METRIC_MAC_META = "mac_meta" METRIC_MAC_NET = "mac_net" METRIC_MAC_MEM = "mac_mem" METRIC_MAC_DISK = "mac_disk" METRIC_PROCESS_META = "process_meta" METRIC_PROCESS_DISK = "process_disk" METRIC_PROCESS_NET = "process_net" METRIC_PROCESS_DS = "process_ds" METRIC_DB_META = "db_meta" METRIC_TABLE_META = "table_meta" METRIC_SCHEDULE_COUNTER = "schedule_counter" METRIC_HOTSPOT = "hotspot_stats" METRIC_NODE_STATS = "node_stats" METRIC_RANGE_STATS = "range_stats" )
Variables ¶
View Source
var ( ClusterMetaSQL = `` /* 210-byte string literal not displayed */ ClusterNetSQL = `` /* 229-byte string literal not displayed */ MacMetaSQL = `` /* 176-byte string literal not displayed */ MacNetSQL = `` /* 509-byte string literal not displayed */ MacMemSQL = `` /* 271-byte string literal not displayed */ MacDiskSQL = `` /* 279-byte string literal not displayed */ ProcessMetaSQL = `` /* 197-byte string literal not displayed */ ProcessDiskSQL = `` /* 285-byte string literal not displayed */ ProcessNetSQL = `` /* 342-byte string literal not displayed */ ProcessDsSQL = `` /* 240-byte string literal not displayed */ DbMetaSQL = `insert into db_meta (cluster_id, db_name, table_num, range_size, update_time) values (%d,"%s",%d,%d,%d)` TableMetaSQL = `insert into table_meta (cluster_id, db_name, table_name, range_count, range_size, update_time) values (%d,"%s","%s",%d,%d,%d)` TaskMetaSQL = `insert into task_meta (cluster_id, finish_time, used_time, state, describe, update_time) values (%d,%d,%d,"%s","%s",%d)` RangeStatsSQL = `` /* 173-byte string literal not displayed */ )
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct { ClusterId uint64 Item *ClusterItem DbCache *DbItemCache MacCache *MacItemCache ProcessCache *ProcessItemCache LastReportTime time.Time }
func NewCluster ¶
func (*Cluster) GetMacItem ¶
func (*Cluster) GetProcessItem ¶
func (c *Cluster) GetProcessItem(addr string) *ProcessItem
func (*Cluster) SetMacItem ¶
func (*Cluster) SetProcessItem ¶
func (c *Cluster) SetProcessItem(item *ProcessItem)
type ClusterCache ¶
type ClusterCache struct {
// contains filtered or unexported fields
}
func NewClusterCache ¶
func NewClusterCache() *ClusterCache
func (*ClusterCache) Get ¶
func (c *ClusterCache) Get(clusterId uint64) *Cluster
func (*ClusterCache) GetAll ¶
func (c *ClusterCache) GetAll() []*Cluster
func (*ClusterCache) Set ¶
func (c *ClusterCache) Set(item *Cluster)
type ClusterItem ¶
type ClusterItem struct { ClusterId uint64 `json:"cluster_id"` CapacityTotal uint64 `json:"capacity_total"` SizeUsed uint64 `json:"size_used"` RangeNum uint64 `json:"range_num"` DbNum uint64 `json:"db_num"` TableNum uint64 `json:"table_num"` TaskNum uint64 `json:"task_num"` NodeUpCount uint64 `json:"node_up_count,omitempty"` NodeDownCount uint64 `json:"node_down_count,omitempty"` NodeOfflineCount uint64 `json:"node_offline_count,omitempty"` NodeTombstoneCount uint64 `json:"node_tombstone_count,omitempty"` LeaderBalanceRatio float64 `json:"leader_balance_ratio,omitempty"` RegionBalanceRatio float64 `json:"region_balance_ratio,omitempty"` GsNum uint64 `json:"gs_num"` Tps uint64 `json:"tps"` // 客户端请求最小延时 Min float64 `json:"min"` // 客户端请求最大延时 Max float64 `json:"max"` // 平均延时 Avg float64 `json:"avg"` // TP ... TP50 float64 `json:"tp50"` TP90 float64 `json:"tp90"` TP99 float64 `json:"tp99"` TP999 float64 `json:"tp999"` TotalNumber uint64 `json:"total_number"` ErrNumber uint64 `json:"err_number"` // 默认保留1000条 ?? SlowLog []string `json:"slow_log"` // GS 出入口网络统计 NetIoInBytePerSec uint64 `json:"net_io_in_byte_per_sec"` NetIoOutBytePerSec uint64 `json:"net_io_out_byte_per_sec"` NetIoInPackagePerSec uint64 `json:"net_io_in_package_per_sec"` NetIoOutPackagePerSec uint64 `json:"net_io_out_package_per_sec"` NetTcpConnections uint32 `json:"net_tcp_connections"` NetTcpActiveOpensPerSec uint32 `json:"net_tcp_activeopens_per_sec"` // 更新时间 UpdateTime int64 `json:"-"` }
type DbItem ¶
type DbItem struct { DbName string `json:"name"` TableNum uint32 `json:"table_num"` Size uint64 `json:"size"` UpdateTime int64 `json:"-"` TableCache *TableItemCache `json:"-"` }
func (*DbItem) GetTableItem ¶
func (*DbItem) SetTableTtem ¶
type DbItemCache ¶
type DbItemCache struct {
// contains filtered or unexported fields
}
func NewDbCache ¶
func NewDbCache() *DbItemCache
func (*DbItemCache) Get ¶
func (c *DbItemCache) Get(name string) *DbItem
func (*DbItemCache) GetAll ¶
func (c *DbItemCache) GetAll() []*DbItem
func (*DbItemCache) Set ¶
func (c *DbItemCache) Set(item *DbItem)
type MacItemCache ¶
type MacItemCache struct {
// contains filtered or unexported fields
}
func NewMacItemCache ¶
func NewMacItemCache() *MacItemCache
func (*MacItemCache) Get ¶
func (c *MacItemCache) Get(addr string) *MacItem
func (*MacItemCache) GetAll ¶
func (c *MacItemCache) GetAll() []*MacItem
func (*MacItemCache) Set ¶
func (c *MacItemCache) Set(item *MacItem)
type Metric ¶
type Metric struct { AlarmCli *alarm.Client Threshold ThresholdConfig // contains filtered or unexported fields }
type NodeThreshold ¶
type NodeThreshold struct { CapacityUsedRate uint64 `toml:"capacity-used-rate" json:"capacity-used-rate"` // capacity/used_city in node stats WriteBps uint64 `toml:"write-bps" json:"write-bps"` WriteOps uint64 `toml:"write-ops" json:"write-ops"` ReadBps uint64 `toml:"read-bps" json:"read-bps"` ReadOps uint64 `toml:"read-ops" json:"read-ops"` }
type ProcessItem ¶
type ProcessItem struct { // 类型: MS, DS, GS Type string // 地址 Addr string UpdateTime int64 Item *statspb.ProcessStats SlowLog *statspb.SlowLogStats }
type ProcessItemCache ¶
type ProcessItemCache struct {
// contains filtered or unexported fields
}
func NewProcessItemCache ¶
func NewProcessItemCache() *ProcessItemCache
func (*ProcessItemCache) Get ¶
func (c *ProcessItemCache) Get(addr string) *ProcessItem
func (*ProcessItemCache) GetAll ¶
func (c *ProcessItemCache) GetAll() []*ProcessItem
func (*ProcessItemCache) Set ¶
func (c *ProcessItemCache) Set(item *ProcessItem)
type RangeThreshold ¶
type SlowLogItem ¶
type SlowLogItem struct { // 类型: MS, DS, GS Type string // 地址 Addr string UpdateTime int64 Item *statspb.SlowLogStats }
type TableItemCache ¶
type TableItemCache struct {
// contains filtered or unexported fields
}
func NewTableItemCache ¶
func NewTableItemCache() *TableItemCache
func (*TableItemCache) Get ¶
func (c *TableItemCache) Get(name string) *TableItem
func (*TableItemCache) GetAll ¶
func (c *TableItemCache) GetAll() []*TableItem
func (*TableItemCache) Set ¶
func (c *TableItemCache) Set(item *TableItem)
type ThresholdConfig ¶
type ThresholdConfig struct { Node NodeThreshold `toml:"node-threshold" json:"node-threshold"` Range RangeThreshold `toml:"range-threshold" json:"range-threshold"` }
Click to show internal directories.
Click to hide internal directories.