@@ -26,22 +26,27 @@ type VecInfo struct {
26
26
27
27
var (
28
28
gaugeMetrics = map [string ]string {
29
- "indices_fielddata_memory_size_bytes" : "Field data cache memory usage in bytes" ,
30
- "indices_filter_cache_memory_size_bytes" : "Filter cache memory usage in bytes" ,
31
- "indices_docs" : "Count of documents on this node" ,
32
- "indices_docs_deleted" : "Count of deleted documents on this node" ,
33
- "indices_store_size_bytes" : "Current size of stored index data in bytes" ,
34
- "indices_segments_memory_bytes" : "Current memory size of segments in bytes" ,
35
- "indices_segments_count" : "Count of index segments on this node" ,
36
- "process_cpu_percent" : "Percent CPU used by process" ,
37
- "process_mem_resident_size_bytes" : "Resident memory in use by process in bytes" ,
38
- "process_mem_share_size_bytes" : "Shared memory in use by process in bytes" ,
39
- "process_mem_virtual_size_bytes" : "Total virtual memory used in bytes" ,
40
- "process_open_files_count" : "Open file descriptors" ,
29
+ "indices_fielddata_memory_size_bytes" : "Field data cache memory usage in bytes" ,
30
+ "indices_filter_cache_memory_size_bytes" : "Filter cache memory usage in bytes" ,
31
+ "indices_query_cache_memory_size_bytes" : "Query cache memory usage in bytes" ,
32
+ "indices_request_cache_memory_size_bytes" : "Request cache memory usage in bytes" ,
33
+ "indices_docs" : "Count of documents on this node" ,
34
+ "indices_docs_deleted" : "Count of deleted documents on this node" ,
35
+ "indices_store_size_bytes" : "Current size of stored index data in bytes" ,
36
+ "indices_segments_memory_bytes" : "Current memory size of segments in bytes" ,
37
+ "indices_segments_count" : "Count of index segments on this node" ,
38
+ "process_cpu_percent" : "Percent CPU used by process" ,
39
+ "process_mem_resident_size_bytes" : "Resident memory in use by process in bytes" ,
40
+ "process_mem_share_size_bytes" : "Shared memory in use by process in bytes" ,
41
+ "process_mem_virtual_size_bytes" : "Total virtual memory used in bytes" ,
42
+ "process_open_files_count" : "Open file descriptors" ,
43
+ "process_max_files_count" : "Max file descriptors for process" ,
41
44
}
42
45
counterMetrics = map [string ]string {
43
46
"indices_fielddata_evictions" : "Evictions from field data" ,
44
47
"indices_filter_cache_evictions" : "Evictions from filter cache" ,
48
+ "indices_query_cache_evictions" : "Evictions from query cache" ,
49
+ "indices_request_cache_evictions" : "Evictions from request cache" ,
45
50
"indices_flush_total" : "Total flushes" ,
46
51
"indices_flush_time_ms_total" : "Cumulative flush time in milliseconds" ,
47
52
"transport_rx_packets_total" : "Count of packets received" ,
71
76
help : "Process CPU time in seconds" ,
72
77
labels : []string {"type" },
73
78
},
79
+ "thread_pool_completed_count" : & VecInfo {
80
+ help : "Thread Pool operations completed" ,
81
+ labels : []string {"type" },
82
+ },
83
+ "thread_pool_rejected_count" : & VecInfo {
84
+ help : "Thread Pool operations rejected" ,
85
+ labels : []string {"type" },
86
+ },
74
87
}
75
88
76
89
gaugeVecMetrics = map [string ]* VecInfo {
@@ -94,6 +107,22 @@ var (
94
107
help : "JVM memory max" ,
95
108
labels : []string {"area" },
96
109
},
110
+ "thread_pool_active_count" : & VecInfo {
111
+ help : "Thread Pool threads active" ,
112
+ labels : []string {"type" },
113
+ },
114
+ "thread_pool_largest_count" : & VecInfo {
115
+ help : "Thread Pool largest threads count" ,
116
+ labels : []string {"type" },
117
+ },
118
+ "thread_pool_queue_count" : & VecInfo {
119
+ help : "Thread Pool operations queued" ,
120
+ labels : []string {"type" },
121
+ },
122
+ "thread_pool_threads_count" : & VecInfo {
123
+ help : "Thread Pool current threads count" ,
124
+ labels : []string {"type" },
125
+ },
97
126
}
98
127
)
99
128
@@ -110,7 +139,7 @@ type Exporter struct {
110
139
counters map [string ]* prometheus.CounterVec
111
140
counterVecs map [string ]* prometheus.CounterVec
112
141
113
- allNodes bool
142
+ allNodes bool
114
143
115
144
client * http.Client
116
145
}
@@ -169,7 +198,7 @@ func NewExporter(uri string, timeout time.Duration, allNodes bool) *Exporter {
169
198
gauges : gauges ,
170
199
gaugeVecs : gaugeVecs ,
171
200
172
- allNodes : allNodes ,
201
+ allNodes : allNodes ,
173
202
174
203
client : & http.Client {
175
204
Transport : & http.Transport {
@@ -234,7 +263,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
234
263
vec .Reset ()
235
264
}
236
265
237
- defer func () { ch <- e .up }()
266
+ defer func () { ch <- e .up }()
238
267
239
268
resp , err := e .client .Get (e .URI )
240
269
if err != nil {
@@ -278,6 +307,17 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
278
307
e .gaugeVecs ["breakers_limit_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host , breaker ).Set (float64 (bstats .LimitSize ))
279
308
}
280
309
310
+ // Thread Pool stats
311
+ for pool , pstats := range stats .ThreadPool {
312
+ e .counterVecs ["thread_pool_completed_count" ].WithLabelValues (allStats .ClusterName , stats .Host , pool ).Set (float64 (pstats .Completed ))
313
+ e .counterVecs ["thread_pool_rejected_count" ].WithLabelValues (allStats .ClusterName , stats .Host , pool ).Set (float64 (pstats .Rejected ))
314
+
315
+ e .gaugeVecs ["thread_pool_active_count" ].WithLabelValues (allStats .ClusterName , stats .Host , pool ).Set (float64 (pstats .Active ))
316
+ e .gaugeVecs ["thread_pool_threads_count" ].WithLabelValues (allStats .ClusterName , stats .Host , pool ).Set (float64 (pstats .Active ))
317
+ e .gaugeVecs ["thread_pool_largest_count" ].WithLabelValues (allStats .ClusterName , stats .Host , pool ).Set (float64 (pstats .Active ))
318
+ e .gaugeVecs ["thread_pool_queue_count" ].WithLabelValues (allStats .ClusterName , stats .Host , pool ).Set (float64 (pstats .Active ))
319
+ }
320
+
281
321
// JVM Memory Stats
282
322
e .gaugeVecs ["jvm_memory_committed_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host , "heap" ).Set (float64 (stats .JVM .Mem .HeapCommitted ))
283
323
e .gaugeVecs ["jvm_memory_used_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host , "heap" ).Set (float64 (stats .JVM .Mem .HeapUsed ))
@@ -287,9 +327,16 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
287
327
288
328
// Indices Stats
289
329
e .gauges ["indices_fielddata_memory_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .FieldData .MemorySize ))
330
+ e .counters ["indices_fielddata_evictions" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .FieldData .Evictions ))
331
+
290
332
e .gauges ["indices_filter_cache_memory_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .FilterCache .MemorySize ))
291
333
e .counters ["indices_filter_cache_evictions" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .FilterCache .Evictions ))
292
- e .counters ["indices_fielddata_evictions" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .FieldData .Evictions ))
334
+
335
+ e .gauges ["indices_query_cache_memory_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .QueryCache .MemorySize ))
336
+ e .counters ["indices_query_cache_evictions" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .QueryCache .Evictions ))
337
+
338
+ e .gauges ["indices_request_cache_memory_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .QueryCache .MemorySize ))
339
+ e .counters ["indices_request_cache_evictions" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .QueryCache .Evictions ))
293
340
294
341
e .gauges ["indices_docs" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .Docs .Count ))
295
342
e .gauges ["indices_docs_deleted" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .Docs .Deleted ))
@@ -326,6 +373,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
326
373
e .gauges ["process_mem_virtual_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Process .Memory .TotalVirtual ))
327
374
e .gauges ["process_open_files_count" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Process .OpenFD ))
328
375
376
+ e .counterVecs ["process_cpu_time_seconds_sum" ].WithLabelValues (allStats .ClusterName , stats .Host , "total" ).Set (float64 (stats .Process .CPU .Total / 1000 ))
329
377
e .counterVecs ["process_cpu_time_seconds_sum" ].WithLabelValues (allStats .ClusterName , stats .Host , "sys" ).Set (float64 (stats .Process .CPU .Sys / 1000 ))
330
378
e .counterVecs ["process_cpu_time_seconds_sum" ].WithLabelValues (allStats .ClusterName , stats .Host , "user" ).Set (float64 (stats .Process .CPU .User / 1000 ))
331
379
}
@@ -359,7 +407,6 @@ func main() {
359
407
)
360
408
flag .Parse ()
361
409
362
-
363
410
if * esAllNodes {
364
411
* esURI = * esURI + "/_nodes/stats"
365
412
} else {
0 commit comments