appdynamics 24.8.2 → 24.9.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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "24.8.2.0",
3
- "sha": "f39e215bb5e0f25f2de0bf45f602264eb0ed9f9b",
2
+ "version": "24.9.0.0",
3
+ "sha": "",
4
4
  "nodeVersion": "",
5
- "buildName": "10147",
5
+ "buildName": "10247",
6
6
  "compatibilityVersion": "4.4.1.0"
7
7
  }
package/lib/core/agent.js CHANGED
@@ -184,10 +184,35 @@ Agent.prototype.setKubernetesConfig = function() {
184
184
  }
185
185
  };
186
186
 
187
+ Agent.prototype.isMainThread = function () {
188
+ const { isMainThread } = require('worker_threads');
189
+ return isMainThread;
190
+ };
191
+
192
+ function setMetadataFile(instrumentedStatus) {
193
+ const filePath = process.env.APPDYNAMICS_AGENT_DIR || '/tmp/appd';
194
+ const fileName = path.join(filePath, 'app-metadata.json');
195
+
196
+ try {
197
+ fs.accessSync(filePath, fs.constants.W_OK);
198
+ const content = JSON.stringify({ instrumented: instrumentedStatus });
199
+ fs.writeFileSync(fileName, content);
200
+ } catch (err) {
201
+ this.agent.logger.error(
202
+ `Unable to write the file app-metadata.json to path ${filePath} \n`,
203
+ err
204
+ );
205
+ }
206
+ }
207
+
187
208
  /* istanbul ignore next -- requires too much stubbing and mocking to unit test */
188
209
  Agent.prototype.init = function (opts) {
189
210
  var self = this;
190
211
 
212
+ if(!self.isMainThread()) {
213
+ return;
214
+ }
215
+
191
216
  try {
192
217
  if (self.initialized)
193
218
  return;
@@ -214,6 +239,9 @@ Agent.prototype.init = function (opts) {
214
239
  self.tracer = self.TracerProvider.getTracer('appdynamics-tracer');
215
240
  }
216
241
 
242
+
243
+ self.libagentConnector.subscribeToIsEnabled((isEnabled) => setMetadataFile(isEnabled));
244
+
217
245
  self.precompiled = opts.precompiled === undefined || opts.precompiled;
218
246
 
219
247
  if (self.opts.excludeAgentFromCallGraph === undefined) {
@@ -261,15 +289,6 @@ Agent.prototype.init = function (opts) {
261
289
  const filePath = path.join(require.resolve('appdynamics'), '..');
262
290
  process.env.APPDYNAMICS_AGENT_DIR = filePath;
263
291
 
264
- try {
265
- fs.accessSync(filePath, fs.constants.W_OK);
266
- const fileName = `${filePath}/app-metadata.json`;
267
- const content = JSON.stringify({ "nodeName": nodeName });
268
- fs.writeFileSync(fileName, content);
269
- } catch (err) {
270
- self.logger.error(`unable to write the file app-metadata.json file to path ${filePath} \n`, err);
271
- }
272
-
273
292
  self.tmpDir = Agent.computeTmpDir(self.rootTmpDir,
274
293
  self.opts.controllerHostName,
275
294
  self.opts.controllerPort,
@@ -321,7 +340,7 @@ Agent.prototype.init = function (opts) {
321
340
  self.cpuProfiler.init();
322
341
  self.heapProfiler.init();
323
342
 
324
- if(self.opts.secureAppEnabled) {
343
+ if(self.opts.secureAppEnabled || process.env.APPDYNAMICS_SECURE_APP_ENABLED) {
325
344
  self.secureApp.init(this);
326
345
  }
327
346
 
@@ -98,6 +98,18 @@ LibagentConnector.prototype.initLogger = function () {
98
98
  self.libagent = new LibAgent(self.agent);
99
99
  };
100
100
 
101
+ LibagentConnector.prototype.setIsEnabled = function (value) {
102
+ if (this.isEnabled !== value) {
103
+ this.isEnabled = value;
104
+ this.emit('isEnabledChanged', value);
105
+ }
106
+ };
107
+
108
+
109
+ LibagentConnector.prototype.getIsEnabled = function () {
110
+ return this.isEnabled;
111
+ };
112
+
101
113
  LibagentConnector.prototype.init = function () {
102
114
  var self = this;
103
115
  // initialize protobuf
@@ -132,13 +144,16 @@ LibagentConnector.prototype.init = function () {
132
144
  function () {
133
145
  // exception handler: libagent needs no teardown
134
146
  });
147
+
135
148
  self.libagent.delegate.on('initialConfigUpdateDone', function () {
136
- self.isEnabled = true; // should be API call
149
+ self.setIsEnabled(true);
137
150
  self.initializeTimers();
138
151
  });
152
+
139
153
  self.libagent.delegate.on('agentDisabled', function () {
140
- self.isEnabled = false;
154
+ self.setIsEnabled(false);
141
155
  });
156
+
142
157
  self.libagent.delegate.on('agentReset', function () {
143
158
  self.agent.metricsManager.init();
144
159
  self.agent.processStats.init();
@@ -641,3 +656,7 @@ LibagentConnector.prototype.getContainerId = function () {
641
656
  var self = this;
642
657
  return self.libagent.getContainerId();
643
658
  };
659
+
660
+ LibagentConnector.prototype.subscribeToIsEnabled = function (callback) {
661
+ this.on('isEnabledChanged', callback);
662
+ };
@@ -21,6 +21,14 @@ function SecureApp() {
21
21
 
22
22
  SecureApp.prototype.init = function(agent) {
23
23
  var self = this;
24
+
25
+ if(agent.opts.certificateFile) {
26
+ try {
27
+ self.certificateFile = require('fs').readFileSync(agent.opts.certificateFile);
28
+ } catch (e) {
29
+ self.agent.logger.WARN('Secure App could not read certificate file');
30
+ }
31
+ }
24
32
  self.agent = agent;
25
33
  self.libraryMetadata = new LibraryMetadata(agent);
26
34
  if(!process.env.SKIP_AUTH_FOR_TESTS) {
@@ -115,8 +123,8 @@ SecureApp.prototype._requestOptions = function(path, length, type) {
115
123
  'Content-Type': type
116
124
  };
117
125
 
118
- if (self.agent.opts.certificateFile) {
119
- requestOptions['ca'] = self.agent.opts.certificateFile;
126
+ if (self.certificateFile) {
127
+ requestOptions['ca'] = self.certificateFile;
120
128
  }
121
129
 
122
130
  if(process.env.CONTROLLER_HOST_TEST) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appdynamics",
3
- "version": "24.8.2",
3
+ "version": "24.9.0",
4
4
  "description": "Performance Profiler and Monitor",
5
5
  "author": "AppDynamics, Inc.",
6
6
  "homepage": "https://www.appdynamics.com",
@@ -46,20 +46,20 @@
46
46
  "@opentelemetry/sdk-trace-base": "~1.10.1",
47
47
  "@opentelemetry/semantic-conventions": "~1.10.1",
48
48
  "@yarnpkg/lockfile": "^1.1.0",
49
- "body-parser": "^1.20.2",
49
+ "body-parser": "^1.20.3",
50
50
  "cls-hooked": "4.2.2",
51
51
  "https-proxy-agent": "^5.0.1",
52
52
  "uuid": "^8.3.2",
53
53
  "y18n": "^5.0.8",
54
- "appdynamics-libagent-napi": "https://cdn.appdynamics.com/packages/nodejs/24.8.2.0/appdynamics-libagent-napi-node.tgz",
55
- "appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.8.2.0/appdynamics-native-node.tgz",
56
- "appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.8.2.0/appdynamics-protobuf-node.tgz"
54
+ "appdynamics-libagent-napi": "https://cdn.appdynamics.com/packages/nodejs/24.9.0.0/appdynamics-libagent-napi-node.tgz",
55
+ "appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.9.0.0/appdynamics-native-node.tgz",
56
+ "appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.9.0.0/appdynamics-protobuf-node.tgz"
57
57
  },
58
58
  "overrides": {
59
59
  "semver": "7.5.4"
60
60
  },
61
61
  "engines": {
62
- "node": ">=12 <=v21.*"
62
+ "node": ">=12 <=v22.*"
63
63
  },
64
64
  "engine-strict": true
65
65
  }
package/packageBck.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appdynamics",
3
- "version": "24.8.2",
3
+ "version": "24.9.0",
4
4
  "description": "Performance Profiler and Monitor",
5
5
  "author": "AppDynamics, Inc.",
6
6
  "homepage": "https://www.appdynamics.com",
@@ -46,20 +46,20 @@
46
46
  "@opentelemetry/sdk-trace-base": "~1.10.1",
47
47
  "@opentelemetry/semantic-conventions": "~1.10.1",
48
48
  "@yarnpkg/lockfile": "^1.1.0",
49
- "body-parser": "^1.20.2",
49
+ "body-parser": "^1.20.3",
50
50
  "cls-hooked": "4.2.2",
51
51
  "https-proxy-agent": "^5.0.1",
52
52
  "uuid": "^8.3.2",
53
53
  "y18n": "^5.0.8",
54
- "appdynamics-libagent-napi": "https://cdn.appdynamics.com/packages/nodejs/24.8.2.0/appdynamics-libagent-napi-node.tgz",
55
- "appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.8.2.0/appdynamics-native-node.tgz",
56
- "appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.8.2.0/appdynamics-protobuf-node.tgz"
54
+ "appdynamics-libagent-napi": "https://cdn.appdynamics.com/packages/nodejs/24.9.0.0/appdynamics-libagent-napi-node.tgz",
55
+ "appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.9.0.0/appdynamics-native-node.tgz",
56
+ "appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.9.0.0/appdynamics-protobuf-node.tgz"
57
57
  },
58
58
  "overrides": {
59
59
  "semver": "7.5.4"
60
60
  },
61
61
  "engines": {
62
- "node": ">=12 <=v21.*"
62
+ "node": ">=12 <=v22.*"
63
63
  },
64
64
  "engine-strict": true
65
65
  }