Documentation
¶
Index ¶
- Constants
- func FormatToMetricName(name string) string
- func GetBvarConfMetricValue(metric string) string
- func GetBvarMetric(addrs []string, name string, results *chan MetricResult)
- func GetDiskFileSystemInfo(instance string) (interface{}, error)
- func GetDiskPerformance(instance string, start, end, interval uint64) (interface{}, error)
- func GetDiskType(instance string) (interface{}, error)
- func GetDiskWriteCacheEnableFlag(instance string) (interface{}, error)
- func GetHostCPUInfo(instance string) (interface{}, error)
- func GetHostCPUUtilization(instance string, start, end, interval uint64) (interface{}, error)
- func GetHostInfo(instance string) (interface{}, error)
- func GetHostMemUtilization(instance string, start, end, interval uint64) (interface{}, error)
- func GetHostMemoryInfo(instance string) (interface{}, error)
- func GetNetWorkTraffic(instance string, start, end, interval uint64) (interface{}, error)
- func GetNodeCPUUtilizationName(instance string, interval uint64) string
- func GetNodeDiskPerformanceName(typeName, instance string, interval uint64) string
- func GetNodeMemUtilizationName(instance string) string
- func GetNodeNetWorkReveiveName(typeName, instance string, interval uint64) string
- func GetRaftStatusMetric(addrs []string, results *chan MetricResult)
- func GetUtilization(name string, start, end, interval uint64) (map[string][]RangeMetricItem, error)
- func ListDiskInfo(instance string) (interface{}, error)
- func ParseBvarMetric(value string) (*map[string]string, error)
- func ParseMatrixMetric(info *QueryResponseOfMatrix, key string) map[string][]RangeMetricItem
- func ParseRaftStatusMetric(addr string, value string) ([]map[string]string, error)
- func ParseVectorMetric(info *QueryResponseOfVector, isValue bool) map[string]map[string]string
- func QueryInstantMetric(name string, results *chan MetricResult)
- func QueryRangeMetric(name string, results *chan MetricResult)
- type CPUInfo
- type FileSystemInfo
- type HostInfo
- type MetricResult
- type NetworkTraffic
- type Performance
- type QueryResponseOfMatrix
- type QueryResponseOfVector
- type RangeMetricItem
- type ServiceStatus
- type Space
- type SpaceTrend
- type UserPerformance
Constants ¶
const ( INSTANCE = "instance" DEVICE = "device" FSTYPE = "fstype" MOUNTPOINT = "mountpoint" INSTANT_METRIC_PATH = "/api/v1/query" VECTOR_METRIC_QUERY_KEY = "query" RANGE_METRIC_PATH = "/api/v1/query_range" RANGE_START = "start" RANGE_END = "end" RANGE_STEP = "step" BVAR_METRIC_PATH = "/vars" RAFT_STATUS_PATH = "/raft_stat" CONF_VALUE = "conf_value" CURVEBS_VERSION = "curve_version" ETCD_CLUSTER_VERSION_NAME = "etcd_cluster_version" ETCD_SERVER_IS_LEADER_NAME = "etcd_server_is_leader" ETCD_CLUSTER_VERSION = "cluster_version" WRITE_IOPS = "write_iops" WRITE_RATE = "write_rate" READ_IOPS = "read_iops" READ_REAT = "read_rate" WRITE_QPS = "write_qps" WRITE_BPS = "write_bps" READ_QPS = "read_qps" READ_BPS = "read_bps" )
const ( // disk info NODE_DISK_INFO = "node_disk_info" NODE_DISK_READ_COMPLETED_TOTAL = "node_disk_reads_completed_total" NODE_DISK_WRITE_COMPLETED_TOTAL = "node_disk_writes_completed_total" NODE_DISK_READ_BYTES_TOTAL = "node_disk_read_bytes_total" NODE_DISK_WRITTEN_BYTES_TOTAL = "node_disk_written_bytes_total" // filesystem NODE_FILESYSTEM_SIZE_TOTAL = "node_filesystem_size_bytes" NODE_FILESYSTEM_SIZE_AVAIL = "node_filesystem_avail_bytes" // disk NODE_DISK_ROTATION_RATE = "node_disk_ata_rotation_rate_rpm" NODE_DISK_WRITE_CACHE_ENABLE = "node_disk_ata_write_cache_enabled" SSD_TYPE = "SSD" HDD_TYPE = "HDD" // disk modle MODLE = "model" )
const ( // node info NODE_UNAME_INFO = "node_uname_info" NODE_UNAME_NODE_NAME = "nodename" NODE_UNAME_MACHINE = "machine" NODE_UNAME_RELEASE = "release" NODE_UNAME_SYSNAME = "sysname" NODE_UNAME_VERSION = "version" // cpu info NODE_CPU_INFO = "node_cpu_info" NODE_CPU_MODLE = "model_name" NODE_CPU_UTILIZATION = "node_cpu_seconds_total" NODE_CPU_IDLE = "idle" // memory info NODE_MEMORY_TOTAL_BYTES = "node_memory_MemTotal_bytes" // network info NODE_NETWORK_DEVICE_FILTER = "tap.*|veth.*|br.*|docker.*|virbr*|lo*" NODE_NETWORK_RECEIVE_BYTES_TOTAL = "node_network_receive_bytes_total" NODE_NETWORK_TRANSMIT_BYTES_TOTAL = "node_network_transmit_bytes_total" )
Variables ¶
This section is empty.
Functions ¶
func FormatToMetricName ¶
bvar related: https://github.com/apache/brpc/blob/84ac073a6c2c6b15d6d754686255c26acc917bfd/src/bvar/variable.cpp#L946
func GetBvarConfMetricValue ¶
func GetBvarMetric ¶
func GetBvarMetric(addrs []string, name string, results *chan MetricResult)
func GetDiskFileSystemInfo ¶
@return ap[instance]map[device]FileSystemInfo
func GetDiskPerformance ¶
@return map[string][]Performance, key: device, value: performance at different timestamp
func GetDiskType ¶
@return map[instance]map[device]type
func GetDiskWriteCacheEnableFlag ¶
@return map[instance]map[device]writeCacheEnable
func GetHostCPUInfo ¶
func GetHostCPUUtilization ¶
func GetHostInfo ¶
func GetHostMemUtilization ¶
func GetHostMemoryInfo ¶
func GetNetWorkTraffic ¶
* return: reveive, transmit, error * map[string][]RangeMetricItem: key: network device, value: performance in different timestamp
func GetRaftStatusMetric ¶
func GetRaftStatusMetric(addrs []string, results *chan MetricResult)
func GetUtilization ¶
func GetUtilization(name string, start, end, interval uint64) (map[string][]RangeMetricItem, error)
func ListDiskInfo ¶
@return map[instance][]map[key]value
func ParseMatrixMetric ¶
func ParseMatrixMetric(info *QueryResponseOfMatrix, key string) map[string][]RangeMetricItem
func ParseRaftStatusMetric ¶
[8589934645] peer_id: 10.166.24.22:8200:0\r\n state: LEADER\r\n readonly: 0\r\n term: 19\r\n conf_index: 11244429\r\n peers: 10.166.24.22:8200:0 10.166.24.27:8218:0 10.166.24.29:8206:0\r\n changing_conf: NO stage: STAGE_NONE\r\n election_timer: timeout(1000ms) STOPPED\r\n vote_timer: timeout(1000ms) STOPPED\r\n stepdown_timer: timeout(1000ms) SCHEDULING(in 577ms)\r\n snapshot_timer: timeout(1800000ms) SCHEDULING(in 277280ms)\r\n storage: [11243647, 11245778]\n disk_index: 11245778\n known_applied_index: 11245778\n last_log_id: (index=11245778,term=19)\n state_machine: Idle\n last_committed_index: 11245778r\n last_snapshot_index: 11244429 last_snapshot_term: 19 snapshot_status: IDLE replicator_82304458296217@10.166.24.27:8218:0: next_index=11245779 flying_append_entries_size=0 idle hc=17738777 ac=206514 ic=0 replicator_80702435493905@10.166.24.29:8206:0: next_index=11245779 flying_append_entries_size=0 idle hc=17738818 ac=206282 ic=0 \r\n\r\n [8589934712] peer_id: 10.166.24.22:8200:0 state: FOLLOWER readonly: 0 term: 16 conf_index: 15368827 peers: 10.166.24.22:8200:0 10.166.24.29:8212:0 10.166.24.30:8219:0 leader: 10.166.24.29:8212:0 last_msg_to_now: 48 election_timer: timeout(1000ms) SCHEDULING(in 719ms) vote_timer: timeout(1000ms) STOPPED stepdown_timer: timeout(1000ms) STOPPED snapshot_timer: timeout(1800000ms) SCHEDULING(in 422640ms) storage: [15367732, 15370070] disk_index: 15370070 known_applied_index: 15370070 last_log_id: (index=15370070,term=16) state_machine: Idle last_committed_index: 15370070 last_snapshot_index: 15368827 last_snapshot_term: 16 snapshot_status: IDLE
func ParseVectorMetric ¶
func ParseVectorMetric(info *QueryResponseOfVector, isValue bool) map[string]map[string]string
@return map[string]map[string]string, key: instance, value.key: meticKey or "value"
func QueryInstantMetric ¶
func QueryInstantMetric(name string, results *chan MetricResult)
func QueryRangeMetric ¶
func QueryRangeMetric(name string, results *chan MetricResult)
Types ¶
type FileSystemInfo ¶
type MetricResult ¶
type MetricResult common.QueryResult
type NetworkTraffic ¶
type NetworkTraffic struct { Receive map[string][]RangeMetricItem Transmit map[string][]RangeMetricItem }
type Performance ¶
type Performance struct { Timestamp float64 `json:"timestamp" binding:"required"` WriteIOPS string `json:"writeIOPS" binding:"required"` WriteBPS string `json:"writeBPS" binding:"required"` ReadIOPS string `json:"readIOPS" binding:"required"` ReadBPS string `json:"readBPS" binding:"required"` }
func GetPerformance ¶
func GetPerformance(name string, start, end, interval uint64) ([]Performance, error)
type QueryResponseOfMatrix ¶
type QueryResponseOfVector ¶
type QueryResponseOfVector struct { Status string `json:"status"` Data struct { ResultType string `json:"resultType"` Result []struct { Metric map[string]string `json:"metric"` Value []interface{} `json:"value"` } `json:"result"` } `json:"data"` }
prometheus http api resonse data struct
{ "status": "success" | "error", "data": <data>, // Only set if status is "error". The data field may still hold additional data. "errorType": "<string>", "error": "<string>" }
data struct: https://prometheus.io/docs/prometheus/latest/querying/api/#expression-query-result-formats
type RangeMetricItem ¶
type ServiceStatus ¶
type SpaceTrend ¶
type UserPerformance ¶
type UserPerformance struct { Timestamp float64 `json:"timestamp" binding:"required"` WriteQPS string `json:"writeQPS" binding:"required"` WriteBPS string `json:"writeBPS" binding:"required"` ReadQPS string `json:"readQPS" binding:"required"` ReadBPS string `json:"readBPS" binding:"required"` }
func GetUserPerformance ¶
func GetUserPerformance(name string, start, end, interval uint64) ([]UserPerformance, error)