aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-core
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2021-06-28 10:10:21 -0500
committersonartech <sonartech@sonarsource.com>2021-06-30 20:03:13 +0000
commit551db520fa153e6654e9d39bde8404aeae14f9d3 (patch)
tree80e870a75ec74fc490eebcdcbed32ca7f2839cd2 /server/sonar-webserver-core
parent2b1e236fa390e079bb4277b93b2dc9be25a77c5b (diff)
downloadsonarqube-551db520fa153e6654e9d39bde8404aeae14f9d3.tar.gz
sonarqube-551db520fa153e6654e9d39bde8404aeae14f9d3.zip
SONAR-14917 Misleading memory amounts displayed in Administration > System
Diffstat (limited to 'server/sonar-webserver-core')
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java4
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java28
2 files changed, 16 insertions, 16 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java
index ffc38bfc979..12d50d9c84c 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsIndexesSection.java
@@ -29,7 +29,7 @@ import org.sonar.server.es.EsClient;
import org.sonar.server.es.response.IndexStats;
import org.sonar.server.es.response.IndicesStatsResponse;
-import static org.apache.commons.io.FileUtils.byteCountToDisplaySize;
+import static org.sonar.core.util.FileUtils.humanReadableByteCountSI;
import static org.sonar.process.systeminfo.SystemInfoUtils.setAttribute;
@ServerSide
@@ -60,7 +60,7 @@ public class EsIndexesSection implements SystemInfoSection, Global {
String prefix = "Index " + indexStats.getName() + " - ";
setAttribute(protobuf, prefix + "Docs", indexStats.getDocCount());
setAttribute(protobuf, prefix + "Shards", indexStats.getShardsCount());
- setAttribute(protobuf, prefix + "Store Size", byteCountToDisplaySize(indexStats.getStoreSizeBytes()));
+ setAttribute(protobuf, prefix + "Store Size", humanReadableByteCountSI(indexStats.getStoreSizeBytes()));
}
}
}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java
index 1329bc940ed..d4f62864601 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/EsStateSection.java
@@ -31,7 +31,7 @@ import org.sonar.server.es.response.NodeStats;
import org.sonar.server.es.response.NodeStatsResponse;
import static java.lang.String.format;
-import static org.apache.commons.io.FileUtils.byteCountToDisplaySize;
+import static org.sonar.core.util.FileUtils.humanReadableByteCountSI;
import static org.sonar.process.systeminfo.SystemInfoUtils.setAttribute;
public class EsStateSection implements SystemInfoSection {
@@ -70,28 +70,28 @@ public class EsStateSection implements SystemInfoSection {
public static void toProtobuf(NodeStats stats, ProtobufSystemInfo.Section.Builder protobuf) {
setAttribute(protobuf, "CPU Usage (%)", stats.getCpuUsage());
- setAttribute(protobuf, "Disk Available", byteCountToDisplaySize(stats.getDiskAvailableBytes()));
- setAttribute(protobuf, "Store Size", byteCountToDisplaySize(stats.getIndicesStats().getStoreSizeInBytes()));
- setAttribute(protobuf, "Translog Size", byteCountToDisplaySize(stats.getIndicesStats().getTranslogSizeInBytes()));
+ setAttribute(protobuf, "Disk Available", humanReadableByteCountSI(stats.getDiskAvailableBytes()));
+ setAttribute(protobuf, "Store Size", humanReadableByteCountSI(stats.getIndicesStats().getStoreSizeInBytes()));
+ setAttribute(protobuf, "Translog Size", humanReadableByteCountSI(stats.getIndicesStats().getTranslogSizeInBytes()));
setAttribute(protobuf, "Open File Descriptors", stats.getOpenFileDescriptors());
setAttribute(protobuf, "Max File Descriptors", stats.getMaxFileDescriptors());
setAttribute(protobuf, "JVM Heap Usage", formatPercent(stats.getJvmStats().getHeapUsedPercent()));
- setAttribute(protobuf, "JVM Heap Used", byteCountToDisplaySize(stats.getJvmStats().getHeapUsedInBytes()));
- setAttribute(protobuf, "JVM Heap Max", byteCountToDisplaySize(stats.getJvmStats().getHeapMaxInBytes()));
- setAttribute(protobuf, "JVM Non Heap Used", byteCountToDisplaySize(stats.getJvmStats().getNonHeapUsedInBytes()));
+ setAttribute(protobuf, "JVM Heap Used", humanReadableByteCountSI(stats.getJvmStats().getHeapUsedInBytes()));
+ setAttribute(protobuf, "JVM Heap Max", humanReadableByteCountSI(stats.getJvmStats().getHeapMaxInBytes()));
+ setAttribute(protobuf, "JVM Non Heap Used", humanReadableByteCountSI(stats.getJvmStats().getNonHeapUsedInBytes()));
setAttribute(protobuf, "JVM Threads", stats.getJvmStats().getThreadCount());
- setAttribute(protobuf, "Field Data Memory", byteCountToDisplaySize(stats.getIndicesStats().getFieldDataMemorySizeInBytes()));
+ setAttribute(protobuf, "Field Data Memory", humanReadableByteCountSI(stats.getIndicesStats().getFieldDataMemorySizeInBytes()));
setAttribute(protobuf, "Field Data Circuit Breaker Limit",
- byteCountToDisplaySize(stats.getFieldDataCircuitBreakerLimit()));
+ humanReadableByteCountSI(stats.getFieldDataCircuitBreakerLimit()));
setAttribute(protobuf, "Field Data Circuit Breaker Estimation",
- byteCountToDisplaySize(stats.getFieldDataCircuitBreakerEstimation()));
+ humanReadableByteCountSI(stats.getFieldDataCircuitBreakerEstimation()));
setAttribute(protobuf, "Request Circuit Breaker Limit",
- byteCountToDisplaySize(stats.getRequestCircuitBreakerLimit()));
+ humanReadableByteCountSI(stats.getRequestCircuitBreakerLimit()));
setAttribute(protobuf, "Request Circuit Breaker Estimation",
- byteCountToDisplaySize(stats.getRequestCircuitBreakerEstimation()));
- setAttribute(protobuf, "Query Cache Memory", byteCountToDisplaySize(stats.getIndicesStats().getQueryCacheMemorySizeInBytes()));
+ humanReadableByteCountSI(stats.getRequestCircuitBreakerEstimation()));
+ setAttribute(protobuf, "Query Cache Memory", humanReadableByteCountSI(stats.getIndicesStats().getQueryCacheMemorySizeInBytes()));
setAttribute(protobuf, "Request Cache Memory",
- byteCountToDisplaySize(stats.getIndicesStats().getRequestCacheMemorySizeInBytes()));
+ humanReadableByteCountSI(stats.getIndicesStats().getRequestCacheMemorySizeInBytes()));
}
private static String formatPercent(long amount) {