aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-09-25 22:11:19 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-09-26 23:49:38 +0200
commite9bd8978f291768fa1283bcff6a4d6179b87f53b (patch)
treef07225b8079b0f66f1a77ea6857b6e29b472a5dc /server
parent68761c40c492533d35cc1de180d0c191c9181f1b (diff)
downloadsonarqube-e9bd8978f291768fa1283bcff6a4d6179b87f53b.tar.gz
sonarqube-e9bd8978f291768fa1283bcff6a4d6179b87f53b.zip
SONAR-9802 add cpu usage of ES in cluster mode
Diffstat (limited to 'server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java1
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStateSectionTest.java2
2 files changed, 3 insertions, 0 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java
index 40d8803dbf9..5700c23bdc3 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java
@@ -74,6 +74,7 @@ public class EsStateSection implements SystemInfoSection {
}
public static void toProtobuf(NodeStats stats, ProtobufSystemInfo.Section.Builder protobuf) {
+ setAttribute(protobuf, "CPU Usage (%)", stats.getProcess().getCpu().getPercent());
setAttribute(protobuf, "Disk Available", byteCountToDisplaySize(stats.getFs().getTotal().getAvailable().getBytes()));
setAttribute(protobuf, "Store Size", byteCountToDisplaySize(stats.getIndices().getStore().getSizeInBytes()));
setAttribute(protobuf, "Open File Descriptors", stats.getProcess().getOpenFileDescriptors());
diff --git a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStateSectionTest.java b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStateSectionTest.java
index af248d63640..cdcffa418bf 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStateSectionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/platform/monitoring/EsStateSectionTest.java
@@ -55,6 +55,8 @@ public class EsStateSectionTest {
@Test
public void node_attributes() {
ProtobufSystemInfo.Section section = underTest.toProtobuf();
+ assertThat(attribute(section, "CPU Usage (%)")).isNotNull();
+ assertThat(attribute(section, "Disk Available")).isNotNull();
assertThat(attribute(section, "Store Size")).isNotNull();
}