Skip to content

Commit

Permalink
Fixed the bug in CacheConfigMetricsCollector
Browse files Browse the repository at this point in the history
Signed-off-by: Atharva Sharma <atharvasharma61@gmail.com>
  • Loading branch information
atharvasharma61 committed May 31, 2024
1 parent 71f8ee9 commit 5860387
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ public void collectMetrics(long startTime) {
indicesService,
"indicesRequestCache",
true);
Object openSearchOnHeapCache =
FieldUtils.readField(reqCache, "cache", true);
Cache requestCache =
(Cache)
FieldUtils.readField(
reqCache, "cache", true);
openSearchOnHeapCache,
"cache",
true);
Long requestCacheMaxSize =
(Long)
FieldUtils.readField(
Expand All @@ -118,10 +122,15 @@ public void collectMetrics(long startTime) {
SHARD_REQUEST_CACHE.toString(),
requestCacheMaxSize);
} catch (Exception e) {
return new CacheMaxSizeStatus(
SHARD_REQUEST_CACHE.toString(), null);
e.printStackTrace();
return null;
}
});

if (shardRequestCacheMaxSizeStatus == null) {
return;
}

value.append(PerformanceAnalyzerMetrics.sMetricNewLineDelimitor)
.append(shardRequestCacheMaxSizeStatus.serialize());
saveMetricValues(value.toString(), startTime);
Expand Down

0 comments on commit 5860387

Please sign in to comment.