This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a178a79a33f Fix missing of linux memory metrics (#12713)
a178a79a33f is described below
commit a178a79a33f2198bd9e23ece2bed153df11e9a06
Author: ZhangHongYin <[email protected]>
AuthorDate: Wed Jun 12 08:56:18 2024 +0800
Fix missing of linux memory metrics (#12713)
* fix missing memory metric
* remove the print of type
---
.../org/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 27f31bf09aa..1cacf2bf6f5 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 @@ 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;