appdynamics 24.9.0 → 24.10.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/appdynamics_version.json
CHANGED
package/lib/core/agent.js
CHANGED
|
@@ -189,7 +189,7 @@ Agent.prototype.isMainThread = function () {
|
|
|
189
189
|
return isMainThread;
|
|
190
190
|
};
|
|
191
191
|
|
|
192
|
-
function setMetadataFile(instrumentedStatus) {
|
|
192
|
+
function setMetadataFile(agent, instrumentedStatus) {
|
|
193
193
|
const filePath = process.env.APPDYNAMICS_AGENT_DIR || '/tmp/appd';
|
|
194
194
|
const fileName = path.join(filePath, 'app-metadata.json');
|
|
195
195
|
|
|
@@ -198,7 +198,7 @@ function setMetadataFile(instrumentedStatus) {
|
|
|
198
198
|
const content = JSON.stringify({ instrumented: instrumentedStatus });
|
|
199
199
|
fs.writeFileSync(fileName, content);
|
|
200
200
|
} catch (err) {
|
|
201
|
-
|
|
201
|
+
agent.logger.error(
|
|
202
202
|
`Unable to write the file app-metadata.json to path ${filePath} \n`,
|
|
203
203
|
err
|
|
204
204
|
);
|
|
@@ -240,7 +240,7 @@ Agent.prototype.init = function (opts) {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
|
|
243
|
-
self.libagentConnector.subscribeToIsEnabled((isEnabled) => setMetadataFile(isEnabled));
|
|
243
|
+
self.libagentConnector.subscribeToIsEnabled((isEnabled) => setMetadataFile(self, isEnabled));
|
|
244
244
|
|
|
245
245
|
self.precompiled = opts.precompiled === undefined || opts.precompiled;
|
|
246
246
|
|
|
@@ -731,3 +731,7 @@ var AppDynamics = function () {
|
|
|
731
731
|
AppDynamics.Agent = Agent;
|
|
732
732
|
|
|
733
733
|
exports = module.exports = new AppDynamics();
|
|
734
|
+
|
|
735
|
+
// export for testing
|
|
736
|
+
exports._setMetadataFile = setMetadataFile;
|
|
737
|
+
|
|
@@ -6,7 +6,7 @@ const { BatchSpanProcessor, BasicTracerProvider } = require('@opentelemetry/sdk-
|
|
|
6
6
|
const { OTLPTraceExporter } = require("@opentelemetry/exporter-trace-otlp-proto");
|
|
7
7
|
const { AsyncHooksContextManager, AsyncLocalStorageContextManager } = require("@opentelemetry/context-async-hooks");
|
|
8
8
|
const { ParentBasedSampler, AlwaysOnSampler, TraceIdRatioBasedSampler } = require("@opentelemetry/core");
|
|
9
|
-
const { Resource } = require('@opentelemetry/resources');
|
|
9
|
+
const { Resource, envDetectorSync, processDetectorSync, hostDetectorSync } = require('@opentelemetry/resources');
|
|
10
10
|
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
|
11
11
|
const AppdynamicsSpanExporter = require('./appdynamics_span_exporter').AppdynamicsSpanExporter;
|
|
12
12
|
const url = require('url');
|
|
@@ -33,15 +33,26 @@ function getSamplerFromConfig(config) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
TracerProvider.prototype.register = function(config) {
|
|
36
|
+
const envResource = envDetectorSync.detect();
|
|
37
|
+
const processResource = processDetectorSync.detect();
|
|
38
|
+
const hostResource = hostDetectorSync.detect();
|
|
39
|
+
|
|
40
|
+
const configResourceAttributes = {
|
|
41
|
+
[SemanticResourceAttributes.SERVICE_NAME]: config.tierName,
|
|
42
|
+
[SemanticResourceAttributes.SERVICE_NAMESPACE]: config.applicationName,
|
|
43
|
+
[SemanticResourceAttributes.CONTAINER_ID]: ""
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const mergedResource = new Resource(configResourceAttributes)
|
|
47
|
+
.merge(envResource)
|
|
48
|
+
.merge(processResource)
|
|
49
|
+
.merge(hostResource);
|
|
50
|
+
|
|
36
51
|
const provider = new BasicTracerProvider({
|
|
37
52
|
sampler: new ParentBasedSampler({
|
|
38
53
|
root: getSamplerFromConfig(config.openTelemetry)
|
|
39
54
|
}),
|
|
40
|
-
resource:
|
|
41
|
-
[SemanticResourceAttributes.SERVICE_NAME]: config.tierName,
|
|
42
|
-
[SemanticResourceAttributes.SERVICE_NAMESPACE]: config.applicationName,
|
|
43
|
-
[SemanticResourceAttributes.CONTAINER_ID]: ""
|
|
44
|
-
}),
|
|
55
|
+
resource: mergedResource,
|
|
45
56
|
});
|
|
46
57
|
|
|
47
58
|
// default collector configuration, can be overridden from agent config
|
|
@@ -22,7 +22,22 @@ ApolloEntryProbe.prototype.attach = function (obj, moduleName) {
|
|
|
22
22
|
"createServerInfo",
|
|
23
23
|
(args) => this.addLifeCycleHooks(args)
|
|
24
24
|
);
|
|
25
|
-
} else {
|
|
25
|
+
} else if (moduleName === '@apollo/server') {
|
|
26
|
+
|
|
27
|
+
const originalObject = obj;
|
|
28
|
+
const overriddenObject = {};
|
|
29
|
+
|
|
30
|
+
overriddenObject.ApolloServer = proxyApolloServer(self, originalObject);
|
|
31
|
+
return overriddenObject;
|
|
32
|
+
|
|
33
|
+
} else if(moduleName === '@apollo/server/express4') {
|
|
34
|
+
const originalObject = obj;
|
|
35
|
+
const overriddenObject = {};
|
|
36
|
+
|
|
37
|
+
overriddenObject.expressMiddleware = proxyExpressMiddleware(self, originalObject);
|
|
38
|
+
overriddenObject.__proto__ = originalObject;
|
|
39
|
+
return overriddenObject;
|
|
40
|
+
} else if(moduleName === '@apollo/server/standalone'){
|
|
26
41
|
const originalObject = obj;
|
|
27
42
|
const overriddenObject = {};
|
|
28
43
|
|
|
@@ -80,48 +95,87 @@ ApolloEntryProbe.prototype.addLifeCycleHooks = function (obj) {
|
|
|
80
95
|
];
|
|
81
96
|
};
|
|
82
97
|
|
|
83
|
-
function
|
|
98
|
+
function appDynamicsApolloServerPlugin(self) {
|
|
99
|
+
const plugin = {
|
|
100
|
+
async requestDidStart() {
|
|
101
|
+
return {
|
|
102
|
+
didResolveOperation(requestContext) {
|
|
103
|
+
if(!requestContext.contextValue.gqlReq) {
|
|
104
|
+
requestContext.contextValue.gqlReq = {};
|
|
105
|
+
requestContext.contextValue.gqlRes = {};
|
|
106
|
+
}
|
|
107
|
+
requestContext.contextValue.gqlReq.graphqlop = requestContext.operationName;
|
|
108
|
+
requestContext.contextValue.gqlReq.transactionStarted = true;
|
|
109
|
+
|
|
110
|
+
HttpCommon.startTransactionHandler(
|
|
111
|
+
requestContext.contextValue.gqlReq,
|
|
112
|
+
requestContext.contextValue.gqlRes,
|
|
113
|
+
self.agent
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
didEncounterErrors(requestContext) {
|
|
117
|
+
if(!requestContext.contextValue.gqlReq) {
|
|
118
|
+
requestContext.contextValue.gqlReq = {};
|
|
119
|
+
requestContext.contextValue.gqlRes = {};
|
|
120
|
+
}
|
|
121
|
+
requestContext.contextValue.gqlRes.error = requestContext.errors[0];
|
|
122
|
+
if(requestContext.contextValue.gqlReq.transactionStarted) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
HttpCommon.startTransactionHandler(
|
|
126
|
+
requestContext.contextValue.gqlReq,
|
|
127
|
+
requestContext.contextValue.gqlRes,
|
|
128
|
+
self.agent
|
|
129
|
+
);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
return plugin;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function appDymanicsApolloServerOverriddenOptions(options) {
|
|
138
|
+
const overriddenOptions = options || {};
|
|
139
|
+
|
|
140
|
+
const context = options ? options.context : undefined;
|
|
141
|
+
const overriddenContext = async function (contextParam) {
|
|
142
|
+
const contextValue = context ? await context(contextParam) : {};
|
|
143
|
+
contextParam.req.url = contextParam.req.baseUrl; // For Apollo Server 4
|
|
144
|
+
contextValue.gqlReq = contextParam.req;
|
|
145
|
+
contextValue.gqlRes = contextParam.res;
|
|
146
|
+
return contextValue;
|
|
147
|
+
};
|
|
148
|
+
overriddenOptions.context = overriddenContext;
|
|
149
|
+
return overriddenOptions;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function proxyApolloServer(self, originalObject) {
|
|
153
|
+
const ApolloServer = originalObject.ApolloServer;
|
|
84
154
|
|
|
155
|
+
// Define ApolloServerProxy class
|
|
156
|
+
class ApolloServerProxy extends ApolloServer {
|
|
157
|
+
constructor(config) {
|
|
158
|
+
// Call the ApolloServer constructor
|
|
159
|
+
super(config);
|
|
160
|
+
|
|
161
|
+
// Add the plugin to the plugins array
|
|
162
|
+
this.addPlugin(appDynamicsApolloServerPlugin(self));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return ApolloServerProxy;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function proxyStartStandaloneServer(self, originalObject) {
|
|
85
170
|
return async function startStandaloneServerProxy(server, options) {
|
|
86
|
-
const overriddenOptions = options
|
|
87
|
-
|
|
88
|
-
const context = options ? options.context : undefined;
|
|
89
|
-
const overriddenContext = async function (contextParam) {
|
|
90
|
-
const contextValue = context ? await context(contextParam) : {};
|
|
91
|
-
contextValue.gqlReq = contextParam.req;
|
|
92
|
-
contextValue.gqlRes = contextParam.res;
|
|
93
|
-
return contextValue;
|
|
94
|
-
};
|
|
95
|
-
overriddenOptions.context = overriddenContext;
|
|
96
|
-
|
|
97
|
-
const plugin = {
|
|
98
|
-
async requestDidStart() {
|
|
99
|
-
return {
|
|
100
|
-
didResolveOperation(requestContext) {
|
|
101
|
-
requestContext.contextValue.gqlReq.graphqlop = requestContext.operationName;
|
|
102
|
-
requestContext.contextValue.gqlReq.transactionStarted = true;
|
|
103
|
-
|
|
104
|
-
HttpCommon.startTransactionHandler(
|
|
105
|
-
requestContext.contextValue.gqlReq,
|
|
106
|
-
requestContext.contextValue.gqlRes,
|
|
107
|
-
self.agent
|
|
108
|
-
);
|
|
109
|
-
},
|
|
110
|
-
didEncounterErrors(requestContext) {
|
|
111
|
-
requestContext.contextValue.gqlRes.error = requestContext.errors[0];
|
|
112
|
-
if(requestContext.contextValue.gqlReq.transactionStarted) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
HttpCommon.startTransactionHandler(
|
|
116
|
-
requestContext.contextValue.gqlReq,
|
|
117
|
-
requestContext.contextValue.gqlRes,
|
|
118
|
-
self.agent
|
|
119
|
-
);
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
server.addPlugin(plugin);
|
|
171
|
+
const overriddenOptions = appDymanicsApolloServerOverriddenOptions(options);
|
|
125
172
|
return await originalObject.startStandaloneServer(server, overriddenOptions);
|
|
126
173
|
};
|
|
127
174
|
}
|
|
175
|
+
|
|
176
|
+
function proxyExpressMiddleware(self, originalObject) {
|
|
177
|
+
return function expressMiddlewareProxy(server, options) {
|
|
178
|
+
const overriddenOptions = appDymanicsApolloServerOverriddenOptions(options);
|
|
179
|
+
return originalObject.expressMiddleware(server, overriddenOptions);
|
|
180
|
+
};
|
|
181
|
+
}
|
package/lib/probes/http-probe.js
CHANGED
|
@@ -9,7 +9,7 @@ var HttpEntryProbe = require('./http-entry-probe').HttpEntryProbe;
|
|
|
9
9
|
var HttpExitProbe = require('./http-exit-probe').HttpExitProbe;
|
|
10
10
|
var ApolloEntryProbe = require('./apollo-entry-probe').ApolloEntryProbe;
|
|
11
11
|
|
|
12
|
-
const apolloPackages = ['apollo-server', '@apollo/server/standalone'];
|
|
12
|
+
const apolloPackages = ['apollo-server', '@apollo/server/standalone', '@apollo/server/express4', '@apollo/server'];
|
|
13
13
|
|
|
14
14
|
function HttpProbe(agent) {
|
|
15
15
|
this.agent = agent;
|
|
@@ -58,9 +58,21 @@ HttpProbe.prototype.attach = function (obj, moduleName) {
|
|
|
58
58
|
}
|
|
59
59
|
} else if (moduleName === '@apollo/server/standalone') {
|
|
60
60
|
if(self.agent.opts.enableGraphQL) {
|
|
61
|
+
obj.__appdynamicsProbeAttached__ = false;
|
|
61
62
|
return this.apolloEntryProbe.attach(obj, moduleName);
|
|
62
63
|
}
|
|
63
|
-
} else if
|
|
64
|
+
} else if(moduleName === '@apollo/server/express4') {
|
|
65
|
+
if(self.agent.opts.enableGraphQL) {
|
|
66
|
+
obj.__appdynamicsProbeAttached__ = false;
|
|
67
|
+
return this.apolloEntryProbe.attach(obj, moduleName);
|
|
68
|
+
}
|
|
69
|
+
} else if(moduleName === '@apollo/server') {
|
|
70
|
+
if(self.agent.opts.enableGraphQL) {
|
|
71
|
+
obj.__appdynamicsProbeAttached__ = false;
|
|
72
|
+
return this.apolloEntryProbe.attach(obj, moduleName);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else if (moduleName.includes('graphql-http')) {
|
|
64
76
|
if(self.agent.opts.enableGraphQL) {
|
|
65
77
|
this.entryProbe.enableGraphQLHttp(obj);
|
|
66
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appdynamics",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.10.0",
|
|
4
4
|
"description": "Performance Profiler and Monitor",
|
|
5
5
|
"author": "AppDynamics, Inc.",
|
|
6
6
|
"homepage": "https://www.appdynamics.com",
|
|
@@ -51,9 +51,9 @@
|
|
|
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.
|
|
55
|
-
"appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.
|
|
56
|
-
"appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.
|
|
54
|
+
"appdynamics-libagent-napi": "https://cdn.appdynamics.com/packages/nodejs/24.10.0.0/appdynamics-libagent-napi-node.tgz",
|
|
55
|
+
"appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.10.0.0/appdynamics-native-node.tgz",
|
|
56
|
+
"appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.10.0.0/appdynamics-protobuf-node.tgz"
|
|
57
57
|
},
|
|
58
58
|
"overrides": {
|
|
59
59
|
"semver": "7.5.4"
|
package/packageBck.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appdynamics",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.10.0",
|
|
4
4
|
"description": "Performance Profiler and Monitor",
|
|
5
5
|
"author": "AppDynamics, Inc.",
|
|
6
6
|
"homepage": "https://www.appdynamics.com",
|
|
@@ -51,9 +51,9 @@
|
|
|
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.
|
|
55
|
-
"appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.
|
|
56
|
-
"appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.
|
|
54
|
+
"appdynamics-libagent-napi": "https://cdn.appdynamics.com/packages/nodejs/24.10.0.0/appdynamics-libagent-napi-node.tgz",
|
|
55
|
+
"appdynamics-native": "https://cdn.appdynamics.com/packages/nodejs/24.10.0.0/appdynamics-native-node.tgz",
|
|
56
|
+
"appdynamics-protobuf": "https://cdn.appdynamics.com/packages/nodejs/24.10.0.0/appdynamics-protobuf-node.tgz"
|
|
57
57
|
},
|
|
58
58
|
"overrides": {
|
|
59
59
|
"semver": "7.5.4"
|