From 887dafc25f9e1c44791400fbf193a78017170453 Mon Sep 17 00:00:00 2001 From: ZhangHongYin <46039728+SpriCoder@users.noreply.github.com> Date: Wed, 12 Jun 2024 08:56:18 +0800 Subject: [PATCH] Fix missing of linux memory metrics (#12713) * fix missing memory metric * remove the print of type --- .../apache/iotdb/metrics/metricsets/system/SystemMetrics.java | 4 ++-- 1 file changed, 2 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 131ff9f5ac8b..0addc1c6b2c6 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 @@ -227,11 +227,11 @@ private void updateLinuxSystemMemInfo() { 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;