@instana/shared-metrics
Advanced tools
Comparing version 1.108.0 to 1.109.0
{ | ||
"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 {}; | ||
} |
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
638599
46
832
8
9
25
+ Addeddetect-libc@^1.0.3
+ Addedrecursive-copy@^2.0.11
+ Addedtar@^6.0.5
+ Addedabbrev@1.1.1(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedansi-regex@2.1.1(transitive)
+ Addedaproba@1.2.0(transitive)
+ Addedare-we-there-yet@1.1.7(transitive)
+ Addedarray-differ@1.0.0(transitive)
+ Addedarray-union@1.0.2(transitive)
+ Addedarray-uniq@1.0.3(transitive)
+ Addedarrify@1.0.1(transitive)
+ Addedasap@2.0.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedchownr@2.0.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconsole-control-strings@1.1.0(transitive)
+ Addedcore-util-is@1.0.21.0.3(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addeddelegates@1.0.0(transitive)
+ Addeddetect-libc@1.0.3(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedenv-paths@2.2.1(transitive)
+ Addederrno@0.1.8(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedfs-minipass@2.1.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedgauge@2.7.4(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhas-unicode@2.0.1(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedjunk@1.0.3(transitive)
+ Addedmaximatch@0.1.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedminipass@3.3.65.0.0(transitive)
+ Addedminizlib@2.1.2(transitive)
+ Addedmkdirp@0.5.61.0.4(transitive)
+ Addednode-gyp@7.1.2(transitive)
+ Addednopt@5.0.0(transitive)
+ Addednpmlog@4.1.2(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedpromise@7.3.1(transitive)
+ Addedprr@1.0.1(transitive)
+ Addedpsl@1.15.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedrecursive-copy@2.0.14(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedrimraf@2.7.13.0.2(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedslash@1.0.0(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedtar@6.2.1(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedwide-align@1.1.5(transitive)
+ Addedwrappy@1.0.2(transitive)
Updated@instana/core@^1.109.0