Skip to content

Commit

Permalink
fix: wait 60 seconds before measuring nodejs.cpuUsage so that you don…
Browse files Browse the repository at this point in the history
…'t get an artificially high first reading (#35)
  • Loading branch information
daviande authored Nov 21, 2024
1 parent a6afd9c commit e127443
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ class RuntimeMetrics {
}

_cpuHeap() {
RuntimeMetrics.measureCpuHeap(this);
const reg = this.registry;
this._intervals.push(reg.schedulePeriodically(RuntimeMetrics.measureCpuHeap, 60000, this));
}
Expand Down
2 changes: 1 addition & 1 deletion test/nodemetrics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('nodemetrics', () => {

setTimeout(() => {
const meters = registry.meters();
assert.isTrue(meters.length > 40);
assert.isTrue(meters.length > 15);
metrics.stop();
done();
});
Expand Down

0 comments on commit e127443

Please sign in to comment.