From: Simon Brandhof Date: Mon, 25 Sep 2017 20:11:19 +0000 (+0200) Subject: SONAR-9802 add cpu usage of ES in cluster mode X-Git-Tag: 6.6-RC1~202 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e9bd8978f291768fa1283bcff6a4d6179b87f53b;p=sonarqube.git SONAR-9802 add cpu usage of ES in cluster mode --- 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(); }