mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Merge pull request #13670 from hashicorp/ui-memory-cgroupsv2
ui: fix zero memory utilization bug on systems using cgroups v2
This commit is contained in:
3
.changelog/13670.txt
Normal file
3
.changelog/13670.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
ui: Fixed a bug where task memory was reported as zero on systems using cgroups v2
|
||||
```
|
||||
@@ -49,7 +49,11 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) {
|
||||
percent: percent(cpuUsed, this.reservedCPU),
|
||||
});
|
||||
|
||||
const memoryUsed = frame.ResourceUsage.MemoryStats.RSS;
|
||||
const memoryUsed =
|
||||
frame.ResourceUsage.MemoryStats.Usage ||
|
||||
frame.ResourceUsage.MemoryStats.RSS ||
|
||||
0;
|
||||
|
||||
this.memory.pushObject({
|
||||
timestamp,
|
||||
used: memoryUsed,
|
||||
@@ -80,7 +84,11 @@ class AllocationStatsTracker extends EmberObject.extend(AbstractStatsTracker) {
|
||||
percentStack: percentCpuTotal + aggregateCpu,
|
||||
});
|
||||
|
||||
const taskMemoryUsed = taskFrame.ResourceUsage.MemoryStats.RSS;
|
||||
const taskMemoryUsed =
|
||||
taskFrame.ResourceUsage.MemoryStats.Usage ||
|
||||
taskFrame.ResourceUsage.MemoryStats.RSS ||
|
||||
0;
|
||||
|
||||
const percentMemoryTotal = percent(
|
||||
taskMemoryUsed / 1024 / 1024,
|
||||
this.reservedMemory
|
||||
|
||||
@@ -54,6 +54,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
|
||||
},
|
||||
MemoryStats: {
|
||||
RSS: (step + 400) * 1024 * 1024,
|
||||
Usage: (step + 400) * 1024 * 1024,
|
||||
},
|
||||
},
|
||||
Tasks: {
|
||||
@@ -64,6 +65,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
|
||||
},
|
||||
MemoryStats: {
|
||||
RSS: (step + 100) * 1024 * 1024,
|
||||
Usage: (step + 100) * 1024 * 1024,
|
||||
},
|
||||
},
|
||||
Timestamp: refDate + step,
|
||||
@@ -75,6 +77,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
|
||||
},
|
||||
MemoryStats: {
|
||||
RSS: (step + 50) * 1024 * 1024,
|
||||
Usage: (step + 50) * 1024 * 1024,
|
||||
},
|
||||
},
|
||||
Timestamp: refDate + step * 10,
|
||||
@@ -86,6 +89,7 @@ module('Unit | Util | AllocationStatsTracker', function () {
|
||||
},
|
||||
MemoryStats: {
|
||||
RSS: (step + 51) * 1024 * 1024,
|
||||
Usage: (step + 51) * 1024 * 1024,
|
||||
},
|
||||
},
|
||||
Timestamp: refDate + step * 100,
|
||||
@@ -251,7 +255,6 @@ module('Unit | Util | AllocationStatsTracker', function () {
|
||||
],
|
||||
'One frame of memory'
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
tracker.get('tasks'),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user