@contrast/agentify 1.37.0 → 1.39.0
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/lib/index.js +14 -1
- package/lib/sources.test.js +2 -1
- package/package.json +15 -15
package/lib/index.js
CHANGED
|
@@ -62,6 +62,18 @@ const DEFAULT_INSTALL_ORDER = [
|
|
|
62
62
|
* @returns {import('.').Agentify}
|
|
63
63
|
*/
|
|
64
64
|
module.exports = function init(core = {}) {
|
|
65
|
+
// used for data that needs to be transferred to threads. originally added
|
|
66
|
+
// for the file descriptor so the main and esm thread logger instances can
|
|
67
|
+
// share the same FD. over time, other module-specific data that needs to
|
|
68
|
+
// be transferred can be added. the idea is that this data will be added
|
|
69
|
+
// automatically when the esm-loader thread is started (and possibly when
|
|
70
|
+
// other worker threads are started if we instrument them in the future).
|
|
71
|
+
//
|
|
72
|
+
// threadTransferData is added here because some integration tests don't
|
|
73
|
+
// instantiate the agent normally.
|
|
74
|
+
if (!core.threadTransferData) {
|
|
75
|
+
core.threadTransferData = Object.create(null);
|
|
76
|
+
}
|
|
65
77
|
core.startTime = process.hrtime.bigint();
|
|
66
78
|
if (!core.Perf) {
|
|
67
79
|
core.Perf = require('@contrast/perf');
|
|
@@ -136,7 +148,7 @@ module.exports = function init(core = {}) {
|
|
|
136
148
|
console.error(err);
|
|
137
149
|
console.error(ERROR_MESSAGE);
|
|
138
150
|
|
|
139
|
-
|
|
151
|
+
// TODO: Consider proper UNINSTALLATION and normal startup w/o agent
|
|
140
152
|
logger.error({ err }, ERROR_MESSAGE);
|
|
141
153
|
}
|
|
142
154
|
}
|
|
@@ -204,6 +216,7 @@ module.exports = function init(core = {}) {
|
|
|
204
216
|
if (isDefault) {
|
|
205
217
|
mod = mod.default;
|
|
206
218
|
}
|
|
219
|
+
|
|
207
220
|
_perf.wrapInit(mod, spec)(core);
|
|
208
221
|
|
|
209
222
|
// perform any validations that can take place now that this module is loaded.
|
package/lib/sources.test.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const EventEmitter = require('events');
|
|
4
4
|
const { expect } = require('chai');
|
|
5
|
+
const sinon = require('sinon');
|
|
5
6
|
const { initProtectFixture } = require('@contrast/test/fixtures');
|
|
6
7
|
|
|
7
8
|
describe('agentify sources', function () {
|
|
@@ -83,7 +84,7 @@ describe('agentify sources', function () {
|
|
|
83
84
|
};
|
|
84
85
|
resMock = new EventEmitter();
|
|
85
86
|
|
|
86
|
-
core.depHooks.resolve.withArgs({ name: 'http' }).yields(api);
|
|
87
|
+
core.depHooks.resolve.withArgs(sinon.match({ name: 'http' })).yields(api);
|
|
87
88
|
require('./sources')(core).install();
|
|
88
89
|
});
|
|
89
90
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agentify",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.39.0",
|
|
4
4
|
"description": "Configures Contrast agent services and instrumentation within an application",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -17,21 +17,21 @@
|
|
|
17
17
|
"test": "../scripts/test.sh"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@contrast/common": "1.
|
|
21
|
-
"@contrast/config": "1.
|
|
22
|
-
"@contrast/core": "1.
|
|
23
|
-
"@contrast/deadzones": "1.
|
|
24
|
-
"@contrast/dep-hooks": "1.
|
|
25
|
-
"@contrast/esm-hooks": "2.
|
|
20
|
+
"@contrast/common": "1.27.0",
|
|
21
|
+
"@contrast/config": "1.37.0",
|
|
22
|
+
"@contrast/core": "1.42.0",
|
|
23
|
+
"@contrast/deadzones": "1.14.0",
|
|
24
|
+
"@contrast/dep-hooks": "1.11.0",
|
|
25
|
+
"@contrast/esm-hooks": "2.16.0",
|
|
26
26
|
"@contrast/find-package-json": "^1.1.0",
|
|
27
|
-
"@contrast/instrumentation": "1.
|
|
28
|
-
"@contrast/logger": "1.
|
|
29
|
-
"@contrast/metrics": "1.
|
|
30
|
-
"@contrast/patcher": "1.
|
|
31
|
-
"@contrast/perf": "1.2.
|
|
32
|
-
"@contrast/reporter": "1.
|
|
33
|
-
"@contrast/rewriter": "1.
|
|
34
|
-
"@contrast/scopes": "1.
|
|
27
|
+
"@contrast/instrumentation": "1.21.0",
|
|
28
|
+
"@contrast/logger": "1.15.0",
|
|
29
|
+
"@contrast/metrics": "1.19.0",
|
|
30
|
+
"@contrast/patcher": "1.14.0",
|
|
31
|
+
"@contrast/perf": "1.2.2",
|
|
32
|
+
"@contrast/reporter": "1.38.0",
|
|
33
|
+
"@contrast/rewriter": "1.18.0",
|
|
34
|
+
"@contrast/scopes": "1.12.0",
|
|
35
35
|
"semver": "^7.6.0"
|
|
36
36
|
}
|
|
37
37
|
}
|