Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
533639b66d | |||
8f0ebccb58 | |||
e98b1779e1 | |||
df5197fc8e | |||
0e3fadca36 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@pushrocks/smartmetrics",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@pushrocks/smartmetrics",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartmetrics",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.5",
|
||||
"private": false,
|
||||
"description": "easy system metrics",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -26,7 +26,8 @@ export class SmartMetrics {
|
||||
}
|
||||
this.started = true;
|
||||
while (this.started) {
|
||||
this.logger.log('info', `sending heartbeat for ${this.sourceNameArg}`, {
|
||||
this.logger.log('info', `sending heartbeat for ${this.sourceNameArg} with metrics`, {
|
||||
eventType: 'heartbeat',
|
||||
metrics: await this.getMetrics(),
|
||||
});
|
||||
await plugins.smartdelay.delayFor(60000, null, true);
|
||||
@ -48,11 +49,9 @@ export class SmartMetrics {
|
||||
cpu.times.irq +
|
||||
cpu.times.idle;
|
||||
}
|
||||
|
||||
// Normalize the one returned by process.cpuUsage()
|
||||
// (microseconds VS miliseconds)
|
||||
|
||||
const usage = process.cpuUsage();
|
||||
const currentCPUUsage = (usage.user + usage.system) * 1000;
|
||||
const currentCPUUsage = (usage.user + usage.system);
|
||||
|
||||
// Find out the percentage used for this specific CPU
|
||||
const perc = (currentCPUUsage / total) * 100;
|
||||
|
Reference in New Issue
Block a user