You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by sp...@apache.org on 2024/06/11 15:39:34 UTC
(iotdb) 01/01: fix missing memory metric
This is an automated email from the ASF dual-hosted git repository.
spricoder pushed a commit to branch fix/linux_memory_metrics
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 24a130e3d2aa15c484091621b28d950a9a350461
Author: spricoder <sp...@qq.com>
AuthorDate: Tue Jun 11 23:39:14 2024 +0800
fix missing memory metric
---
.../org/apache/iotdb/metrics/metricsets/system/SystemMetrics.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/system/SystemMetrics.java b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/system/SystemMetrics.java
index 27f31bf09aa..3b98b881b2f 100644
--- a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/system/SystemMetrics.java
+++ b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/system/SystemMetrics.java
@@ -169,6 +169,7 @@ public class SystemMetrics implements IMetricSet {
a -> osMxBean.getCommittedVirtualMemorySize(),
SystemTag.NAME.toString(),
SYSTEM);
+ logger.info("System type: {}", CONFIG.getSystemType());
if (CONFIG.getSystemType() == SystemType.LINUX) {
metricService.createAutoGauge(
SystemMetric.LINUX_MEMORY_SIZE.toString(),
@@ -227,11 +228,11 @@ public class SystemMetrics implements IMetricSet {
result.append(line).append("\n");
}
}
- String[] lines = result.toString().split("\n");
+ String[] lines = result.toString().trim().split("\n");
// if failed to get result
if (lines.length >= 2) {
String[] memParts = lines[1].trim().split("\\s+");
- if (memParts.length == linuxMemoryTitles.length) {
+ if (memParts.length >= linuxMemoryTitles.length) {
usedMemory = Long.parseLong(memParts[2]) * 1024;
sharedMemory = Long.parseLong(memParts[4]) * 1024;
buffCacheMemory = Long.parseLong(memParts[5]) * 1024;