From 5440f7019e7c6592769ddfb85eab793125dcdf06 Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Tue, 19 Oct 2021 02:54:10 +0700 Subject: [PATCH 1/8] Add search_query_current and indexing_index_current Signed-off-by: Loc Mai --- README.md | 2 ++ collector/indices.go | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/README.md b/README.md index 81552bc2..94f2c23c 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ Further Information | elasticsearch_indices_indexing_delete_time_seconds_total | counter | 1 | Total time indexing delete in seconds | elasticsearch_indices_indexing_delete_total | counter | 1 | Total indexing deletes | elasticsearch_indices_indexing_index_time_seconds_total | counter | 1 | Cumulative index time in seconds +| elasticsearch_indices_indexing_index_current | counter | 1 | Current index calls | elasticsearch_indices_indexing_index_total | counter | 1 | Total index calls | elasticsearch_indices_mappings_stats_fields | gauge | 1 | Count of fields currently mapped by index | elasticsearch_indices_mappings_stats_json_parse_failures_total | counter | 0 | Number of errors while parsing JSON @@ -157,6 +158,7 @@ Further Information | elasticsearch_indices_search_fetch_time_seconds | counter | 1 | Total search fetch time in seconds | elasticsearch_indices_search_fetch_total | counter | 1 | Total number of fetches | elasticsearch_indices_search_query_time_seconds | counter | 1 | Total search query time in seconds +| elasticsearch_indices_search_query_current | counter | 1 | Current number of queries | elasticsearch_indices_search_query_total | counter | 1 | Total number of queries | elasticsearch_indices_segments_count | gauge | 1 | Count of index segments on this node | elasticsearch_indices_segments_memory_bytes | gauge | 1 | Current memory size of segments in bytes diff --git a/collector/indices.go b/collector/indices.go index 7133253b..efb64504 100644 --- a/collector/indices.go +++ b/collector/indices.go @@ -491,6 +491,18 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo }, Labels: indexLabels, }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "index_stats", "search_query_current"), + "Current number of queries", + indexLabels.keys(), nil, + ), + Value: func(indexStats IndexStatsIndexResponse) float64 { + return float64(indexStats.Total.Search.QueryCurrent) + }, + Labels: indexLabels, + }, { Type: prometheus.CounterValue, Desc: prometheus.NewDesc( @@ -599,6 +611,18 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo }, Labels: indexLabels, }, + { + Type: prometheus.CounterValue, + Desc: prometheus.NewDesc( + prometheus.BuildFQName(namespace, "index_stats", "indexing_index_current"), + "Current indexing index count", + indexLabels.keys(), nil, + ), + Value: func(indexStats IndexStatsIndexResponse) float64 { + return float64(indexStats.Total.Indexing.IndexCurrent) + }, + Labels: indexLabels, + }, { Type: prometheus.CounterValue, Desc: prometheus.NewDesc( From 072b50d6098143838138bd6c1ad54f6d2f0f4c5d Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Wed, 20 Oct 2021 15:21:33 +0700 Subject: [PATCH 2/8] update descriptions Signed-off-by: Loc Mai --- collector/indices.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/indices.go b/collector/indices.go index efb64504..b4e990af 100644 --- a/collector/indices.go +++ b/collector/indices.go @@ -495,7 +495,7 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo Type: prometheus.CounterValue, Desc: prometheus.NewDesc( prometheus.BuildFQName(namespace, "index_stats", "search_query_current"), - "Current number of queries", + "The number of currently active queries", indexLabels.keys(), nil, ), Value: func(indexStats IndexStatsIndexResponse) float64 { @@ -615,7 +615,7 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo Type: prometheus.CounterValue, Desc: prometheus.NewDesc( prometheus.BuildFQName(namespace, "index_stats", "indexing_index_current"), - "Current indexing index count", + "The number of documents currently being indexed to an index", indexLabels.keys(), nil, ), Value: func(indexStats IndexStatsIndexResponse) float64 { From 963823ead441a8ff42cdc1be0113f9803c73feda Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Wed, 20 Oct 2021 15:32:04 +0700 Subject: [PATCH 3/8] Update collector/indices.go Co-authored-by: Ben Kochie Signed-off-by: Loc Mai --- collector/indices.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collector/indices.go b/collector/indices.go index b4e990af..1c387cc9 100644 --- a/collector/indices.go +++ b/collector/indices.go @@ -492,9 +492,9 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo Labels: indexLabels, }, { - Type: prometheus.CounterValue, + Type: prometheus.GaugeValue, Desc: prometheus.NewDesc( - prometheus.BuildFQName(namespace, "index_stats", "search_query_current"), + prometheus.BuildFQName(namespace, "search", "active_queries"), "The number of currently active queries", indexLabels.keys(), nil, ), From 2d68e2ee885ead2211756e47d9caa68787eceec3 Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Wed, 20 Oct 2021 15:41:21 +0700 Subject: [PATCH 4/8] rename to current_indexed_docs Signed-off-by: Loc Mai --- collector/indices.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/indices.go b/collector/indices.go index 1c387cc9..6d17a543 100644 --- a/collector/indices.go +++ b/collector/indices.go @@ -614,7 +614,7 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo { Type: prometheus.CounterValue, Desc: prometheus.NewDesc( - prometheus.BuildFQName(namespace, "index_stats", "indexing_index_current"), + prometheus.BuildFQName(namespace, "index_stats", "current_indexed_docs"), "The number of documents currently being indexed to an index", indexLabels.keys(), nil, ), From 71e4b9137efc059907fd23bd4acb20e6da94c353 Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Wed, 20 Oct 2021 15:52:17 +0700 Subject: [PATCH 5/8] update docs Signed-off-by: Loc Mai --- README.md | 4 ++-- collector/indices.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 94f2c23c..8b293349 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ Further Information | elasticsearch_filesystem_io_stats_device_write_size_kilobytes_sum | gauge | 1 | Total kilobytes written to disk | elasticsearch_indices_docs | gauge | 1 | Count of documents on this node | elasticsearch_indices_docs_deleted | gauge | 1 | Count of deleted documents on this node +| elasticsearch_indices_docs_indexed | gauge | 1 | The number of documents currently being indexed to an index | elasticsearch_indices_docs_primary | gauge | | Count of documents with only primary shards on all nodes | elasticsearch_indices_fielddata_evictions | counter | 1 | Evictions from field data | elasticsearch_indices_fielddata_memory_size_bytes | gauge | 1 | Field data cache memory usage in bytes @@ -134,7 +135,6 @@ Further Information | elasticsearch_indices_indexing_delete_time_seconds_total | counter | 1 | Total time indexing delete in seconds | elasticsearch_indices_indexing_delete_total | counter | 1 | Total indexing deletes | elasticsearch_indices_indexing_index_time_seconds_total | counter | 1 | Cumulative index time in seconds -| elasticsearch_indices_indexing_index_current | counter | 1 | Current index calls | elasticsearch_indices_indexing_index_total | counter | 1 | Total index calls | elasticsearch_indices_mappings_stats_fields | gauge | 1 | Count of fields currently mapped by index | elasticsearch_indices_mappings_stats_json_parse_failures_total | counter | 0 | Number of errors while parsing JSON @@ -158,7 +158,7 @@ Further Information | elasticsearch_indices_search_fetch_time_seconds | counter | 1 | Total search fetch time in seconds | elasticsearch_indices_search_fetch_total | counter | 1 | Total number of fetches | elasticsearch_indices_search_query_time_seconds | counter | 1 | Total search query time in seconds -| elasticsearch_indices_search_query_current | counter | 1 | Current number of queries +| elasticsearch_indices_active_queries | gauge | 1 | The number of currently active queries | elasticsearch_indices_search_query_total | counter | 1 | Total number of queries | elasticsearch_indices_segments_count | gauge | 1 | Count of index segments on this node | elasticsearch_indices_segments_memory_bytes | gauge | 1 | Current memory size of segments in bytes diff --git a/collector/indices.go b/collector/indices.go index 6d17a543..a1d5f7c2 100644 --- a/collector/indices.go +++ b/collector/indices.go @@ -612,9 +612,9 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo Labels: indexLabels, }, { - Type: prometheus.CounterValue, + Type: prometheus.GaugeValue, Desc: prometheus.NewDesc( - prometheus.BuildFQName(namespace, "index_stats", "current_indexed_docs"), + prometheus.BuildFQName(namespace, "index_stats", "docs_indexed"), "The number of documents currently being indexed to an index", indexLabels.keys(), nil, ), From d073d7de3d71b391c7cda01bf857966d3e28efef Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Wed, 20 Oct 2021 15:59:16 +0700 Subject: [PATCH 6/8] fix ordering Signed-off-by: Loc Mai --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b293349..cb66d5f2 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Further Information | elasticsearch_filesystem_io_stats_device_write_operations_count | gauge | 1 | Count of disk write operations | elasticsearch_filesystem_io_stats_device_read_size_kilobytes_sum | gauge | 1 | Total kilobytes read from disk | elasticsearch_filesystem_io_stats_device_write_size_kilobytes_sum | gauge | 1 | Total kilobytes written to disk +| elasticsearch_indices_active_queries | gauge | 1 | The number of currently active queries | elasticsearch_indices_docs | gauge | 1 | Count of documents on this node | elasticsearch_indices_docs_deleted | gauge | 1 | Count of deleted documents on this node | elasticsearch_indices_docs_indexed | gauge | 1 | The number of documents currently being indexed to an index @@ -158,7 +159,6 @@ Further Information | elasticsearch_indices_search_fetch_time_seconds | counter | 1 | Total search fetch time in seconds | elasticsearch_indices_search_fetch_total | counter | 1 | Total number of fetches | elasticsearch_indices_search_query_time_seconds | counter | 1 | Total search query time in seconds -| elasticsearch_indices_active_queries | gauge | 1 | The number of currently active queries | elasticsearch_indices_search_query_total | counter | 1 | Total number of queries | elasticsearch_indices_segments_count | gauge | 1 | Count of index segments on this node | elasticsearch_indices_segments_memory_bytes | gauge | 1 | Current memory size of segments in bytes From 229880f1107202d87180e093f68f2116293c5b67 Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Wed, 20 Oct 2021 16:03:43 +0700 Subject: [PATCH 7/8] fix ordering Signed-off-by: Loc Mai --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cb66d5f2..9bb473d6 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Further Information | elasticsearch_filesystem_io_stats_device_write_operations_count | gauge | 1 | Count of disk write operations | elasticsearch_filesystem_io_stats_device_read_size_kilobytes_sum | gauge | 1 | Total kilobytes read from disk | elasticsearch_filesystem_io_stats_device_write_size_kilobytes_sum | gauge | 1 | Total kilobytes written to disk -| elasticsearch_indices_active_queries | gauge | 1 | The number of currently active queries +| elasticsearch_indices_active_queries | gauge | 1 | The number of currently active queries | elasticsearch_indices_docs | gauge | 1 | Count of documents on this node | elasticsearch_indices_docs_deleted | gauge | 1 | Count of deleted documents on this node | elasticsearch_indices_docs_indexed | gauge | 1 | The number of documents currently being indexed to an index From eb2413ed5696626b9145684ffe6d2eaee352d1f3 Mon Sep 17 00:00:00 2001 From: Loc Mai Date: Tue, 26 Oct 2021 02:38:34 +0700 Subject: [PATCH 8/8] change back to index_current Signed-off-by: Loc Mai --- README.md | 2 +- collector/indices.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9bb473d6..1973e594 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,6 @@ Further Information | elasticsearch_indices_active_queries | gauge | 1 | The number of currently active queries | elasticsearch_indices_docs | gauge | 1 | Count of documents on this node | elasticsearch_indices_docs_deleted | gauge | 1 | Count of deleted documents on this node -| elasticsearch_indices_docs_indexed | gauge | 1 | The number of documents currently being indexed to an index | elasticsearch_indices_docs_primary | gauge | | Count of documents with only primary shards on all nodes | elasticsearch_indices_fielddata_evictions | counter | 1 | Evictions from field data | elasticsearch_indices_fielddata_memory_size_bytes | gauge | 1 | Field data cache memory usage in bytes @@ -135,6 +134,7 @@ Further Information | elasticsearch_indices_get_total | counter | 1 | Total get | elasticsearch_indices_indexing_delete_time_seconds_total | counter | 1 | Total time indexing delete in seconds | elasticsearch_indices_indexing_delete_total | counter | 1 | Total indexing deletes +| elasticsearch_indices_index_current | gauge | 1 | The number of documents currently being indexed to an index | elasticsearch_indices_indexing_index_time_seconds_total | counter | 1 | Cumulative index time in seconds | elasticsearch_indices_indexing_index_total | counter | 1 | Total index calls | elasticsearch_indices_mappings_stats_fields | gauge | 1 | Count of fields currently mapped by index diff --git a/collector/indices.go b/collector/indices.go index a1d5f7c2..1a4b0146 100644 --- a/collector/indices.go +++ b/collector/indices.go @@ -614,7 +614,7 @@ func NewIndices(logger log.Logger, client *http.Client, url *url.URL, shards boo { Type: prometheus.GaugeValue, Desc: prometheus.NewDesc( - prometheus.BuildFQName(namespace, "index_stats", "docs_indexed"), + prometheus.BuildFQName(namespace, "index_stats", "index_current"), "The number of documents currently being indexed to an index", indexLabels.keys(), nil, ),