fix(core): update
This commit is contained in:
@ -26,9 +26,12 @@ export class SmartMetrics {
|
||||
let maxHeapSizeMB = heapStats.heap_size_limit / 1024 / 1024;
|
||||
let totalSystemMemoryMB = plugins.os.totalmem() / 1024 / 1024;
|
||||
|
||||
let dockerMemoryLimitMB = totalSystemMemoryMB;
|
||||
let dockerMemoryLimitMB = totalSystemMemoryMB;
|
||||
try {
|
||||
let dockerMemoryLimitBytes = plugins.fs.readFileSync('/sys/fs/cgroup/memory/memory.limit_in_bytes', 'utf8');
|
||||
let dockerMemoryLimitBytes = plugins.fs.readFileSync(
|
||||
'/sys/fs/cgroup/memory/memory.limit_in_bytes',
|
||||
'utf8'
|
||||
);
|
||||
dockerMemoryLimitMB = parseInt(dockerMemoryLimitBytes, 10) / 1024 / 1024;
|
||||
} catch (error) {
|
||||
// Ignore - this will fail if not running in a Docker container
|
||||
@ -90,8 +93,11 @@ export class SmartMetrics {
|
||||
memoryUsageBytes += stats[stat].memory;
|
||||
}
|
||||
|
||||
let memoryPercentage = Math.round((memoryUsageBytes / (this.maxMemoryMB * 1024 * 1024)) * 100 * 100) / 100;
|
||||
let memoryUsageText = `${memoryPercentage}% | ${this.formatBytes(memoryUsageBytes)} / ${this.formatBytes(this.maxMemoryMB * 1024 * 1024)}`;
|
||||
let memoryPercentage =
|
||||
Math.round((memoryUsageBytes / (this.maxMemoryMB * 1024 * 1024)) * 100 * 100) / 100;
|
||||
let memoryUsageText = `${memoryPercentage}% | ${this.formatBytes(
|
||||
memoryUsageBytes
|
||||
)} / ${this.formatBytes(this.maxMemoryMB * 1024 * 1024)}`;
|
||||
|
||||
console.log(`${cpuUsageText} ||| ${memoryUsageText} `);
|
||||
|
||||
|
Reference in New Issue
Block a user