diff --git a/licenses/performanceanalyzer-rca-1.3.jar.sha1 b/licenses/performanceanalyzer-rca-1.3.jar.sha1 index c2d0c6ea..0df7ed26 100644 --- a/licenses/performanceanalyzer-rca-1.3.jar.sha1 +++ b/licenses/performanceanalyzer-rca-1.3.jar.sha1 @@ -1 +1 @@ -7ab11a3251d4bd2b09ddca5a4f01e4ef3dbdc9ed \ No newline at end of file +4ef70ce3a018f743a7a3a343f76ececd8e91fd18 \ No newline at end of file diff --git a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ThreadPoolMetricsCollector.java b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ThreadPoolMetricsCollector.java index de807433..25397ba2 100644 --- a/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ThreadPoolMetricsCollector.java +++ b/src/main/java/com/amazon/opendistro/elasticsearch/performanceanalyzer/collectors/ThreadPoolMetricsCollector.java @@ -57,11 +57,16 @@ public void collectMetrics(long startTime) { //This is for backward compatibility. core ES may or may not emit latency metric // (depending on whether the patch has been applied or not) // so we need to use reflection to check whether getLatency() method exist in ThreadPoolStats.java. + // call stats.getLatency() Method getLantencyMethod = Stats.class.getMethod("getLatency"); double latency = (Double) getLantencyMethod.invoke(stats); + // call stats.getCapacity() + Method getCapacityMethod = Stats.class.getMethod("getCapacity"); + int capacity = (Integer) getCapacityMethod.invoke(stats); return new ThreadPoolStatus(stats.getName(), stats.getQueue(), stats.getRejected(), - stats.getThreads(), stats.getActive(), latency); + stats.getThreads(), stats.getActive(), + latency, capacity); } catch (Exception e) { //core ES does not have the latency patch. send the threadpool metrics without adding latency. return new ThreadPoolStatus(stats.getName(), @@ -93,6 +98,8 @@ public static class ThreadPoolStatus extends MetricStatus { public final int threadsActive; @JsonInclude(Include.NON_NULL) public final Double queueLatency; + @JsonInclude(Include.NON_NULL) + public final Integer queueCapacity; public ThreadPoolStatus(String type, int queueSize, @@ -105,6 +112,7 @@ public ThreadPoolStatus(String type, this.threadsCount = threadsCount; this.threadsActive = threadsActive; this.queueLatency = null; + this.queueCapacity = null; } public ThreadPoolStatus(String type, @@ -112,13 +120,15 @@ public ThreadPoolStatus(String type, long rejected, int threadsCount, int threadsActive, - double queueLatency) { + double queueLatency, + int queueCapacity) { this.type = type; this.queueSize = queueSize; this.rejected = rejected; this.threadsCount = threadsCount; this.threadsActive = threadsActive; this.queueLatency = queueLatency; + this.queueCapacity = queueCapacity; } @JsonProperty(ThreadPoolDimension.Constants.TYPE_VALUE) @@ -150,5 +160,10 @@ public int getThreadsActive() { public Double getQueueLatency() { return queueLatency; } + + @JsonProperty(ThreadPoolValue.Constants.QUEUE_CAPACITY_VALUE) + public Integer getQueueCapacity() { + return queueCapacity; + } } }