appdynamics 21.8.0 → 22.3.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.
Files changed (53) hide show
  1. package/README.md +1 -1
  2. package/appdynamics_version.json +2 -2
  3. package/lib/core/agent.js +21 -44
  4. package/lib/core/appDProxy.js +12 -12
  5. package/lib/core/logger.js +27 -79
  6. package/lib/core/opentelemetry-tracer.js +89 -0
  7. package/lib/libagent/libagent-connector.js +5 -47
  8. package/lib/libagent/libagent.js +2 -3
  9. package/lib/libagent/transaction-sender.js +15 -16
  10. package/lib/libagent/transactions/transaction-reporter.js +0 -5
  11. package/lib/{libagent/metrics → metrics}/metric.js +4 -1
  12. package/lib/metrics/metrics-manager.js +4 -3
  13. package/lib/probes/apollo-entry-probe.js +69 -0
  14. package/lib/probes/cluster-probe.js +1 -1
  15. package/lib/probes/couchbase-probe.js +19 -0
  16. package/lib/probes/grpc-exit-probe.js +1 -1
  17. package/lib/probes/http-common.js +97 -0
  18. package/lib/probes/http-entry-probe.js +42 -122
  19. package/lib/probes/http-exit-probe.js +112 -48
  20. package/lib/probes/http-ot-utils.js +117 -0
  21. package/lib/probes/http-probe.js +14 -7
  22. package/lib/probes/http2-entry-probe.js +1 -7
  23. package/lib/probes/http2-exit-probe.js +4 -7
  24. package/lib/probes/ioredis-probe.js +2 -2
  25. package/lib/probes/mongodb-probe.js +200 -113
  26. package/lib/probes/rabbitmq-entry-probe.js +184 -0
  27. package/lib/probes/rabbitmq-exit-probe.js +108 -0
  28. package/lib/probes/rabbitmq-probe.js +76 -0
  29. package/lib/process/process-scanner.js +2 -2
  30. package/lib/profiler/profiler.js +6 -2
  31. package/lib/profiler/time-promise.js +0 -3
  32. package/lib/proxy/protobuf-model.js +0 -264
  33. package/lib/transactions/correlation.js +1 -20
  34. package/lib/transactions/eum.js +2 -34
  35. package/lib/utility.js +20 -1
  36. package/package.json +15 -13
  37. package/packageBck.json +15 -13
  38. package/lib/libproxy/instance-info-sender.js +0 -41
  39. package/lib/libproxy/libproxy.js +0 -204
  40. package/lib/libproxy/metric.js +0 -109
  41. package/lib/libproxy/proxy-launcher.js +0 -308
  42. package/lib/libproxy/proxy-transport.js +0 -634
  43. package/lib/libproxy/transaction-reporter.js +0 -168
  44. package/lib/proxy/backend-config.js +0 -488
  45. package/lib/transactions/analytics-reporter.js +0 -187
  46. package/lib/transactions/config-manager.js +0 -87
  47. package/lib/transactions/correlation-header.js +0 -495
  48. package/lib/transactions/data-collectors.js +0 -95
  49. package/lib/transactions/sep-config.js +0 -66
  50. package/lib/transactions/transaction-naming.js +0 -231
  51. package/lib/transactions/transaction-registry.js +0 -156
  52. package/lib/transactions/transaction-rules.js +0 -173
  53. package/postInstallScript.js +0 -33
@@ -1,187 +0,0 @@
1
- var http = require('http');
2
- var https = require('https');
3
-
4
- var PERIOD = 10 * 1000; // every 10 seconds
5
-
6
- function AnalyticsReporter(agent) {
7
- this.agent = agent;
8
- this.enabled = false;
9
- this.analyticsHost = process.env.APPDYNAMICS_ANALYTICS_HOST_NAME || 'localhost';
10
- this.analyticsPort = parseInt(process.env.APPDYNAMICS_ANALYTICS_PORT, 10) || 9090;
11
- this.analyticsSSL = (process.env.APPDYNAMICS_ANALYTICS_SSL_ENABLED === 'true') || false;
12
- }
13
-
14
- exports.AnalyticsReporter = AnalyticsReporter;
15
-
16
- AnalyticsReporter.prototype.init = function() {
17
- var config = this.agent.opts && this.agent.opts.analytics;
18
- this.analyticsHost = config && config.host || this.analyticsHost;
19
- this.analyticsPort = config && config.port || this.analyticsPort;
20
- this.analyticsSSL = (config && config.ssl) ? config.ssl : this.analyticsSSL;
21
-
22
- this.enabled = false;
23
- this.initialized = false;
24
- this.agent.on('configUpdated', this.configUpdated.bind(this));
25
- this.configUpdated();
26
- };
27
-
28
- AnalyticsReporter.prototype.initNative = function() {
29
- var self = this;
30
- var agentIdentity = this.agent.configManager.getConfig().agentIdentity;
31
- if (agentIdentity) {
32
- this.agent.logger.debug('Initializing Analytics');
33
- this.initialized = true;
34
- this.agent.appdNative.initAnalytics({
35
- 'applicationName': this.agent.opts.applicationName,
36
- 'tierName': this.agent.opts.tierName,
37
- 'nodeName': this.agent.opts.nodeName,
38
- 'applicationId': agentIdentity.appID,
39
- 'tierId': agentIdentity.tierID,
40
- 'nodeId': agentIdentity.nodeID
41
- }, function httpCallback(json) {
42
- var options = {
43
- appdIgnore: true,
44
- host: self.analyticsHost,
45
- port: self.analyticsPort,
46
- path: '/v1/sinks/bt',
47
- method: 'POST',
48
- headers: {
49
- 'Content-Type': 'application/json'
50
- }
51
- };
52
- var client = (self.analyticsSSL) ? https : http;
53
- var req = client.request(options, function (response) {
54
- self.agent.logger.debug('analytics response: '+response.statusCode);
55
- });
56
-
57
- req.on('error', function(err) {
58
- self.agent.logger.warn('analytics reporting error: ' + err.message);
59
- });
60
-
61
- if (self.agent.logger.isDebugEnabled()) {
62
- self.agent.logger.debug('sending analytics events:\n' + json);
63
- }
64
- req.write(json);
65
- req.end();
66
- });
67
- }
68
- };
69
-
70
- AnalyticsReporter.prototype.configUpdated = function() {
71
- this.agent.logger.debug('updating analytics config');
72
- var config = this.agent.configManager.getConfig();
73
- var analyticsConfig = config && config.analyticsConfig || {};
74
-
75
- var wasEnabled = this.enabled;
76
- this.enabled = !!analyticsConfig.isEnabled;
77
- this.enabledBTIDs = analyticsConfig.analyticsBTIDs || [];
78
-
79
- if (this.enabled) {
80
- if (!this.initialized) {
81
- this.initNative();
82
- }
83
-
84
- if (!wasEnabled) {
85
- // changed state from disabled to enabled; install monitors
86
- this.agent.appdNative.enableAnalytics(this.enabled);
87
-
88
- this._transactionHandler = this.addTransaction.bind(this);
89
- this.agent.on('transaction', this._transactionHandler);
90
- this._reportInterval = this.agent.timers.setInterval(
91
- this.reportAnalytics.bind(this), PERIOD);
92
- }
93
- } else if (wasEnabled) {
94
- // changed state from enabled to disabled; remove monitors
95
- this.agent.appdNative.enableAnalytics(this.enabled);
96
-
97
- if (this._transactionHandler) {
98
- this.agent.removeListener('transaction', this._transactionHandler);
99
- }
100
- this.agent.timers.clearInterval(this._reportInterval);
101
- this._transactionHandler = null;
102
- this._reportInterval = null;
103
- }
104
- };
105
-
106
- AnalyticsReporter.prototype.getTimestamp = function() {
107
- return (new Date()).toISOString();
108
- };
109
-
110
- AnalyticsReporter.prototype.addTransaction = function(txn) {
111
- if (!this.enabled) return;
112
- if (txn.ignore) return;
113
- if (!txn.registrationId) return;
114
- if (this.enabledBTIDs.indexOf(''+txn.registrationId) < 0) {
115
- return;
116
- }
117
-
118
- var httpData = txn.httpRequestAnalyticsData;
119
- this.agent.logger.debug('analytics transaction added: ' + txn.name);
120
- this.agent.appdNative.recordTransaction({
121
- "eventTimestamp": this.getTimestamp(),
122
-
123
- "requestGUID": txn.guid,
124
- "transactionId": txn.registrationId,
125
- "transactionName": txn.name,
126
- "transactionTime": txn.ms,
127
- "clientRequestGUID": txn.eumGuid,
128
-
129
- "requestExperience": getUserExperience(txn),
130
- "entryPoint": !txn.corrHeader,
131
-
132
- exitCalls: (txn.exitCalls || []).map(function(call) {
133
- var componentID = call.componentID;
134
- var backendID = call.backendIdentifier &&
135
- call.backendIdentifier.registeredBackend &&
136
- call.backendIdentifier.registeredBackend.backendID;
137
- return {
138
- exitCallType: call.exitType,
139
- avgResponseTimeMillis: call.ms,
140
- numberOfErrors: call.error ? 1 : 0,
141
- numberOfCalls: 1,
142
- toEntityId: componentID || backendID || null,
143
- toEntityType:
144
- componentID && (call.componentIsForeignAppID ? 'APPLICATION' : 'APPLICATION_COMPONENT') ||
145
- backendID && 'BACKEND' || null,
146
- userData: call.userData
147
- };
148
- }),
149
- "httpData": {
150
- "cookies": httpData && httpData.cookies,
151
- "headers": httpData && httpData.headers,
152
- "parameters": httpData && httpData.httpParams,
153
- "url": txn.url,
154
-
155
- // Not supported for Node:
156
- //
157
- // "principal": "No User Principal",
158
- // "sessionId": null,
159
- // "sessionObjects": {},
160
- // "uriPathSegments": {}
161
- },
162
-
163
- "userData": txn.api && txn.api.analyticsData
164
- });
165
- };
166
-
167
- AnalyticsReporter.prototype.reportAnalytics = function() {
168
- if (!this.enabled) return;
169
- this.agent.logger.debug('polling analytics reporter');
170
- this.agent.appdNative.reportTransactions();
171
- };
172
-
173
- AnalyticsReporter.prototype._getUserExperience = getUserExperience; // expose to unit tests
174
- function getUserExperience(txn) {
175
- if (txn.hasErrors) {
176
- return "ERROR";
177
- }
178
- if (txn.btInfoResponse && txn.btInfoResponse.currentVerySlowThreshold > 0 &&
179
- txn.btInfoResponse.currentVerySlowThreshold < txn.ms) {
180
- return "VERY_SLOW";
181
- }
182
- if (txn.btInfoResponse && txn.btInfoResponse.currentSlowThreshold > 0 &&
183
- txn.btInfoResponse.currentSlowThreshold < txn.ms) {
184
- return "SLOW";
185
- }
186
- return "NORMAL";
187
- }
@@ -1,87 +0,0 @@
1
- /*
2
- Copyright (c) AppDynamics, Inc., and its affiliates
3
- 2015
4
- All Rights Reserved
5
- */
6
- 'use strict';
7
-
8
-
9
- function ConfigManager(agent) {
10
- this.agent = agent;
11
- this.config = undefined;
12
- }
13
- exports.ConfigManager = ConfigManager;
14
-
15
-
16
- ConfigManager.prototype.init = function() {
17
- };
18
-
19
- ConfigManager.prototype.getConfigVersion = function() {
20
- var self = this;
21
-
22
- var lastConfigVersion = -1;
23
- if (self.config && self.config.currentVersion) {
24
- lastConfigVersion = parseInt(self.config.currentVersion);
25
- }
26
-
27
- return lastConfigVersion;
28
- };
29
-
30
- function defaultConfig() {
31
- return { timestampSkew: 0 };
32
- }
33
-
34
- ConfigManager.prototype.updateConfig = function(configUpdate) {
35
- var self = this;
36
-
37
- if (!self.config) {
38
- self.config = defaultConfig();
39
- }
40
-
41
- if (configUpdate.command === 'RESET') {
42
- self.config = defaultConfig();
43
- }
44
-
45
- var currentConfigVersion = self.getConfigVersion();
46
-
47
- for (var prop in configUpdate) {
48
- self.config[prop] = configUpdate[prop];
49
- }
50
-
51
- if (self.getConfigVersion() > currentConfigVersion) {
52
- self.agent.emit('configUpdated');
53
- }
54
- };
55
-
56
- ConfigManager.prototype.getConfig = function() {
57
- return this.config;
58
- };
59
-
60
- ConfigManager.prototype.getConfigValue = function(path) {
61
- var self = this;
62
-
63
- var keys = path.split('.');
64
-
65
- var obj = self.config;
66
-
67
- for (var i = 0; i < keys.length; i++) {
68
- if (typeof(obj) !== 'object')
69
- return undefined;
70
- obj = obj[keys[i]];
71
- }
72
- return obj;
73
- };
74
-
75
- ConfigManager.prototype.convertListToMap = function(props) {
76
- var propsMap = {};
77
-
78
- if(!props) {
79
- return propsMap;
80
- }
81
-
82
- props.forEach(function(prop) {
83
- propsMap[prop.name] = prop.value.toString();
84
- });
85
-
86
- return propsMap;
87
- };