aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-10-14 18:15:57 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-10-14 18:15:57 +0200
commit2fb3a8dd43de863b90945a94089082865e6601c4 (patch)
tree2e0eaf638bc1f5ae09b07c7deafc568e7b0d786e
parentbf1ca9e5cdb705c969d93755f52c1da34e64c0dd (diff)
downloadsonarqube-2fb3a8dd43de863b90945a94089082865e6601c4.tar.gz
sonarqube-2fb3a8dd43de863b90945a94089082865e6601c4.zip
Add ES circuit breaker stats to System Info page
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsMonitor.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsMonitor.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsMonitor.java
index 743a5c11af7..ce61c84e0b7 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsMonitor.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsMonitor.java
@@ -20,17 +20,17 @@
package org.sonar.server.platform.monitoring;
+import java.util.LinkedHashMap;
+import java.util.Map;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthStatus;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
import org.elasticsearch.action.admin.indices.stats.IndexStats;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
+import org.elasticsearch.common.breaker.CircuitBreaker;
import org.sonar.server.es.EsClient;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
import static org.apache.commons.io.FileUtils.byteCountToDisplaySize;
public class EsMonitor extends BaseMonitorMBean implements EsMonitorMBean {
@@ -109,8 +109,13 @@ public class EsMonitor extends BaseMonitorMBean implements EsMonitorMBean {
nodeAttributes.put("JVM Heap Max", byteCountToDisplaySize(stats.getJvm().getMem().getHeapMax().bytes()));
nodeAttributes.put("JVM Non Heap Used", byteCountToDisplaySize(stats.getJvm().getMem().getNonHeapUsed().bytes()));
nodeAttributes.put("JVM Threads", stats.getJvm().getThreads().count());
- nodeAttributes.put("Field Cache Memory", byteCountToDisplaySize(stats.getIndices().getFieldData().getMemorySizeInBytes()));
+ nodeAttributes.put("Field Data Memory", byteCountToDisplaySize(stats.getIndices().getFieldData().getMemorySizeInBytes()));
+ nodeAttributes.put("Field Data Circuit Breaker Limit", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.Name.FIELDDATA).getLimit()));
+ nodeAttributes.put("Field Data Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.Name.FIELDDATA).getEstimated()));
+ nodeAttributes.put("Request Circuit Breaker Limit", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.Name.REQUEST).getLimit()));
+ nodeAttributes.put("Request Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.Name.REQUEST).getEstimated()));
nodeAttributes.put("Filter Cache Memory", byteCountToDisplaySize(stats.getIndices().getFilterCache().getMemorySizeInBytes()));
+ nodeAttributes.put("Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes()));
nodeAttributes.put("ID Cache Memory", byteCountToDisplaySize(stats.getIndices().getIdCache().getMemorySizeInBytes()));
nodeAttributes.put("Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes()));
}
@@ -121,7 +126,7 @@ public class EsMonitor extends BaseMonitorMBean implements EsMonitorMBean {
return esClient.prepareClusterStats().get();
}
- private String formatPercent(long amount) {
+ private static String formatPercent(long amount) {
return String.format("%.1f%%", 100 * amount * 1.0D / 100L);
}
}