forked from alicebob/asprom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.go
146 lines (140 loc) · 6.14 KB
/
stats.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package main
import (
as "github.com/aerospike/aerospike-client-go"
"github.com/prometheus/client_golang/prometheus"
)
var (
// StatsMetrics lists the keys we report from aero's info:statistics
// command.
// See `asinfo -l -v statistics` for the full list.
StatsMetrics = []metric{
gauge("cluster_size", "cluster size"),
// cluster_key=C0758EC6A81F
// cluster_integrity=true
// cluster_is_member=true
counter("uptime", "uptime"),
gauge("system_free_mem_pct", "system free mem pct"),
// system_swapping=false
gauge("heap_allocated_kbytes", "heap allocated kbytes"),
gauge("heap_active_kbytes", "heap active kbytes"),
gauge("heap_mapped_kbytes", "heap mapped kbytes"),
gauge("heap_efficiency_pct", "heap efficiency pct"),
gauge("heap_site_count", "heap site count"),
gauge("objects", "objects"),
gauge("tombstones", "tombstones"),
gauge("tsvc_queue", "tsvc queue"),
gauge("info_queue", "info queue"),
gauge("delete_queue", "delete queue"),
// rw_in_progress=0
// proxy_in_progress=0
// tree_gc_queue=0
gauge("client_connections", "client connections"),
gauge("heartbeat_connections", "heartbeat connections"),
gauge("fabric_connections", "fabric connections"),
counter("heartbeat_received_self", "heartbeat received self"),
counter("heartbeat_received_foreign", "heartbeat received foreign"),
counter("reaped_fds", "reaped fds"),
counter("info_complete", "info complete"),
counter("demarshal_error", "demarshal error"),
counter("early_tsvc_client_error", "early tsvc client error"),
counter("early_tsvc_batch_sub_error", "early tsvc batch sub error"),
counter("early_tsvc_udf_sub_error", "early tsvc udf sub error"),
gauge("batch_index_initiate", "batch index initiate"),
// batch_index_queue=0:0,0:0,0:0,0:0
gauge("batch_index_complete", "batch index complete"),
gauge("batch_index_error", "batch index error"),
gauge("batch_index_timeout", "batch index timeout"),
gauge("batch_index_unused_buffers", "batch index unused buffers"),
gauge("batch_index_huge_buffers", "batch index huge buffers"),
counter("batch_index_created_buffers", "batch index created buffers"),
counter("batch_index_destroyed_buffers", "batch index destroyed buffers"),
gauge("batch_initiate", "batch initiate"),
gauge("batch_queue", "batch queue"),
gauge("batch_error", "batch error"),
gauge("batch_timeout", "batch timeout"),
gauge("scans_active", "scans active"),
gauge("query_short_running", "query short running"),
gauge("query_long_running", "query long running"),
gauge("sindex_ucgarbage_found", "sindex ucgarbage found"),
gauge("sindex_gc_locktimedout", "sindex gc locktimedout"),
gauge("sindex_gc_list_creation_time", "sindex gc list creation time"),
gauge("sindex_gc_list_deletion_time", "sindex gc list deletion time"),
gauge("sindex_gc_objects_validated", "sindex gc objects validated"),
gauge("sindex_gc_garbage_found", "sindex gc garbage found"),
gauge("sindex_gc_garbage_cleaned", "sindex gc garbage cleaned"),
// paxos_principal=BB9508FED001500
// migrate_allowed=true
gauge("migrate_partitions_remaining", "migrate partitions remaining"),
gauge("fabric_bulk_send_rate", "fabric bulk send rate"),
gauge("fabric_bulk_recv_rate", "fabric bulk recv rate"),
gauge("fabric_ctrl_send_rate", "fabric ctrl send rate"),
gauge("fabric_ctrl_recv_rate", "fabric ctrl recv rate"),
gauge("fabric_meta_send_rate", "fabric meta send rate"),
gauge("fabric_meta_recv_rate", "fabric meta recv rate"),
gauge("fabric_rw_send_rate", "fabric rw send rate"),
gauge("fabric_rw_recv_rate", "fabric rw recv rate"),
counter("xdr_ship_success", "xdr ship success"),
counter("xdr_ship_delete_success", "xdr ship delete success"),
counter("xdr_ship_source_error", "xdr ship source error"),
counter("xdr_ship_destination_error", "xdr ship destination error"),
gauge("xdr_ship_bytes", "xdr ship bytes"),
gauge("xdr_ship_latency_avg", "xdr ship latency avg"),
gauge("xdr_ship_compression_avg_pct", "xdr ship compression avg pct"),
gauge("xdr_ship_inflight_objects", "xdr ship inflight objects"),
gauge("xdr_ship_outstanding_objects", "xdr ship outstanding objects"),
counter("xdr_read_success", "xdr read success"),
counter("xdr_read_error", "xdr read error"),
gauge("xdr_read_notfound", "xdr read notfound"),
gauge("xdr_read_latency_avg", "xdr read latency avg"),
gauge("xdr_read_active_avg_pct", "xdr read active avg pct"),
gauge("xdr_read_idle_avg_pct", "xdr read idle avg pct"),
gauge("xdr_read_reqq_used", "xdr read reqq used"),
gauge("xdr_read_reqq_used_pct", "xdr read reqq used pct"),
gauge("xdr_read_respq_used", "xdr read respq used"),
gauge("xdr_read_txnq_used", "xdr read txnq used"),
gauge("xdr_read_txnq_used_pct", "xdr read txnq used pct"),
gauge("xdr_queue_overflow_error", "xdr queue overflow error"),
gauge("xdr_hotkey_fetch", "xdr hotkey fetch"),
gauge("xdr_hotkey_skip", "xdr hotkey skip"),
counter("xdr_unknown_namespace_error", "xdr unknown namespace error"),
counter("xdr_uninitialized_destination_error", "xdr uninitialized destination error"),
gauge("xdr_timelag", "xdr timelag"),
gauge("xdr_throughput", "xdr throughput"),
gauge("dlog_free_pct", "dlog free pct"),
counter("dlog_logged", "dlog logged"),
counter("dlog_overwritten_error", "dlog overwritten error"),
counter("dlog_processed_link_down", "dlog processed link down"),
counter("dlog_processed_main", "dlog processed main"),
counter("dlog_processed_replica", "dlog processed replica"),
counter("dlog_relogged", "dlog relogged"),
counter("dlog_used_objects", "dlog used objects"),
}
)
type statsCollector cmetrics
func newStatsCollector() statsCollector {
smetrics := map[string]cmetric{}
for _, m := range StatsMetrics {
smetrics[m.aeroName] = cmetric{
desc: prometheus.NewDesc(
promkey(systemNode, m.aeroName),
m.desc,
nil,
nil,
),
typ: m.typ,
}
}
return smetrics
}
func (sc statsCollector) describe(ch chan<- *prometheus.Desc) {
for _, s := range sc {
ch <- s.desc
}
}
func (sc statsCollector) collect(conn *as.Connection) ([]prometheus.Metric, error) {
res, err := as.RequestInfo(conn, "statistics")
if err != nil {
return nil, err
}
return infoCollect(cmetrics(sc), res["statistics"]), nil
}