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

@instana/shared-metrics

Package Overview
Dependencies
Maintainers
3
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instana/shared-metrics - npm Package Compare versions

Comparing version 1.108.0 to 1.109.0

addons/linux/x64/glibc/48/event-loop-stats.tar.gz

17

package.json
{
"name": "@instana/shared-metrics",
"version": "1.108.0",
"version": "1.109.0",
"description": "Internal metrics plug-in package for Node.js monitoring with Instana",

@@ -12,3 +12,4 @@ "author": {

"files": [
"src"
"src",
"addons/linux"
],

@@ -58,4 +59,7 @@ "publishConfig": {

"dependencies": {
"@instana/core": "^1.108.0",
"event-loop-lag": "^1.4.0"
"@instana/core": "^1.109.0",
"detect-libc": "^1.0.3",
"event-loop-lag": "^1.4.0",
"recursive-copy": "^2.0.11",
"tar": "^6.0.5"
},

@@ -72,5 +76,6 @@ "devDependencies": {

"event-loop-stats": "1.3.0",
"gcstats.js": "1.0.0"
"gcstats.js": "1.0.0",
"node-gyp": "^7.1.0"
},
"gitHead": "7fc0b5e5acc03cbce059778d8b85d4e862b56470"
"gitHead": "dca1dfe7919bb91a3b66d6fbe085c71e952ea3ed"
}
'use strict';
const path = require('path');
const slidingWindow = require('@instana/core').util.slidingWindow;
let logger = require('@instana/core').logger.getLogger('metrics');
exports.setLogger = function setLogger(_logger) {
logger = _logger;
};
const windowOpts = { duration: 1000 };

@@ -23,47 +20,51 @@ const minorGcWindow = slidingWindow.create(windowOpts);

weakCallbackProcessing: 0,
gcPause: 0,
statsSupported: true
gcPause: 0
};
try {
const gcStats = require('gcstats.js');
gcStats.on('stats', stats => {
// gcstats exposes start and end in nanoseconds
const pause = (stats.end - stats.start) / 1000000;
gcPauseWindow.addPoint(pause);
const nativeModuleLoader = require('./util/nativeModuleRetry')({
nativeModuleName: 'gcstats.js',
moduleRoot: path.join(__dirname, '..'),
message:
'Could not load gcstats.js. You will not be able to see GC information in Instana for this application. This ' +
'typically occurs when native addons could not be installed during module installation (npm install). See the ' +
'instructions to learn more about the requirements of the collector: ' +
'https://www.instana.com/docs/ecosystem/node-js/installation/#native-addons'
});
const type = stats.gctype;
if (type === 1) {
minorGcWindow.addPoint(1);
} else if (type === 2) {
majorGcWindow.addPoint(1);
} else if (type === 4) {
incrementalMarkingsWindow.addPoint(1);
} else if (type === 8) {
processWeakCallbacksWindow.addPoint(1);
} else if (type === 15) {
minorGcWindow.addPoint(1);
majorGcWindow.addPoint(1);
incrementalMarkingsWindow.addPoint(1);
processWeakCallbacksWindow.addPoint(1);
}
let senseIntervalHandle;
exports.activate = function activate() {
nativeModuleLoader.on('loaded', gcStats => {
exports.currentPayload.statsSupported = true;
exports.currentPayload.usedHeapSizeAfterGc = stats.after.usedHeapSize;
gcStats.on('stats', stats => {
// gcstats exposes start and end in nanoseconds
const pause = (stats.end - stats.start) / 1000000;
gcPauseWindow.addPoint(pause);
const type = stats.gctype;
if (type === 1) {
minorGcWindow.addPoint(1);
} else if (type === 2) {
majorGcWindow.addPoint(1);
} else if (type === 4) {
incrementalMarkingsWindow.addPoint(1);
} else if (type === 8) {
processWeakCallbacksWindow.addPoint(1);
} else if (type === 15) {
minorGcWindow.addPoint(1);
majorGcWindow.addPoint(1);
incrementalMarkingsWindow.addPoint(1);
processWeakCallbacksWindow.addPoint(1);
}
exports.currentPayload.usedHeapSizeAfterGc = stats.after.usedHeapSize;
});
startSensing();
});
} catch (e) {
exports.currentPayload.statsSupported = false;
logger.info(
'Could not load gcstats.js. You will not be able to see GC information in ' +
'Instana for this application. This typically occurs when native addons could not be ' +
'installed during module installation (npm install). See the instructions to learn more ' +
'about the requirements of the collector: ' +
'https://www.instana.com/docs/ecosystem/node-js/installation/#native-addons'
);
}
let reducingIntervalHandle;
nativeModuleLoader.on('failed', () => {
exports.currentPayload.statsSupported = false;
});
};
exports.activate = function activate() {
reducingIntervalHandle = setInterval(() => {
function startSensing() {
senseIntervalHandle = setInterval(() => {
exports.currentPayload.minorGcs = minorGcWindow.sum();

@@ -75,7 +76,9 @@ exports.currentPayload.majorGcs = majorGcWindow.sum();

}, 1000);
reducingIntervalHandle.unref();
};
senseIntervalHandle.unref();
}
exports.deactivate = function deactivate() {
clearInterval(reducingIntervalHandle);
if (senseIntervalHandle) {
clearInterval(senseIntervalHandle);
}
};

@@ -22,1 +22,7 @@ 'use strict';

];
exports.util = require('./util');
exports.setLogger = function(logger) {
exports.util.setLogger(logger);
};
'use strict';
let logger = require('@instana/core').logger.getLogger('metrics');
exports.setLogger = function setLogger(_logger) {
logger = _logger;
};
const path = require('path');
let eventLoopStats;
try {
eventLoopStats = require('event-loop-stats');
} catch (e) {
logger.info(
'Could not load event-loop-stats. You will only see limited event loop information in ' +
'Instana for this application. This typically occurs when native addons could not be ' +
'installed during module installation (npm install). See the instructions to learn more ' +
'about the requirements of the collector: ' +
'https://www.instana.com/docs/ecosystem/node-js/installation/#native-addons'
);
}
const lag = require('event-loop-lag')(1000);
let eventLoopStats;
exports.payloadPrefix = 'libuv';
exports.currentPayload = {};
const nativeModuleLoader = require('./util/nativeModuleRetry')({
nativeModuleName: 'event-loop-stats',
moduleRoot: path.join(__dirname, '..'),
message:
'Could not load event-loop-stats. You will only see limited event loop information in ' +
'Instana for this application. This typically occurs when native addons could not be ' +
'installed during module installation (npm install). See the instructions to learn more ' +
'about the requirements of the collector: ' +
'https://www.instana.com/docs/ecosystem/node-js/installation/#native-addons'
});
nativeModuleLoader.on('loaded', eventLoopStats_ => {
eventLoopStats = eventLoopStats_;
});
nativeModuleLoader.on('failed', () => {
exports.currentPayload.statsSupported = false;
});
Object.defineProperty(exports, 'currentPayload', {

@@ -39,5 +45,3 @@ get: function() {

}
return {
statsSupported: false
};
return {};
}
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