@instana/shared-metrics 1.117.2 → 1.119.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/src/gc.js +51 -29
- package/src/libuv.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instana/shared-metrics",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.119.1",
|
|
4
4
|
"description": "Internal metrics plug-in package for Node.js monitoring with Instana",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Bastian Krol",
|
|
@@ -55,24 +55,24 @@
|
|
|
55
55
|
},
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@instana/core": "1.
|
|
58
|
+
"@instana/core": "1.119.1",
|
|
59
59
|
"detect-libc": "^1.0.3",
|
|
60
60
|
"event-loop-lag": "^1.4.0",
|
|
61
61
|
"recursive-copy": "^2.0.11",
|
|
62
62
|
"tar": "^5.0.5"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"eslint": "^
|
|
65
|
+
"eslint": "^6.8.0",
|
|
66
66
|
"eslint-config-airbnb-base": "^13.1.0",
|
|
67
|
-
"eslint-plugin-import": "^2.
|
|
68
|
-
"eslint-plugin-mocha": "^
|
|
67
|
+
"eslint-plugin-import": "^2.22.1",
|
|
68
|
+
"eslint-plugin-mocha": "^8.1.0",
|
|
69
69
|
"mocha": "^7.2.0",
|
|
70
|
-
"prettier": "^
|
|
70
|
+
"prettier": "^2.2.1"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
73
|
"event-loop-stats": "1.3.0",
|
|
74
74
|
"gcstats.js": "1.0.0",
|
|
75
|
-
"node-gyp": "^7.1.
|
|
75
|
+
"node-gyp": "^7.1.2"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "2c29209e16d78ff990869e81b0545012b86fc18d"
|
|
78
78
|
}
|
package/src/gc.js
CHANGED
|
@@ -16,6 +16,10 @@ const incrementalMarkingsWindow = slidingWindow.create(windowOpts);
|
|
|
16
16
|
const processWeakCallbacksWindow = slidingWindow.create(windowOpts);
|
|
17
17
|
const gcPauseWindow = slidingWindow.create(windowOpts);
|
|
18
18
|
|
|
19
|
+
let gcStats;
|
|
20
|
+
let activateHasBeenCalled = false;
|
|
21
|
+
let hasBeenActivated = false;
|
|
22
|
+
|
|
19
23
|
exports.payloadPrefix = 'gc';
|
|
20
24
|
exports.currentPayload = {
|
|
21
25
|
minorGcs: 0,
|
|
@@ -25,6 +29,13 @@ exports.currentPayload = {
|
|
|
25
29
|
gcPause: 0
|
|
26
30
|
};
|
|
27
31
|
|
|
32
|
+
exports.activate = function activate() {
|
|
33
|
+
activateHasBeenCalled = true;
|
|
34
|
+
if (gcStats) {
|
|
35
|
+
actuallyActivate();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
28
39
|
const nativeModuleLoader = require('./util/nativeModuleRetry')({
|
|
29
40
|
nativeModuleName: 'gcstats.js',
|
|
30
41
|
moduleRoot: path.join(__dirname, '..'),
|
|
@@ -37,37 +48,46 @@ const nativeModuleLoader = require('./util/nativeModuleRetry')({
|
|
|
37
48
|
|
|
38
49
|
let senseIntervalHandle;
|
|
39
50
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
majorGcWindow.addPoint(1);
|
|
52
|
-
} else if (type === 4) {
|
|
53
|
-
incrementalMarkingsWindow.addPoint(1);
|
|
54
|
-
} else if (type === 8) {
|
|
55
|
-
processWeakCallbacksWindow.addPoint(1);
|
|
56
|
-
} else if (type === 15) {
|
|
57
|
-
minorGcWindow.addPoint(1);
|
|
58
|
-
majorGcWindow.addPoint(1);
|
|
59
|
-
incrementalMarkingsWindow.addPoint(1);
|
|
60
|
-
processWeakCallbacksWindow.addPoint(1);
|
|
61
|
-
}
|
|
62
|
-
exports.currentPayload.usedHeapSizeAfterGc = stats.after.usedHeapSize;
|
|
63
|
-
});
|
|
64
|
-
startSensing();
|
|
65
|
-
});
|
|
51
|
+
nativeModuleLoader.once('loaded', gcStats_ => {
|
|
52
|
+
gcStats = gcStats_;
|
|
53
|
+
exports.currentPayload.statsSupported = true;
|
|
54
|
+
if (activateHasBeenCalled) {
|
|
55
|
+
actuallyActivate();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
nativeModuleLoader.once('failed', () => {
|
|
60
|
+
exports.currentPayload.statsSupported = false;
|
|
61
|
+
});
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
function actuallyActivate() {
|
|
64
|
+
if (hasBeenActivated) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
hasBeenActivated = true;
|
|
68
|
+
gcStats.on('stats', stats => {
|
|
69
|
+
// gcstats exposes start and end in nanoseconds
|
|
70
|
+
const pause = (stats.end - stats.start) / 1000000;
|
|
71
|
+
gcPauseWindow.addPoint(pause);
|
|
72
|
+
const type = stats.gctype;
|
|
73
|
+
if (type === 1) {
|
|
74
|
+
minorGcWindow.addPoint(1);
|
|
75
|
+
} else if (type === 2) {
|
|
76
|
+
majorGcWindow.addPoint(1);
|
|
77
|
+
} else if (type === 4) {
|
|
78
|
+
incrementalMarkingsWindow.addPoint(1);
|
|
79
|
+
} else if (type === 8) {
|
|
80
|
+
processWeakCallbacksWindow.addPoint(1);
|
|
81
|
+
} else if (type === 15) {
|
|
82
|
+
minorGcWindow.addPoint(1);
|
|
83
|
+
majorGcWindow.addPoint(1);
|
|
84
|
+
incrementalMarkingsWindow.addPoint(1);
|
|
85
|
+
processWeakCallbacksWindow.addPoint(1);
|
|
86
|
+
}
|
|
87
|
+
exports.currentPayload.usedHeapSizeAfterGc = stats.after.usedHeapSize;
|
|
69
88
|
});
|
|
70
|
-
|
|
89
|
+
startSensing();
|
|
90
|
+
}
|
|
71
91
|
|
|
72
92
|
function startSensing() {
|
|
73
93
|
senseIntervalHandle = setInterval(() => {
|
|
@@ -84,4 +104,6 @@ exports.deactivate = function deactivate() {
|
|
|
84
104
|
if (senseIntervalHandle) {
|
|
85
105
|
clearInterval(senseIntervalHandle);
|
|
86
106
|
}
|
|
107
|
+
activateHasBeenCalled = false;
|
|
108
|
+
hasBeenActivated = false;
|
|
87
109
|
};
|
package/src/libuv.js
CHANGED
|
@@ -25,11 +25,11 @@ const nativeModuleLoader = require('./util/nativeModuleRetry')({
|
|
|
25
25
|
'https://www.instana.com/docs/ecosystem/node-js/installation/#native-addons'
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
nativeModuleLoader.
|
|
28
|
+
nativeModuleLoader.once('loaded', eventLoopStats_ => {
|
|
29
29
|
eventLoopStats = eventLoopStats_;
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
nativeModuleLoader.
|
|
32
|
+
nativeModuleLoader.once('failed', () => {
|
|
33
33
|
exports.currentPayload.statsSupported = false;
|
|
34
34
|
});
|
|
35
35
|
|