Skip to content

Commit

Permalink
Fix missing of linux memory metrics (#12713)
Browse files Browse the repository at this point in the history
* fix missing memory metric

* remove the print of type
  • Loading branch information
SpriCoder authored Jun 12, 2024
1 parent ed3b4b7 commit a178a79
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a178a79

Please sign in to comment.