@contrast/agentify 1.18.1 → 1.18.2

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.
Files changed (2) hide show
  1. package/lib/initialize.mjs +32 -21
  2. package/package.json +3 -3
@@ -57,33 +57,42 @@ async function loadModules({ core = {}, options = {} }) {
57
57
  const thread = isMainThread ? 'main' : 'loader';
58
58
  core.logger.trace({ tid: threadId }, 'initializing core modules in %s thread', thread);
59
59
 
60
- // @contrast/info ?
61
- require('@contrast/core/lib/agent-info')(core);
62
- require('@contrast/core/lib/system-info')(core);
63
- require('@contrast/core/lib/app-info')(core);
64
- require('@contrast/core/lib/sensitive-data-masking')(core);
65
- require('@contrast/core/lib/is-agent-path')(core);
66
- require('@contrast/dep-hooks')(core);
60
+ if (isMainThread) {
61
+ // @contrast/info ?
62
+ require('@contrast/core/lib/agent-info')(core);
63
+ require('@contrast/core/lib/system-info')(core);
64
+ require('@contrast/core/lib/app-info')(core);
65
+ require('@contrast/core/lib/sensitive-data-masking')(core);
66
+ require('@contrast/core/lib/is-agent-path')(core);
67
+ require('@contrast/dep-hooks')(core);
68
+ }
69
+
67
70
  const { default: install } = await import('@contrast/esm-hooks');
68
71
  const esmHooks = await install(core);
69
72
  core.esmHooks = esmHooks;
70
- require('@contrast/patcher')(core);
71
- require('@contrast/core/lib/capture-stacktrace')(core);
73
+
74
+ if (isMainThread) {
75
+ require('@contrast/patcher')(core);
76
+ require('@contrast/core/lib/capture-stacktrace')(core);
77
+ }
72
78
 
73
79
  require('@contrast/rewriter')(core); // merge contrast-methods?
74
- require('@contrast/core/lib/contrast-methods')(core); // can we remove dependency on patcher?
75
80
 
76
- require('@contrast/scopes')(core);
77
- require('@contrast/deadzones')(core);
78
- require('@contrast/reporter').default(core);
79
- require('@contrast/instrumentation')(core);
80
- require('@contrast/metrics')(core);
81
+ if (isMainThread) {
82
+ require('@contrast/core/lib/contrast-methods')(core); // can we remove dependency on patcher?
81
83
 
82
- require('./heap-snapshots')(core);
83
- require('./sources')(core);
84
- require('./function-hooks')(core);
85
- require('./log-diagnostic-files')(core); // this doesn't really belong in agentify
86
- require('./rewrite-hooks')(core);
84
+ require('@contrast/scopes')(core);
85
+ require('@contrast/deadzones')(core);
86
+ require('@contrast/reporter').default(core);
87
+ require('@contrast/instrumentation')(core);
88
+ require('@contrast/metrics')(core);
89
+
90
+ require('./heap-snapshots')(core);
91
+ require('./sources')(core);
92
+ require('./function-hooks')(core);
93
+ require('./log-diagnostic-files')(core); // this doesn't really belong in agentify
94
+ require('./rewrite-hooks')(core);
95
+ }
87
96
 
88
97
  } catch (err) {
89
98
  // TODO: Consider proper UNINSTALLATION and normal startup w/o agent
@@ -128,7 +137,9 @@ async function startAgent({ core, options = {} }) {
128
137
  }
129
138
 
130
139
  // should this be moved into a separate install side-effect?
131
- core.logDiagnosticFiles();
140
+ if (isMainThread) {
141
+ core.logDiagnosticFiles();
142
+ }
132
143
 
133
144
  return core;
134
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agentify",
3
- "version": "1.18.1",
3
+ "version": "1.18.2",
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)",
@@ -20,14 +20,14 @@
20
20
  "@contrast/common": "1.16.0",
21
21
  "@contrast/config": "1.23.0",
22
22
  "@contrast/core": "1.27.1",
23
- "@contrast/deadzones": "1.1.1",
23
+ "@contrast/deadzones": "1.1.2",
24
24
  "@contrast/dep-hooks": "^1.3.0",
25
25
  "@contrast/esm-hooks": "2.0.2",
26
26
  "@contrast/instrumentation": "^1.3.0",
27
27
  "@contrast/logger": "1.7.0",
28
28
  "@contrast/metrics": "1.2.0",
29
29
  "@contrast/patcher": "1.7.1",
30
- "@contrast/reporter": "1.22.0",
30
+ "@contrast/reporter": "1.22.1",
31
31
  "@contrast/rewriter": "1.4.2",
32
32
  "@contrast/scopes": "1.4.0"
33
33
  }