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

appcd-agent

Package Overview
Dependencies
Maintainers
3
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appcd-agent - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0-0

361

dist/agent.js

@@ -1,18 +0,14 @@

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports.default = undefined;
exports.default = void 0;
var _collection = require('./collection');
var _collection = _interopRequireDefault(require("./collection"));
var _collection2 = _interopRequireDefault(_collection);
var _os = _interopRequireDefault(require("os"));
var _os = require('os');
var _events = require("events");
var _os2 = _interopRequireDefault(_os);
var _events = require('events');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -24,200 +20,203 @@

let Agent = class Agent extends _events.EventEmitter {
/**
* Creates the Agent instance.
*
* @param {Object} [opts] - Various options.
* @param {Number} [opts.pollInterval=1000] - The number of milliseconds to poll the metrics.
* @access public
*/
constructor(opts = {}) {
if (!opts || typeof opts !== 'object') {
throw new TypeError('Expected options to be an object');
}
/**
* Creates the Agent instance.
*
* @param {Object} [opts] - Various options.
* @param {Number} [opts.pollInterval=1000] - The number of milliseconds to poll the metrics.
* @access public
*/
constructor(opts = {}) {
if (!opts || typeof opts !== 'object') {
throw new TypeError('Expected options to be an object');
}
super();
super();
/**
* The number of milliseconds to wait before polling.
* @type {Number}
*/
/**
* The number of milliseconds to wait before polling.
* @type {Number}
this.pollInterval = Math.max(~~opts.pollInterval || 1000, 1);
/**
* A map of names to collections.
* @type {Object}
*/
this.buckets = {};
/**
* A list of functions to call when polling for stats.
* @type {Array}
*/
this.collectors = [];
}
/**
* Fetches the stats for the given bucket name.
*
* @param {String} name - The bucket name.
* @returns {Object}
* @access public
*/
this.pollInterval = Math.max(~~opts.pollInterval || 1000, 1);
/**
* A map of names to collections.
* @type {Object}
getStats(name) {
return this.buckets[name] ? this.buckets[name].collection.stats : null;
}
/**
* Starts monitoring the system.
*
* @returns {Agent}
* @access public
*/
this.buckets = {};
/**
* A list of functions to call when polling for stats.
* @type {Array}
start() {
this.initCpu = this.currentCpu = process.cpuUsage();
this.initHrtime = this.currentHrTime = process.hrtime();
clearTimeout(this.pollTimer);
this.poll();
return this;
}
/**
* Stops monitoring the system.
*
* @returns {Agent}
* @access public
*/
this.collectors = [];
}
/**
* Fetches the stats for the given bucket name.
*
* @param {String} name - The bucket name.
* @returns {Object}
* @access public
*/
getStats(name) {
return this.buckets[name] ? this.buckets[name].collection.stats : null;
}
/**
* Starts monitoring the system.
*
* @returns {Agent}
* @access public
*/
start() {
this.initCpu = this.currentCpu = process.cpuUsage();
this.initHrtime = this.currentHrTime = process.hrtime();
stop() {
clearTimeout(this.pollTimer);
return this;
}
/**
* Adds a new collector.
*
* @param {Function} fn - The collector callback to add.
* @returns {Agent}
* @access public
*/
clearTimeout(this.pollTimer);
this.poll();
return this;
}
addCollector(fn) {
if (!fn || typeof fn !== 'function') {
throw new TypeError('Expected collector to be a function');
}
/**
* Stops monitoring the system.
*
* @returns {Agent}
* @access public
*/
stop() {
clearTimeout(this.pollTimer);
return this;
}
this.collectors.push(fn);
return this;
}
/**
* Removes a collector.
*
* @param {Function} fn - The collector callback to remove.
* @returns {Agent}
* @access public
*/
/**
* Adds a new collector.
*
* @param {Function} fn - The collector callback to add.
* @returns {Agent}
* @access public
*/
addCollector(fn) {
if (!fn || typeof fn !== 'function') {
throw new TypeError('Expected collector to be a function');
}
this.collectors.push(fn);
return this;
}
/**
* Removes a collector.
*
* @param {Function} fn - The collector callback to remove.
* @returns {Agent}
* @access public
*/
removeCollector(fn) {
if (!fn || typeof fn !== 'function') {
throw new TypeError('Expected collector to be a function');
}
removeCollector(fn) {
if (!fn || typeof fn !== 'function') {
throw new TypeError('Expected collector to be a function');
}
for (let i = 0; i < this.collectors.length; i++) {
if (this.collectors[i] === fn) {
this.collectors.splice(i--, 1);
}
}
for (let i = 0; i < this.collectors.length; i++) {
if (this.collectors[i] === fn) {
this.collectors.splice(i--, 1);
}
}
return this;
}
return this;
}
/**
* Polls the CPU and memory.
*
* @access private
*/
/**
* Polls the CPU and memory.
*
* @access private
*/
poll() {
const cpu = process.cpuUsage(this.initCpu);
const hrtime = process.hrtime(this.initHrtime);
const mem = process.memoryUsage();
const stats = {
cpu: (cpu.user + cpu.system) / (hrtime[0] * 1000000 + hrtime[1] / 1000) * 100,
freemem: _os2.default.freemem(),
heapTotal: mem.heapTotal,
heapUsed: mem.heapUsed,
rss: mem.rss
};
Promise.all(this.collectors.map(fn => Promise.resolve().then(() => fn()).then(result => {
if (result && typeof result === 'object') {
Object.assign(stats, result);
}
}))).then(() => {
// figure out how long it's been since we started the last poll
const now = Date.now();
const delta = this.lastTimestamp ? now - this.lastTimestamp : 0;
this.lastTimestamp = now;
poll() {
const cpu = process.cpuUsage(this.initCpu);
const hrtime = process.hrtime(this.initHrtime);
const mem = process.memoryUsage();
const stats = {
cpu: (cpu.user + cpu.system) / (hrtime[0] * 1000000 + hrtime[1] / 1000) * 100,
freemem: _os.default.freemem(),
heapTotal: mem.heapTotal,
heapUsed: mem.heapUsed,
rss: mem.rss
};
Promise.all(this.collectors.map(fn => Promise.resolve().then(() => fn()).then(result => {
if (result && typeof result === 'object') {
Object.assign(stats, result);
}
}))).then(() => {
// figure out how long it's been since we started the last poll
const now = Date.now();
const delta = this.lastTimestamp ? now - this.lastTimestamp : 0;
this.lastTimestamp = now; // schedule the next poll
// schedule the next poll
const next = this.pollInterval - delta % this.pollInterval;
this.pollTimer = setTimeout(this.poll.bind(this), next);
const next = this.pollInterval - delta % this.pollInterval;
this.pollTimer = setTimeout(this.poll.bind(this), next); // figure out how many intervals we missed, we'll interpolate the values later
// figure out how many intervals we missed, we'll interpolate the values later
const missed = Math.floor((delta - this.pollInterval) / this.pollInterval) + 1;
const missed = Math.floor((delta - this.pollInterval) / this.pollInterval) + 1; // make sure we have collections for all the data we want to store
// make sure we have collections for all the data we want to store
for (const name of Object.keys(stats)) {
if (!this.buckets[name]) {
this.buckets[name] = {
collection: new _collection2.default(60 * 15), // 15 minutes worth of data
last: null
};
}
}
for (const name of Object.keys(stats)) {
if (!this.buckets[name]) {
this.buckets[name] = {
collection: new _collection.default(60 * 15),
// 15 minutes worth of data
last: null
};
}
} // add the values for each stat to its bucket, or set zero if we don't have a value
// for this poll
// add the values for each stat to its bucket, or set zero if we don't have a value
// for this poll
for (const name of Object.keys(this.buckets)) {
if (stats.hasOwnProperty(name)) {
const value = stats[name];
const bucket = this.buckets[name];
let last = bucket.last || 0;
// if we missed any intervals, interpolate the values
// note that we don't emit stats for missed intervals
for (let i = 1; i < missed; i++) {
bucket.collection.add((value - last) * i / missed + last);
}
for (const name of Object.keys(this.buckets)) {
if (stats.hasOwnProperty(name)) {
const value = stats[name];
const bucket = this.buckets[name];
let last = bucket.last || 0; // if we missed any intervals, interpolate the values
// note that we don't emit stats for missed intervals
// add the value and set it as the last value
bucket.collection.add(value);
bucket.last = value;
} else {
// the bucket didn't receive a value so that probably means the collector
// was removed or the bucket is no longer monitored, so remove the bucket
delete this.buckets[name];
}
}
for (let i = 1; i < missed; i++) {
bucket.collection.add((value - last) * i / missed + last);
} // add the value and set it as the last value
// add in the timestamp
stats.ts = process.uptime();
// emit the stats!
this.emit('stats', stats);
}).catch(err => this.emit('error', err));
}
bucket.collection.add(value);
bucket.last = value;
} else {
// the bucket didn't receive a value so that probably means the collector
// was removed or the bucket is no longer monitored, so remove the bucket
delete this.buckets[name];
}
} // add in the timestamp
/**
* Generates a snapshot of the collected data.
*
* @returns {Object}
* @access public
*/
health() {
const result = {};
for (const [name, bucket] of Object.entries(this.buckets)) {
result[name] = bucket.collection.stats;
}
return result;
}
stats.ts = process.uptime(); // emit the stats!
this.emit('stats', stats);
}).catch(err => this.emit('error', err));
}
/**
* Generates a snapshot of the collected data.
*
* @returns {Object}
* @access public
*/
health() {
const result = {};
for (const [name, bucket] of Object.entries(this.buckets)) {
result[name] = bucket.collection.stats;
}
return result;
}
};
exports.default = Agent;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFnZW50LmpzIl0sIm5hbWVzIjpbIkFnZW50IiwiY29uc3RydWN0b3IiLCJvcHRzIiwiVHlwZUVycm9yIiwicG9sbEludGVydmFsIiwiTWF0aCIsIm1heCIsImJ1Y2tldHMiLCJjb2xsZWN0b3JzIiwiZ2V0U3RhdHMiLCJuYW1lIiwiY29sbGVjdGlvbiIsInN0YXRzIiwic3RhcnQiLCJpbml0Q3B1IiwiY3VycmVudENwdSIsInByb2Nlc3MiLCJjcHVVc2FnZSIsImluaXRIcnRpbWUiLCJjdXJyZW50SHJUaW1lIiwiaHJ0aW1lIiwiY2xlYXJUaW1lb3V0IiwicG9sbFRpbWVyIiwicG9sbCIsInN0b3AiLCJhZGRDb2xsZWN0b3IiLCJmbiIsInB1c2giLCJyZW1vdmVDb2xsZWN0b3IiLCJpIiwibGVuZ3RoIiwic3BsaWNlIiwiY3B1IiwibWVtIiwibWVtb3J5VXNhZ2UiLCJ1c2VyIiwic3lzdGVtIiwiZnJlZW1lbSIsImhlYXBUb3RhbCIsImhlYXBVc2VkIiwicnNzIiwiUHJvbWlzZSIsImFsbCIsIm1hcCIsInJlc29sdmUiLCJ0aGVuIiwicmVzdWx0IiwiT2JqZWN0IiwiYXNzaWduIiwibm93IiwiRGF0ZSIsImRlbHRhIiwibGFzdFRpbWVzdGFtcCIsIm5leHQiLCJzZXRUaW1lb3V0IiwiYmluZCIsIm1pc3NlZCIsImZsb29yIiwia2V5cyIsImxhc3QiLCJoYXNPd25Qcm9wZXJ0eSIsInZhbHVlIiwiYnVja2V0IiwiYWRkIiwidHMiLCJ1cHRpbWUiLCJlbWl0IiwiY2F0Y2giLCJlcnIiLCJoZWFsdGgiLCJlbnRyaWVzIl0sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBQUE7Ozs7QUFDQTs7OztBQUVB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
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
exports.default = undefined;
exports.default = void 0;
var _nanobuffer = require('nanobuffer');
var _nanobuffer = _interopRequireDefault(require("nanobuffer"));
var _nanobuffer2 = _interopRequireDefault(_nanobuffer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -18,68 +16,70 @@

let Collection = class Collection {
/**
* Creates the collection instance and initializes the value buffer.
*
* @param {Number} size - The number of values to buffer.
* @access public
*/
constructor(size) {
this.values = new _nanobuffer2.default(size);
this.min = null;
this.max = null;
this.avg = null;
}
/**
* Creates the collection instance and initializes the value buffer.
*
* @param {Number} size - The number of values to buffer.
* @access public
*/
constructor(size) {
this.values = new _nanobuffer.default(size);
this.min = null;
this.max = null;
this.avg = null;
}
/**
* Adds a value to the collection and recomputes the minimum, maximum, and average.
*
* @param {Number} value - The value to add to the collection.
* @returns {Collection}
* @access public
*/
/**
* Adds a value to the collection and recomputes the minimum, maximum, and average.
*
* @param {Number} value - The value to add to the collection.
* @returns {Collection}
* @access public
*/
add(value) {
if (typeof value !== 'number' || isNaN(value)) {
throw TypeError('Expected value to be a number');
}
this.values.push(value);
add(value) {
if (typeof value !== 'number' || isNaN(value)) {
throw TypeError('Expected value to be a number');
}
if (this.values.size === 1) {
this.min = this.max = this.avg = value;
} else {
let total = 0;
this.values.push(value);
for (const counter of this.values) {
total += counter;
if (this.values.size === 1) {
this.min = this.max = this.avg = value;
} else {
let total = 0;
if (counter < this.min) {
this.min = counter;
}
for (const counter of this.values) {
total += counter;
if (counter > this.max) {
this.max = counter;
}
}
if (counter < this.min) {
this.min = counter;
}
this.avg = total / this.values.size;
}
if (counter > this.max) {
this.max = counter;
}
}
return this;
}
this.avg = total / this.values.size;
}
/**
* Returns a snapshot of the contents of this collection.
*
* @returns {Object}
* @access public
*/
get stats() {
return {
values: Array.from(this.values),
min: this.min,
max: this.max,
avg: this.avg
};
}
return this;
}
/**
* Returns a snapshot of the contents of this collection.
*
* @returns {Object}
* @access public
*/
get stats() {
return {
values: Array.from(this.values),
min: this.min,
max: this.max,
avg: this.avg
};
}
};
exports.default = Collection;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbGxlY3Rpb24uanMiXSwibmFtZXMiOlsiQ29sbGVjdGlvbiIsImNvbnN0cnVjdG9yIiwic2l6ZSIsInZhbHVlcyIsIm1pbiIsIm1heCIsImF2ZyIsImFkZCIsInZhbHVlIiwiaXNOYU4iLCJUeXBlRXJyb3IiLCJwdXNoIiwidG90YWwiLCJjb3VudGVyIiwic3RhdHMiLCJBcnJheSIsImZyb20iXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFBQTs7Ozs7O0FBRUE7OztJQUdxQkEsVSxHQUFOLE1BQU1BLFVBQU4sQ0FBaUI7QUFDL0I7Ozs7OztBQU1BQyxhQUFZQyxJQUFaLEVBQWtCO0FBQ2pCLE9BQUtDLE1BQUwsR0FBYyx5QkFBZUQsSUFBZixDQUFkO0FBQ0EsT0FBS0UsR0FBTCxHQUFXLElBQVg7QUFDQSxPQUFLQyxHQUFMLEdBQVcsSUFBWDtBQUNBLE9BQUtDLEdBQUwsR0FBVyxJQUFYO0FBQ0E7O0FBRUQ7Ozs7Ozs7QUFPQUMsS0FBSUMsS0FBSixFQUFXO0FBQ1YsTUFBSSxPQUFPQSxLQUFQLEtBQWlCLFFBQWpCLElBQTZCQyxNQUFNRCxLQUFOLENBQWpDLEVBQStDO0FBQzlDLFNBQU1FLFVBQVUsK0JBQVYsQ0FBTjtBQUNBOztBQUVELE9BQUtQLE1BQUwsQ0FBWVEsSUFBWixDQUFpQkgsS0FBakI7O0FBRUEsTUFBSSxLQUFLTCxNQUFMLENBQVlELElBQVosS0FBcUIsQ0FBekIsRUFBNEI7QUFDM0IsUUFBS0UsR0FBTCxHQUFXLEtBQUtDLEdBQUwsR0FBVyxLQUFLQyxHQUFMLEdBQVdFLEtBQWpDO0FBQ0EsR0FG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XHRpZiAoY291bnRlciA8IHRoaXMubWluKSB7XG5cdFx0XHRcdFx0dGhpcy5taW4gPSBjb3VudGVyO1xuXHRcdFx0XHR9XG5cblx0XHRcdFx0aWYgKGNvdW50ZXIgPiB0aGlzLm1heCkge1xuXHRcdFx0XHRcdHRoaXMubWF4ID0gY291bnRlcjtcblx0XHRcdFx0fVxuXHRcdFx0fVxuXG5cdFx0XHR0aGlzLmF2ZyA9IHRvdGFsIC8gdGhpcy52YWx1ZXMuc2l6ZTtcblx0XHR9XG5cblx0XHRyZXR1cm4gdGhpcztcblx0fVxuXG5cdC8qKlxuXHQgKiBSZXR1cm5zIGEgc25hcHNob3Qgb2YgdGhlIGNvbnRlbnRzIG9mIHRoaXMgY29sbGVjdGlvbi5cblx0ICpcblx0ICogQHJldHVybnMge09iamVjdH1cblx0ICogQGFjY2VzcyBwdWJsaWNcblx0ICovXG5cdGdldCBzdGF0cygpIHtcblx0XHRyZXR1cm4ge1xuXHRcdFx0dmFsdWVzOiBBcnJheS5mcm9tKHRoaXMudmFsdWVzKSxcblx0XHRcdG1pbjogICAgdGhpcy5taW4sXG5cdFx0XHRtYXg6ICAgIHRoaXMubWF4LFxuXHRcdFx0YXZnOiAgICB0aGlzLmF2Z1xuXHRcdH07XG5cdH1cbn1cbiJdfQ==
exports.default = Collection;

@@ -1,16 +0,15 @@

'use strict';
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _agent.default;
}
});
var _agent = require('./agent');
var _agent = _interopRequireDefault(require("./agent"));
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function () {
return _interopRequireDefault(_agent).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -20,4 +19,3 @@

if (!Error.prepareStackTrace) {
require('source-map-support/register');
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbImRlZmF1bHQiLCJFcnJvciIsInByZXBhcmVTdGFja1RyYWNlIiwicmVxdWlyZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7d0NBS1NBLE87Ozs7OztBQUxUO0FBQ0EsSUFBSSxDQUFDQyxNQUFNQyxpQkFBWCxFQUE4QjtBQUM3QkMsU0FBUSw2QkFBUjtBQUNBIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlUm9vdCI6InNyYyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGlzdGFuYnVsIGlnbm9yZSBpZiAqL1xuaWYgKCFFcnJvci5wcmVwYXJlU3RhY2tUcmFjZSkge1xuXHRyZXF1aXJlKCdzb3VyY2UtbWFwLXN1cHBvcnQvcmVnaXN0ZXInKTtcbn1cblxuZXhwb3J0IHsgZGVmYXVsdCB9IGZyb20gJy4vYWdlbnQnO1xuIl19
require('source-map-support/register');
}
{
"name": "appcd-agent",
"version": "1.0.1",
"version": "1.1.0-0",
"description": "Monitors a Node.js process and tracks CPU and memory usage.",

@@ -20,6 +20,6 @@ "main": "./dist/index",

"nanobuffer": "^1.0.0",
"source-map-support": "^0.5.0"
"source-map-support": "^0.5.4"
},
"devDependencies": {
"appcd-gulp": "^1.0.1",
"appcd-gulp": "^1.1.0-0",
"gulp": "^3.9.1"

@@ -26,0 +26,0 @@ },

Sorry, the diff of this file is not supported yet

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