@@ -26,22 +26,27 @@ type VecInfo struct {
2626
2727var (
2828 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" ,
4144 }
4245 counterMetrics = map [string ]string {
4346 "indices_fielddata_evictions" : "Evictions from field data" ,
4447 "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" ,
4550 "indices_flush_total" : "Total flushes" ,
4651 "indices_flush_time_ms_total" : "Cumulative flush time in milliseconds" ,
4752 "transport_rx_packets_total" : "Count of packets received" ,
7176 help : "Process CPU time in seconds" ,
7277 labels : []string {"type" },
7378 },
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+ },
7487 }
7588
7689 gaugeVecMetrics = map [string ]* VecInfo {
@@ -94,6 +107,22 @@ var (
94107 help : "JVM memory max" ,
95108 labels : []string {"area" },
96109 },
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+ },
97126 }
98127)
99128
@@ -110,7 +139,7 @@ type Exporter struct {
110139 counters map [string ]* prometheus.CounterVec
111140 counterVecs map [string ]* prometheus.CounterVec
112141
113- allNodes bool
142+ allNodes bool
114143
115144 client * http.Client
116145}
@@ -169,7 +198,7 @@ func NewExporter(uri string, timeout time.Duration, allNodes bool) *Exporter {
169198 gauges : gauges ,
170199 gaugeVecs : gaugeVecs ,
171200
172- allNodes : allNodes ,
201+ allNodes : allNodes ,
173202
174203 client : & http.Client {
175204 Transport : & http.Transport {
@@ -234,7 +263,7 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
234263 vec .Reset ()
235264 }
236265
237- defer func () { ch <- e .up }()
266+ defer func () { ch <- e .up }()
238267
239268 resp , err := e .client .Get (e .URI )
240269 if err != nil {
@@ -278,6 +307,17 @@ func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
278307 e .gaugeVecs ["breakers_limit_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host , breaker ).Set (float64 (bstats .LimitSize ))
279308 }
280309
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+
281321 // JVM Memory Stats
282322 e .gaugeVecs ["jvm_memory_committed_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host , "heap" ).Set (float64 (stats .JVM .Mem .HeapCommitted ))
283323 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) {
287327
288328 // Indices Stats
289329 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+
290332 e .gauges ["indices_filter_cache_memory_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .FilterCache .MemorySize ))
291333 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 ))
293340
294341 e .gauges ["indices_docs" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Indices .Docs .Count ))
295342 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) {
326373 e .gauges ["process_mem_virtual_size_bytes" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Process .Memory .TotalVirtual ))
327374 e .gauges ["process_open_files_count" ].WithLabelValues (allStats .ClusterName , stats .Host ).Set (float64 (stats .Process .OpenFD ))
328375
376+ e .counterVecs ["process_cpu_time_seconds_sum" ].WithLabelValues (allStats .ClusterName , stats .Host , "total" ).Set (float64 (stats .Process .CPU .Total / 1000 ))
329377 e .counterVecs ["process_cpu_time_seconds_sum" ].WithLabelValues (allStats .ClusterName , stats .Host , "sys" ).Set (float64 (stats .Process .CPU .Sys / 1000 ))
330378 e .counterVecs ["process_cpu_time_seconds_sum" ].WithLabelValues (allStats .ClusterName , stats .Host , "user" ).Set (float64 (stats .Process .CPU .User / 1000 ))
331379 }
@@ -359,7 +407,6 @@ func main() {
359407 )
360408 flag .Parse ()
361409
362-
363410 if * esAllNodes {
364411 * esURI = * esURI + "/_nodes/stats"
365412 } else {
0 commit comments