From 4ab4a0bb8f61ae0bafb6caf0b4deb83bc61a1ad3 Mon Sep 17 00:00:00 2001 From: Dharmesh Date: Tue, 2 Mar 2021 23:49:47 +0530 Subject: [PATCH] [CHERRY PICK] Adding a additional check to just process first 50 objects of hot store (#284) cr : https://code.amazon.com/reviews/CR-46506118 --- .../collectors/ShardIndexingPressureMetricsCollector.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ShardIndexingPressureMetricsCollector.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ShardIndexingPressureMetricsCollector.java index 9298d7dc..6528a9f6 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ShardIndexingPressureMetricsCollector.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ShardIndexingPressureMetricsCollector.java @@ -55,6 +55,8 @@ public class ShardIndexingPressureMetricsCollector extends PerformanceAnalyzerMe public static final String SHARD_INDEXING_PRESSURE_STORE_FIELD_NAME = "shardIndexingPressureStore"; public static final String SHARD_INDEXING_PRESSURE_HOT_STORE_FIELD_NAME = "shardIndexingPressureHotStore"; + private static final Integer MAX_HOT_STORE_LIMIT = 50; + private final ConfigOverridesWrapper configOverridesWrapper; private final PerformanceAnalyzerController controller; private StringBuilder value; @@ -86,7 +88,7 @@ public void collectMetrics(long startTime) { .get(shardIndexingPressureStore); value.setLength(0); - shardIndexingPressureHotStore.entrySet().stream().forEach(storeObject -> { + shardIndexingPressureHotStore.entrySet().stream().limit(MAX_HOT_STORE_LIMIT).forEach(storeObject -> { try { JSONObject tracker = (JSONObject) parser.parse(mapper.writeValueAsString(storeObject.getValue())); JSONObject shardId = (JSONObject) parser.parse(mapper.writeValueAsString(tracker.get("shardId")));