Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

process-reporter

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

process-reporter - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

LICENSE

62

index.js

@@ -10,2 +10,3 @@ 'use strict';

/*eslint max-statements: [1, 30]*/
function ProcessReporter(options) {

@@ -19,11 +20,49 @@ if (!(this instanceof ProcessReporter)) {

assert(typeof options === 'object', 'options required');
assert(typeof options.statsd === 'object', 'options.statsd required');
self.statsd = options.statsd;
assert(typeof self.statsd === 'object', 'options.statsd required');
self.handleInterval = options.handleInterval || 1000;
assert(
typeof self.handleInterval === 'number',
'expected options.handleInterval to be number'
);
self.requestInterval = options.requestInterval || 100;
assert(
typeof self.requestInterval === 'number',
'expected options.requestInterval to be number'
);
self.memoryInterval = options.memoryInterval || 1000;
assert(
typeof self.memoryInterval === 'number',
'expected options.memoryInterval to be number'
);
self.lagInterval = options.lagInterval || 500;
assert(
typeof self.lagInterval === 'number',
'expected options.lagInterval to be number'
);
self.statsd = options.statsd;
self.timers = options.timers || timers;
assert(
typeof self.timers === 'object' &&
typeof self.timers.setTimeout === 'function' &&
typeof self.timers.clearTimeout === 'function',
'expected options.timers to be object with setTimeout and ' +
'clearTimeout functions'
);
self.prefix = options.prefix || '';
assert(
typeof self.prefix === 'string',
'expected options.prefix to be string'
);
if (self.prefix[self.prefix.length - 1] !== '.' && self.prefix !== '') {
self.prefix = self.prefix + '.';
}
self.handleTimer = null;

@@ -33,4 +72,2 @@ self.requestTimer = null;

self.lagTimer = null;
self.timers = options.timers || timers;
}

@@ -86,3 +123,3 @@

var num = process._getActiveHandles().length;
self.statsd.timing('process-reporter.handles', num);
self.statsd.timing(self.prefix + 'process-reporter.handles', num);
};

@@ -94,3 +131,3 @@

var num = process._getActiveRequests().length;
self.statsd.timing('process-reporter.requests', num);
self.statsd.timing(self.prefix + 'process-reporter.requests', num);
};

@@ -102,7 +139,7 @@

var usage = process.memoryUsage();
var prefix = 'process-reporter.memory-usage';
var memPrefix = self.prefix + 'process-reporter.memory-usage';
self.statsd.gauge(prefix + '.rss', usage.rss);
self.statsd.gauge(prefix + '.heap-used', usage.heapUsed);
self.statsd.gauge(prefix + '.heap-total', usage.heapTotal);
self.statsd.gauge(memPrefix + '.rss', usage.rss);
self.statsd.gauge(memPrefix + '.heap-used', usage.heapUsed);
self.statsd.gauge(memPrefix + '.heap-total', usage.heapTotal);
};

@@ -113,3 +150,6 @@

self.statsd.timing('process-reporter.lag-sampler', toobusy.lag());
self.statsd.timing(
self.prefix + 'process-reporter.lag-sampler',
toobusy.lag()
);
};

3

package.json
{
"name": "process-reporter",
"version": "1.0.0",
"version": "1.1.0",
"description": "process reporter",

@@ -26,3 +26,2 @@ "main": "index.js",

"test": "npm run check-ls -s && npm run lint -s && npm run cover",
"test-repeat": "NODE_DEBUG=autobahn node test/index.js | FORCE_COLOR=1 tap-spec; while [ $? -eq 0 ]; do NODE_DEBUG=autobahn node test/index.js | FORCE_COLOR=1 tap-spec; done;",
"test-cover": "istanbul cover test.js",

@@ -29,0 +28,0 @@ "view-cover": "opn ./coverage/index.html",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc