process-reporter
Advanced tools
Comparing version 2.4.0 to 2.5.0
16
index.js
@@ -102,2 +102,5 @@ 'use strict'; | ||
this.cachedMemoryUsage = null; | ||
this.cachedLagTime = null; | ||
this._setupClosure(); | ||
@@ -222,2 +225,7 @@ } | ||
ProcessReporter.prototype.getCachedMemoryUsage = | ||
function getCachedMemoryUsage() { | ||
return this.cachedMemoryUsage; | ||
}; | ||
ProcessReporter.prototype._reportMemory = function _reportMemory() { | ||
@@ -236,2 +244,4 @@ var self = this; | ||
self.statsd.gauge(memPrefix + '.heap-total', usage.heapTotal); | ||
self.cachedMemoryUsage = usage; | ||
}; | ||
@@ -249,2 +259,6 @@ | ||
ProcessReporter.prototype.getCachedLagTime = function getCachedLagTime() { | ||
return this.cachedLagTime; | ||
}; | ||
ProcessReporter.prototype._reportLag = function _reportLag() { | ||
@@ -265,2 +279,4 @@ var self = this; | ||
} | ||
self.cachedLagTime = lagTime; | ||
}; | ||
@@ -267,0 +283,0 @@ |
{ | ||
"name": "process-reporter", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "process reporter", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
22
test.js
@@ -72,2 +72,24 @@ 'use strict'; | ||
test('processReporter caches memory usage and lag time', function t(assert) { | ||
var workerStatsd = createFakeStatsd(); | ||
var clusterStatsd = createFakeStatsd(); | ||
var reporter = processReporter({ | ||
statsd: workerStatsd, | ||
clusterStatsd: clusterStatsd, | ||
lagInterval: 10, | ||
memoryInterval: 10 | ||
}); | ||
reporter.bootstrap(); | ||
setTimeout(onReported, 15); | ||
function onReported() { | ||
assert.notEqual(reporter.getCachedLagTime(), null); | ||
assert.notEqual(reporter.getCachedMemoryUsage(), null); | ||
reporter.destroy(); | ||
assert.end(); | ||
} | ||
}); | ||
test('processReporter prefix', function t(assert) { | ||
@@ -74,0 +96,0 @@ var fakeStatsd = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18141
439