From d14cde045366ca3648160ebb365fd1356e735f5d Mon Sep 17 00:00:00 2001 From: noblepaul Date: Tue, 30 Jul 2024 03:17:53 +1000 Subject: [PATCH] Revert "update metrics added" This reverts commit 9d436d48e31ef72dc8c734e2d23c0f5baa7de79c. undoing accidental commit --- .../servlet/PrometheusMetricsServlet.java | 19 +------------ .../servlet/PrometheusMetricsServletTest.java | 28 ++----------------- 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/servlet/PrometheusMetricsServlet.java b/solr/core/src/java/org/apache/solr/servlet/PrometheusMetricsServlet.java index bb2d5e41859..ee7d6d7f13e 100644 --- a/solr/core/src/java/org/apache/solr/servlet/PrometheusMetricsServlet.java +++ b/solr/core/src/java/org/apache/solr/servlet/PrometheusMetricsServlet.java @@ -566,7 +566,7 @@ static class CoresMetricsApiCaller extends MetricsApiCaller { CoresMetricsApiCaller() { super( "core", - "INDEX.merge.,QUERY./get.requestTimes,QUERY./get[shard].requestTimes,QUERY./select.requestTimes,QUERY./select[shard].requestTimes,UPDATE./update.requestTimes,UPDATE./update[local].requestTimes,UPDATE.updateHandler.autoCommits,UPDATE.updateHandler.commits,UPDATE.updateHandler.cumulativeDeletesBy,UPDATE.updateHandler.softAutoCommits,UPDATE.updateHandler.cumulativeAdds,UPDATE.updateHandler.cumulativeDeletesById,UPDATE.updateHandler.cumulativeErrors", + "INDEX.merge.,QUERY./get.requestTimes,QUERY./get[shard].requestTimes,QUERY./select.requestTimes,QUERY./select[shard].requestTimes,UPDATE./update.requestTimes,UPDATE./update[local].requestTimes,UPDATE.updateHandler.autoCommits,UPDATE.updateHandler.commits,UPDATE.updateHandler.cumulativeDeletesBy,UPDATE.updateHandler.softAutoCommits", "count"); } @@ -612,8 +612,6 @@ protected void handle(List results, JsonNode metrics) throws I long deleteById = 0; long deleteByQuery = 0; long softAutoCommit = 0; - long adds = 0; - long updateErrors = 0; for (JsonNode core : metrics) { mergeMajor += getNumber(core, "INDEX.merge.major", property).longValue(); mergeMajorDocs += getNumber(core, "INDEX.merge.major.running.docs").longValue(); @@ -631,9 +629,6 @@ protected void handle(List results, JsonNode metrics) throws I getNumber(core, "UPDATE.updateHandler.cumulativeDeletesById", property).longValue(); deleteByQuery += getNumber(core, "UPDATE.updateHandler.cumulativeDeletesByQuery", property).longValue(); - adds += getNumber(core, "UPDATE.updateHandler.cumulativeAdds", property).longValue(); - updateErrors += - getNumber(core, "UPDATE.updateHandler.cumulativeErrors", property).longValue(); softAutoCommit += getNumber(core, "UPDATE.updateHandler.softAutoCommits").longValue(); } results.add( @@ -726,18 +721,6 @@ protected void handle(List results, JsonNode metrics) throws I PrometheusMetricType.COUNTER, "cumulative number of deletes by query across cores", deleteByQuery)); - results.add( - new PrometheusMetric( - "doc_adds", - PrometheusMetricType.COUNTER, - "cumulative number of docs added across cores", - adds)); - results.add( - new PrometheusMetric( - "update_errors", - PrometheusMetricType.COUNTER, - "cumulative number of errors during updates across cores", - updateErrors)); } } diff --git a/solr/core/src/test/org/apache/solr/servlet/PrometheusMetricsServletTest.java b/solr/core/src/test/org/apache/solr/servlet/PrometheusMetricsServletTest.java index 822b65b3bb7..6ce88f41776 100644 --- a/solr/core/src/test/org/apache/solr/servlet/PrometheusMetricsServletTest.java +++ b/solr/core/src/test/org/apache/solr/servlet/PrometheusMetricsServletTest.java @@ -307,8 +307,6 @@ public void testCoresMetricsApiCaller() throws Exception { + " \"UPDATE.updateHandler.commits\":{\"count\":33}," + " \"UPDATE.updateHandler.cumulativeDeletesById\":{\"count\":14},\n" + " \"UPDATE.updateHandler.cumulativeDeletesByQuery\":{\"count\":15},\n" - + " \"UPDATE.updateHandler.cumulativeAdds\":{\"count\":150},\n" - + " \"UPDATE.updateHandler.cumulativeErrors\":{\"count\":1},\n" + " \"UPDATE.updateHandler.softAutoCommits\":16},\n" + " \"solr.core.testdrive.shard1.replica_n1\":{\n" + " \"INDEX.merge.errors\":17,\n" @@ -330,8 +328,6 @@ public void testCoresMetricsApiCaller() throws Exception { + " \"UPDATE.updateHandler.commits\":{\"count\":34}," + " \"UPDATE.updateHandler.cumulativeDeletesById\":{\"count\":30},\n" + " \"UPDATE.updateHandler.cumulativeDeletesByQuery\":{\"count\":31},\n" - + " \"UPDATE.updateHandler.cumulativeAdds\":{\"count\":191},\n" - + " \"UPDATE.updateHandler.cumulativeErrors\":{\"count\":3},\n" + " \"UPDATE.updateHandler.softAutoCommits\":32}}}"; String output = "# HELP merges_major cumulative number of major merges across cores\n" @@ -378,13 +374,7 @@ public void testCoresMetricsApiCaller() throws Exception { + "deletes_by_id 44\n" + "# HELP deletes_by_query cumulative number of deletes by query across cores\n" + "# TYPE deletes_by_query counter\n" - + "deletes_by_query 46\n" - + "# HELP doc_adds cumulative number of docs added across cores\n" - + "# TYPE doc_adds counter\n" - + "doc_adds 341\n" - + "# HELP update_errors cumulative number of errors during updates across cores\n" - + "# TYPE update_errors counter\n" - + "update_errors 4\n"; + + "deletes_by_query 46\n"; assertMetricsApiCaller(new PrometheusMetricsServlet.CoresMetricsApiCaller(), json, 14, output); } @@ -406,8 +396,6 @@ public void testCoresMetricsApiCallerMissingIndex() throws Exception { + " \"UPDATE.updateHandler.autoCommits\":4,\n" + " \"UPDATE.updateHandler.cumulativeDeletesById\":{\"count\":5},\n" + " \"UPDATE.updateHandler.cumulativeDeletesByQuery\":{\"count\":6},\n" - + " \"UPDATE.updateHandler.cumulativeAdds\":{\"count\":0},\n" - + " \"UPDATE.updateHandler.cumulativeErrors\":{\"count\":0},\n" + " \"UPDATE.updateHandler.softAutoCommits\":7},\n" + " \"solr.core.testdrive.shard1.replica_n1\":{\n" + " \"QUERY./get.requestTimes\":{\"count\":32},\n" @@ -419,8 +407,6 @@ public void testCoresMetricsApiCallerMissingIndex() throws Exception { + " \"UPDATE.updateHandler.autoCommits\":11,\n" + " \"UPDATE.updateHandler.cumulativeDeletesById\":{\"count\":12},\n" + " \"UPDATE.updateHandler.cumulativeDeletesByQuery\":{\"count\":13},\n" - + " \"UPDATE.updateHandler.cumulativeAdds\":{\"count\":0},\n" - + " \"UPDATE.updateHandler.cumulativeErrors\":{\"count\":0},\n" + " \"UPDATE.updateHandler.softAutoCommits\":14},\n" + " \"solr.core.loadtest.shard1_0.replica_n7\":{\n" + " \"QUERY./get.requestTimes\":{\"count\":35},\n" @@ -432,8 +418,6 @@ public void testCoresMetricsApiCallerMissingIndex() throws Exception { + " \"UPDATE.updateHandler.autoCommits\":18,\n" + " \"UPDATE.updateHandler.cumulativeDeletesById\":{\"count\":19},\n" + " \"UPDATE.updateHandler.cumulativeDeletesByQuery\":{\"count\":20},\n" - + " \"UPDATE.updateHandler.cumulativeAdds\":{\"count\":0},\n" - + " \"UPDATE.updateHandler.cumulativeErrors\":{\"count\":0},\n" + " \"UPDATE.updateHandler.softAutoCommits\":21},\n" + " \"solr.core.local.shard1.replica_n1\":{\n" + " \"QUERY./get.requestTimes\":{\"count\":38},\n" @@ -445,8 +429,6 @@ public void testCoresMetricsApiCallerMissingIndex() throws Exception { + " \"UPDATE.updateHandler.autoCommits\":25,\n" + " \"UPDATE.updateHandler.cumulativeDeletesById\":{\"count\":26},\n" + " \"UPDATE.updateHandler.cumulativeDeletesByQuery\":{\"count\":27},\n" - + " \"UPDATE.updateHandler.cumulativeAdds\":{\"count\":0},\n" - + " \"UPDATE.updateHandler.cumulativeErrors\":{\"count\":0},\n" + " \"UPDATE.updateHandler.softAutoCommits\":28}}}"; String output = "# HELP merges_major cumulative number of major merges across cores\n" @@ -493,13 +475,7 @@ public void testCoresMetricsApiCallerMissingIndex() throws Exception { + "deletes_by_id 62\n" + "# HELP deletes_by_query cumulative number of deletes by query across cores\n" + "# TYPE deletes_by_query counter\n" - + "deletes_by_query 66\n" - + "# HELP doc_adds cumulative number of docs added across cores\n" - + "# TYPE doc_adds counter\n" - + "doc_adds 0\n" - + "# HELP update_errors cumulative number of errors during updates across cores\n" - + "# TYPE update_errors counter\n" - + "update_errors 0\n"; + + "deletes_by_query 66\n"; assertMetricsApiCaller(new PrometheusMetricsServlet.CoresMetricsApiCaller(), json, 25, output); } }