@instana/shared-metrics 4.18.0 → 4.18.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/CHANGELOG.md +11 -0
- package/package.json +3 -3
- package/src/gc.js +29 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.18.1](https://github.com/instana/nodejs/compare/v4.18.0...v4.18.1) (2025-07-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* resolved MaxListenersExceededWarning in gcstats module ([#1845](https://github.com/instana/nodejs/issues/1845)) ([624ca13](https://github.com/instana/nodejs/commit/624ca13ed1ab794881f376d4ffa0bc7d02dc7ee4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [4.18.0](https://github.com/instana/nodejs/compare/v4.17.0...v4.18.0) (2025-07-10)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @instana/shared-metrics
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instana/shared-metrics",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.1",
|
|
4
4
|
"description": "Internal metrics plug-in package for Node.js monitoring with Instana",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Bastian Krol",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"license": "MIT",
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@instana/core": "4.18.
|
|
62
|
+
"@instana/core": "4.18.1",
|
|
63
63
|
"detect-libc": "^2.0.2",
|
|
64
64
|
"event-loop-lag": "^1.4.0",
|
|
65
65
|
"semver": "^7.5.4",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"event-loop-stats": "1.4.1",
|
|
73
73
|
"gcstats.js": "1.0.0"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "7e3c565fd09ac15ab7f281f26f9ae48704da5d7e"
|
|
76
76
|
}
|
package/src/gc.js
CHANGED
|
@@ -21,6 +21,29 @@ let gcStats;
|
|
|
21
21
|
let activateHasBeenCalled = false;
|
|
22
22
|
let hasBeenActivated = false;
|
|
23
23
|
|
|
24
|
+
const statsHandler = (/** @type {*} */ stats) => {
|
|
25
|
+
// gcstats exposes start and end in nanoseconds
|
|
26
|
+
const pause = (stats.end - stats.start) / 1000000;
|
|
27
|
+
gcPauseWindow.addPoint(pause);
|
|
28
|
+
const type = stats.gctype;
|
|
29
|
+
if (type === 1) {
|
|
30
|
+
minorGcWindow.addPoint(1);
|
|
31
|
+
} else if (type === 2) {
|
|
32
|
+
majorGcWindow.addPoint(1);
|
|
33
|
+
} else if (type === 4) {
|
|
34
|
+
incrementalMarkingsWindow.addPoint(1);
|
|
35
|
+
} else if (type === 8) {
|
|
36
|
+
processWeakCallbacksWindow.addPoint(1);
|
|
37
|
+
} else if (type === 15) {
|
|
38
|
+
minorGcWindow.addPoint(1);
|
|
39
|
+
majorGcWindow.addPoint(1);
|
|
40
|
+
incrementalMarkingsWindow.addPoint(1);
|
|
41
|
+
processWeakCallbacksWindow.addPoint(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.currentPayload.usedHeapSizeAfterGc = stats.after.usedHeapSize;
|
|
45
|
+
};
|
|
46
|
+
|
|
24
47
|
exports.payloadPrefix = 'gc';
|
|
25
48
|
|
|
26
49
|
/** @type {{
|
|
@@ -85,27 +108,8 @@ function actuallyActivate() {
|
|
|
85
108
|
return;
|
|
86
109
|
}
|
|
87
110
|
hasBeenActivated = true;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const pause = (stats.end - stats.start) / 1000000;
|
|
91
|
-
gcPauseWindow.addPoint(pause);
|
|
92
|
-
const type = stats.gctype;
|
|
93
|
-
if (type === 1) {
|
|
94
|
-
minorGcWindow.addPoint(1);
|
|
95
|
-
} else if (type === 2) {
|
|
96
|
-
majorGcWindow.addPoint(1);
|
|
97
|
-
} else if (type === 4) {
|
|
98
|
-
incrementalMarkingsWindow.addPoint(1);
|
|
99
|
-
} else if (type === 8) {
|
|
100
|
-
processWeakCallbacksWindow.addPoint(1);
|
|
101
|
-
} else if (type === 15) {
|
|
102
|
-
minorGcWindow.addPoint(1);
|
|
103
|
-
majorGcWindow.addPoint(1);
|
|
104
|
-
incrementalMarkingsWindow.addPoint(1);
|
|
105
|
-
processWeakCallbacksWindow.addPoint(1);
|
|
106
|
-
}
|
|
107
|
-
exports.currentPayload.usedHeapSizeAfterGc = stats.after.usedHeapSize;
|
|
108
|
-
});
|
|
111
|
+
|
|
112
|
+
gcStats.on('stats', statsHandler);
|
|
109
113
|
startSensing();
|
|
110
114
|
}
|
|
111
115
|
|
|
@@ -126,4 +130,8 @@ exports.deactivate = function deactivate() {
|
|
|
126
130
|
}
|
|
127
131
|
activateHasBeenCalled = false;
|
|
128
132
|
hasBeenActivated = false;
|
|
133
|
+
|
|
134
|
+
if (gcStats && typeof gcStats.removeListener === 'function') {
|
|
135
|
+
gcStats.removeListener('stats', statsHandler);
|
|
136
|
+
}
|
|
129
137
|
};
|