From 9f34292ecdada68eff3ef60b13c89522cb80c887 Mon Sep 17 00:00:00 2001 From: Raj Datta Manohar Date: Thu, 23 Jul 2020 17:55:39 +0530 Subject: [PATCH 1/2] Adding Hit counts and Miss counts for QueryCache exposed through REST api --- .../rest/action/cat/RestNodesAction.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index b2004e455a7d0..77e07a9f0fef6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -173,10 +173,17 @@ protected Table getTableWithHeader(final RestRequest request) { table.addCell("fielddata.memory_size", "alias:fm,fielddataMemory;default:false;text-align:right;desc:used fielddata cache"); table.addCell("fielddata.evictions", "alias:fe,fielddataEvictions;default:false;text-align:right;desc:fielddata evictions"); - table.addCell("query_cache.memory_size", "alias:qcm,queryCacheMemory;default:false;text-align:right;desc:used query cache"); - table.addCell("query_cache.evictions", "alias:qce,queryCacheEvictions;default:false;text-align:right;desc:query cache evictions"); - - table.addCell("request_cache.memory_size", "alias:rcm,requestCacheMemory;default:false;text-align:right;desc:used request cache"); + table.addCell("query_cache.memory_size", + "alias:qcm,queryCacheMemory;default:false;text-align:right;desc:used query cache"); + table.addCell("query_cache.evictions", + "alias:qce,queryCacheEvictions;default:false;text-align:right;desc:query cache evictions"); + table.addCell("query_cache.hit_count", + "alias:qchc,queryCacheHitCount;default:false;text-align:right;desc:query cache hit counts"); + table.addCell("query_cache.miss_count", + "alias:qcmc,queryCacheMissCount;default:false;text-align:right;desc:query cache miss counts"); + + table.addCell("request_cache.memory_size", + "alias:rcm,requestCacheMemory;default:false;text-align:right;desc:used request cache"); table.addCell("request_cache.evictions", "alias:rce,requestCacheEvictions;default:false;text-align:right;desc:request cache evictions"); table.addCell("request_cache.hit_count", @@ -365,6 +372,8 @@ Table buildTable(boolean fullId, RestRequest req, ClusterStateResponse state, No QueryCacheStats fcStats = indicesStats == null ? null : indicesStats.getQueryCache(); table.addCell(fcStats == null ? null : fcStats.getMemorySize()); table.addCell(fcStats == null ? null : fcStats.getEvictions()); + table.addCell(fcStats == null ? null : fcStats.getHitCount()); + table.addCell(fcStats == null ? null : fcStats.getMissCount()); RequestCacheStats qcStats = indicesStats == null ? null : indicesStats.getRequestCache(); table.addCell(qcStats == null ? null : qcStats.getMemorySize()); From 7ae5a8e2810f3daf1d4e79711a381b45e2f6708d Mon Sep 17 00:00:00 2001 From: Raj Datta Manohar Date: Tue, 28 Jul 2020 20:34:11 +0530 Subject: [PATCH 2/2] Fixed Line Length :wq --- .../elasticsearch/rest/action/cat/RestNodesAction.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index 77e07a9f0fef6..9a05e75d1d0ec 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -173,12 +173,9 @@ protected Table getTableWithHeader(final RestRequest request) { table.addCell("fielddata.memory_size", "alias:fm,fielddataMemory;default:false;text-align:right;desc:used fielddata cache"); table.addCell("fielddata.evictions", "alias:fe,fielddataEvictions;default:false;text-align:right;desc:fielddata evictions"); - table.addCell("query_cache.memory_size", - "alias:qcm,queryCacheMemory;default:false;text-align:right;desc:used query cache"); - table.addCell("query_cache.evictions", - "alias:qce,queryCacheEvictions;default:false;text-align:right;desc:query cache evictions"); - table.addCell("query_cache.hit_count", - "alias:qchc,queryCacheHitCount;default:false;text-align:right;desc:query cache hit counts"); + table.addCell("query_cache.memory_size", "alias:qcm,queryCacheMemory;default:false;text-align:right;desc:used query cache"); + table.addCell("query_cache.evictions", "alias:qce,queryCacheEvictions;default:false;text-align:right;desc:query cache evictions"); + table.addCell("query_cache.hit_count", "alias:qchc,queryCacheHitCount;default:false;text-align:right;desc:query cache hit counts"); table.addCell("query_cache.miss_count", "alias:qcmc,queryCacheMissCount;default:false;text-align:right;desc:query cache miss counts");