6 Commits

Author SHA1 Message Date
8454244f3b 2.0.5 2023-07-02 23:21:02 +02:00
4b6d6feea1 fix(core): update 2023-07-02 23:21:01 +02:00
01306ed3f9 2.0.4 2023-07-02 23:13:48 +02:00
2a2ca66708 fix(core): update 2023-07-02 23:13:47 +02:00
299e50cbf7 2.0.3 2023-07-02 22:23:47 +02:00
1e6af24df0 fix(core): update 2023-07-02 22:23:46 +02:00
6 changed files with 4623 additions and 15180 deletions

15165
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartmetrics",
"version": "2.0.2",
"version": "2.0.5",
"private": false,
"description": "easy system metrics",
"main": "dist_ts/index.js",
@ -13,11 +13,12 @@
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.63",
"@gitzone/tsbundle": "^2.0.6",
"@gitzone/tstest": "^1.0.72",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.6.1"
"@gitzone/tsbuild": "^2.1.66",
"@gitzone/tsbundle": "^2.0.8",
"@gitzone/tsrun": "^1.2.42",
"@gitzone/tstest": "^1.0.74",
"@pushrocks/tapbundle": "^5.0.8",
"@types/node": "^20.3.3"
},
"browserslist": [
"last 1 chrome versions"
@ -35,12 +36,12 @@
"readme.md"
],
"dependencies": {
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartlog": "^3.0.1",
"@pushrocks/smartdelay": "^3.0.1",
"@pushrocks/smartlog": "^3.0.2",
"@types/pidusage": "^2.0.2",
"pidtree": "^0.6.0",
"pidusage": "^3.0.0",
"prom-client": "^14.0.1"
"pidusage": "^3.0.2",
"prom-client": "^14.2.0"
},
"type": "module"
}

4605
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartmetrics',
version: '2.0.2',
version: '2.0.5',
description: 'easy system metrics'
}

View File

@ -34,8 +34,10 @@ export class SmartMetrics {
// Ignore - this will fail if not running in a Docker container
}
this.maxMemoryMB = Math.min(totalSystemMemoryMB, dockerMemoryLimitMB);
// Set the maximum memory to the lower value between the Docker limit and the total system memory
this.maxMemoryMB = Math.min(totalSystemMemoryMB, dockerMemoryLimitMB, maxHeapSizeMB);
// If the maximum old space size limit is greater than the maximum available memory, throw an error
if (maxHeapSizeMB > this.maxMemoryMB) {
throw new Error('Node.js process can use more memory than is available');
}
@ -88,7 +90,6 @@ export class SmartMetrics {
memoryUsageBytes += stats[stat].memory;
}
// Correct memory usage percentage calculation
let memoryPercentage = Math.round((memoryUsageBytes / (this.maxMemoryMB * 1024 * 1024)) * 100 * 100) / 100;
let memoryUsageText = `${memoryPercentage}% | ${this.formatBytes(memoryUsageBytes)} / ${this.formatBytes(this.maxMemoryMB * 1024 * 1024)}`;

View File

@ -5,6 +5,7 @@
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
"esModuleInterop": true,
"verbatimModuleSyntax": true,
}
}