From 1162392f8be910021a5d767371ce90cc1332a049 Mon Sep 17 00:00:00 2001 From: khushbr Date: Wed, 5 Aug 2020 17:08:51 -0700 Subject: [PATCH 1/2] Fixing the summary serialization issue for cache RCAs --- .../rca/store/rca/cache/FieldDataCacheRca.java | 4 +--- .../rca/store/rca/cache/ShardRequestCacheRca.java | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java index 784c6e569..08f2fc07b 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java @@ -112,7 +112,7 @@ public ResourceFlowUnit operate() { cacheEvictionCollector.collect(currTimestamp); if (counter >= rcaPeriod) { ResourceContext context; - HotNodeSummary nodeSummary; + HotNodeSummary nodeSummary = new HotNodeSummary(instanceDetails.getInstanceId(), instanceDetails.getInstanceIp()); InstanceDetails instanceDetails = getInstanceDetails(); double fieldDataCacheMaxSizeInBytes = getCacheMaxSize( @@ -121,12 +121,10 @@ public ResourceFlowUnit operate() { fieldDataCacheSizeGroupByOperation, fieldDataCacheMaxSizeInBytes, cacheSizeThreshold); if (cacheEvictionCollector.isUnhealthy(currTimestamp) && exceedsSizeThreshold) { context = new ResourceContext(Resources.State.UNHEALTHY); - nodeSummary = new HotNodeSummary(instanceDetails.getInstanceId(), instanceDetails.getInstanceIp()); nodeSummary.appendNestedSummary(cacheEvictionCollector.generateSummary(currTimestamp)); } else { context = new ResourceContext(Resources.State.HEALTHY); - nodeSummary = null; } counter = 0; diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java index db60cbe8d..ab69d3104 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java @@ -124,7 +124,7 @@ public ResourceFlowUnit operate() { cacheHitCollector.collect(currTimestamp); if (counter >= rcaPeriod) { ResourceContext context; - HotNodeSummary nodeSummary; + HotNodeSummary nodeSummary = new HotNodeSummary(instanceDetails.getInstanceId(), instanceDetails.getInstanceIp()); InstanceDetails instanceDetails = getInstanceDetails(); double shardRequestCacheMaxSizeInBytes = getCacheMaxSize( @@ -138,11 +138,9 @@ public ResourceFlowUnit operate() { && cacheHitCollector.isUnhealthy(currTimestamp) && exceedsSizeThreshold) { context = new ResourceContext(Resources.State.UNHEALTHY); - nodeSummary = new HotNodeSummary(instanceDetails.getInstanceId(), instanceDetails.getInstanceIp()); nodeSummary.appendNestedSummary(cacheEvictionCollector.generateSummary(currTimestamp)); } else { context = new ResourceContext(Resources.State.HEALTHY); - nodeSummary = null; } counter = 0; From 70f1966266182e7244bba09b8a2e091f1abb61d6 Mon Sep 17 00:00:00 2001 From: khushbr Date: Wed, 5 Aug 2020 17:27:39 -0700 Subject: [PATCH 2/2] Fixing the InstanceDetails failure --- .../rca/store/rca/cache/FieldDataCacheRca.java | 2 +- .../rca/store/rca/cache/ShardRequestCacheRca.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java index 08f2fc07b..e55a04ad9 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/FieldDataCacheRca.java @@ -112,9 +112,9 @@ public ResourceFlowUnit operate() { cacheEvictionCollector.collect(currTimestamp); if (counter >= rcaPeriod) { ResourceContext context; + InstanceDetails instanceDetails = getInstanceDetails(); HotNodeSummary nodeSummary = new HotNodeSummary(instanceDetails.getInstanceId(), instanceDetails.getInstanceIp()); - InstanceDetails instanceDetails = getInstanceDetails(); double fieldDataCacheMaxSizeInBytes = getCacheMaxSize( getAppContext(), new NodeKey(instanceDetails), ResourceUtil.FIELD_DATA_CACHE_MAX_SIZE); Boolean exceedsSizeThreshold = isSizeThresholdExceeded( diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java index ab69d3104..f09b3c6ae 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/rca/store/rca/cache/ShardRequestCacheRca.java @@ -124,9 +124,9 @@ public ResourceFlowUnit operate() { cacheHitCollector.collect(currTimestamp); if (counter >= rcaPeriod) { ResourceContext context; + InstanceDetails instanceDetails = getInstanceDetails(); HotNodeSummary nodeSummary = new HotNodeSummary(instanceDetails.getInstanceId(), instanceDetails.getInstanceIp()); - InstanceDetails instanceDetails = getInstanceDetails(); double shardRequestCacheMaxSizeInBytes = getCacheMaxSize( getAppContext(), new NodeKey(instanceDetails), ResourceUtil.SHARD_REQUEST_CACHE_MAX_SIZE); Boolean exceedsSizeThreshold = isSizeThresholdExceeded(