dd-trace 4.0.0-pre-c2a4fd2 → 4.0.0-pre-d46f64a
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/LICENSE-3rdparty.csv +1 -0
- package/README.md +4 -0
- package/ci/init.js +9 -1
- package/ext/exporters.d.ts +2 -1
- package/ext/exporters.js +2 -1
- package/package.json +5 -4
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +100 -27
- package/packages/datadog-instrumentations/src/jest.js +25 -36
- package/packages/datadog-instrumentations/src/ldapjs.js +12 -2
- package/packages/datadog-instrumentations/src/mongoose.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +2 -1
- package/packages/datadog-plugin-amqp10/src/producer.js +2 -1
- package/packages/datadog-plugin-amqplib/src/client.js +2 -1
- package/packages/datadog-plugin-amqplib/src/producer.js +2 -1
- package/packages/datadog-plugin-cassandra-driver/src/index.js +2 -1
- package/packages/datadog-plugin-cucumber/src/index.js +2 -1
- package/packages/datadog-plugin-cypress/src/plugin.js +6 -4
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +4 -4
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +6 -5
- package/packages/datadog-plugin-http2/src/client.js +2 -1
- package/packages/datadog-plugin-jest/src/index.js +51 -14
- package/packages/datadog-plugin-memcached/src/index.js +2 -1
- package/packages/datadog-plugin-mocha/src/index.js +9 -5
- package/packages/datadog-plugin-mysql/src/index.js +2 -1
- package/packages/datadog-plugin-net/src/index.js +2 -2
- package/packages/datadog-plugin-net/src/tcp.js +2 -1
- package/packages/datadog-plugin-oracledb/src/index.js +2 -1
- package/packages/datadog-plugin-pg/src/index.js +2 -1
- package/packages/datadog-plugin-playwright/src/index.js +2 -1
- package/packages/datadog-plugin-redis/src/index.js +2 -1
- package/packages/datadog-plugin-rhea/src/producer.js +2 -1
- package/packages/datadog-plugin-tedious/src/index.js +2 -1
- package/packages/dd-trace/src/appsec/iast/iast-context.js +6 -2
- package/packages/dd-trace/src/appsec/iast/index.js +3 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +5 -2
- package/packages/dd-trace/src/appsec/recommended.json +42 -44
- package/packages/dd-trace/src/ci-visibility/encode/json-encoder.js +27 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +2 -9
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +7 -7
- package/packages/dd-trace/src/ci-visibility/exporters/jest-worker/index.js +33 -0
- package/packages/dd-trace/src/ci-visibility/exporters/jest-worker/writer.js +37 -0
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-itr-configuration.js +8 -2
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +8 -2
- package/packages/dd-trace/src/config.js +2 -2
- package/packages/dd-trace/src/constants.js +2 -1
- package/packages/dd-trace/src/exporter.js +7 -9
- package/packages/dd-trace/src/exporters/common/docker.js +4 -1
- package/packages/dd-trace/src/lambda/handler.js +5 -6
- package/packages/dd-trace/src/log/writer.js +32 -24
- package/packages/dd-trace/src/metrics.js +18 -0
- package/packages/dd-trace/src/plugins/ci_plugin.js +12 -7
- package/packages/dd-trace/src/plugins/outgoing.js +2 -1
- package/packages/dd-trace/src/plugins/util/ip_extractor.js +23 -27
- package/packages/dd-trace/src/plugins/util/test.js +17 -5
- package/packages/dd-trace/src/startup-log.js +3 -6
- package/scripts/install_plugin_modules.js +5 -1
package/LICENSE-3rdparty.csv
CHANGED
|
@@ -57,6 +57,7 @@ dev,multer,MIT,Copyright 2014 Hage Yaapa
|
|
|
57
57
|
dev,msgpack-lite,MIT,Copyright 2015 Yusuke Kawasaki
|
|
58
58
|
dev,nock,MIT,Copyright 2017 Pedro Teixeira and other contributors
|
|
59
59
|
dev,nyc,ISC,Copyright 2015 Contributors
|
|
60
|
+
dev,pprof-format,MIT,Copyright 2022 Stephen Belanger
|
|
60
61
|
dev,proxyquire,MIT,Copyright 2013 Thorsten Lorenz
|
|
61
62
|
dev,rimraf,ISC,Copyright Isaac Z. Schlueter and Contributors
|
|
62
63
|
dev,sinon,BSD-3-Clause,Copyright 2010-2017 Christian Johansen
|
package/README.md
CHANGED
|
@@ -93,6 +93,10 @@ $ docker-compose up -d -V --remove-orphans --force-recreate
|
|
|
93
93
|
$ yarn services
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
+
> **Note**
|
|
97
|
+
> The `couchbase`, `grpc` and `oracledb` instrumentations rely on native modules
|
|
98
|
+
> that do not compile on ARM64 devices (for example M1/M2 Mac) - their tests
|
|
99
|
+
> cannot be run locally on these devices.
|
|
96
100
|
|
|
97
101
|
### Unit Tests
|
|
98
102
|
|
package/ci/init.js
CHANGED
|
@@ -3,13 +3,15 @@ const tracer = require('../packages/dd-trace')
|
|
|
3
3
|
const { ORIGIN_KEY } = require('../packages/dd-trace/src/constants')
|
|
4
4
|
const { isTrue } = require('../packages/dd-trace/src/util')
|
|
5
5
|
|
|
6
|
+
const isJestWorker = !!process.env.JEST_WORKER_ID
|
|
7
|
+
|
|
6
8
|
const options = {
|
|
7
9
|
startupLogs: false,
|
|
8
10
|
tags: {
|
|
9
11
|
[ORIGIN_KEY]: 'ciapp-test'
|
|
10
12
|
},
|
|
11
13
|
isCiVisibility: true,
|
|
12
|
-
flushInterval: 5000
|
|
14
|
+
flushInterval: isJestWorker ? 0 : 5000
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
let shouldInit = true
|
|
@@ -33,6 +35,12 @@ so dd-trace will not be initialized.`)
|
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
|
|
38
|
+
if (isJestWorker) {
|
|
39
|
+
options.experimental = {
|
|
40
|
+
exporter: 'jest_worker'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
36
44
|
if (shouldInit) {
|
|
37
45
|
tracer.init(options)
|
|
38
46
|
tracer.use('fs', false)
|
package/ext/exporters.d.ts
CHANGED
package/ext/exporters.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "4.0.0-pre-
|
|
3
|
+
"version": "4.0.0-pre-d46f64a",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@datadog/native-appsec": "2.0.0",
|
|
64
|
-
"@datadog/native-iast-rewriter": "
|
|
65
|
-
"@datadog/native-iast-taint-tracking": "1.1.
|
|
64
|
+
"@datadog/native-iast-rewriter": "2.0.1",
|
|
65
|
+
"@datadog/native-iast-taint-tracking": "1.1.1",
|
|
66
66
|
"@datadog/native-metrics": "^1.5.0",
|
|
67
|
-
"@datadog/pprof": "^
|
|
67
|
+
"@datadog/pprof": "^2.0.0",
|
|
68
68
|
"@datadog/sketches-js": "^2.1.0",
|
|
69
69
|
"crypto-randomuuid": "^1.0.0",
|
|
70
70
|
"diagnostics_channel": "^1.1.0",
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
"multer": "^1.4.5-lts.1",
|
|
121
121
|
"nock": "^11.3.3",
|
|
122
122
|
"nyc": "^15.1.0",
|
|
123
|
+
"pprof-format": "^2.0.7",
|
|
123
124
|
"proxyquire": "^1.8.0",
|
|
124
125
|
"rimraf": "^3.0.0",
|
|
125
126
|
"sinon": "^11.1.2",
|
|
@@ -15,46 +15,106 @@ const receiveStartCh = channel(`apm:google-cloud-pubsub:receive:start`)
|
|
|
15
15
|
const receiveFinishCh = channel('apm:google-cloud-pubsub:receive:finish')
|
|
16
16
|
const receiveErrorCh = channel('apm:google-cloud-pubsub:receive:error')
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
const publisherMethods = [
|
|
19
|
+
'createTopic',
|
|
20
|
+
'updateTopic',
|
|
21
|
+
'publish',
|
|
22
|
+
'getTopic',
|
|
23
|
+
'listTopics',
|
|
24
|
+
'listTopicSubscriptions',
|
|
25
|
+
'listTopicSnapshots',
|
|
26
|
+
'deleteTopic',
|
|
27
|
+
'detachSubscription'
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
const schemaServiceMethods = [
|
|
31
|
+
'createSchema',
|
|
32
|
+
'getSchema',
|
|
33
|
+
'listSchemas',
|
|
34
|
+
'listSchemaRevisions',
|
|
35
|
+
'commitSchema',
|
|
36
|
+
'rollbackSchema',
|
|
37
|
+
'deleteSchemaRevision',
|
|
38
|
+
'deleteSchema',
|
|
39
|
+
'validateSchema',
|
|
40
|
+
'validateMessage'
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
const subscriberMethods = [
|
|
44
|
+
'createSubscription',
|
|
45
|
+
'getSubscription',
|
|
46
|
+
'updateSubscription',
|
|
47
|
+
'listSubscriptions',
|
|
48
|
+
'deleteSubscription',
|
|
49
|
+
'modifyAckDeadline',
|
|
50
|
+
'acknowledge',
|
|
51
|
+
'pull',
|
|
52
|
+
'streamingPull',
|
|
53
|
+
'modifyPushConfig',
|
|
54
|
+
'getSnapshot',
|
|
55
|
+
'listSnapshots',
|
|
56
|
+
'createSnapshot',
|
|
57
|
+
'updateSnapshot',
|
|
58
|
+
'deleteSnapshot',
|
|
59
|
+
'seek'
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
function wrapMethod (method) {
|
|
63
|
+
const api = method.name
|
|
64
|
+
|
|
65
|
+
return function (request) {
|
|
66
|
+
if (!requestStartCh.hasSubscribers) return request.apply(this, arguments)
|
|
26
67
|
|
|
27
68
|
const innerAsyncResource = new AsyncResource('bound-anonymous-fn')
|
|
28
|
-
const outerAsyncResource = new AsyncResource('bound-anonymous-fn')
|
|
29
69
|
|
|
30
70
|
return innerAsyncResource.runInAsyncScope(() => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
71
|
+
const projectId = this.auth._cachedProjectId
|
|
72
|
+
const cb = arguments[arguments.length - 1]
|
|
73
|
+
|
|
74
|
+
requestStartCh.publish({ request, api, projectId })
|
|
35
75
|
|
|
36
|
-
|
|
37
|
-
|
|
76
|
+
if (typeof cb === 'function') {
|
|
77
|
+
const outerAsyncResource = new AsyncResource('bound-anonymous-fn')
|
|
38
78
|
|
|
39
|
-
|
|
40
|
-
arguments[1] = innerAsyncResource.bind(function (error) {
|
|
79
|
+
arguments[arguments.length - 1] = innerAsyncResource.bind(function (error) {
|
|
41
80
|
if (error) {
|
|
42
81
|
requestErrorCh.publish(error)
|
|
43
82
|
}
|
|
44
|
-
|
|
45
|
-
|
|
83
|
+
|
|
84
|
+
requestFinishCh.publish()
|
|
85
|
+
|
|
86
|
+
return outerAsyncResource.runInAsyncScope(() => cb.apply(this, arguments))
|
|
46
87
|
})
|
|
47
|
-
return request.apply(this, arguments)
|
|
48
|
-
}
|
|
49
88
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
89
|
+
return method.apply(this, arguments)
|
|
90
|
+
} else {
|
|
91
|
+
return method.apply(this, arguments)
|
|
92
|
+
.then(
|
|
93
|
+
response => {
|
|
94
|
+
requestFinishCh.publish()
|
|
95
|
+
return response
|
|
96
|
+
},
|
|
97
|
+
error => {
|
|
98
|
+
requestErrorCh.publish(error)
|
|
99
|
+
requestFinishCh.publish()
|
|
100
|
+
throw error
|
|
101
|
+
}
|
|
102
|
+
)
|
|
55
103
|
}
|
|
56
104
|
})
|
|
57
|
-
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function massWrap (obj, methods, wrapper) {
|
|
109
|
+
for (const method of methods) {
|
|
110
|
+
if (typeof obj[method] === 'function') {
|
|
111
|
+
shimmer.wrap(obj, method, wrapper)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'] }, (obj) => {
|
|
117
|
+
const Subscription = obj.Subscription
|
|
58
118
|
|
|
59
119
|
shimmer.wrap(Subscription.prototype, 'emit', emit => function (eventName, message) {
|
|
60
120
|
if (eventName !== 'message' || !message) return emit.apply(this, arguments)
|
|
@@ -98,3 +158,16 @@ addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'], file: 'build/src/le
|
|
|
98
158
|
|
|
99
159
|
return obj
|
|
100
160
|
})
|
|
161
|
+
|
|
162
|
+
addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'] }, (obj) => {
|
|
163
|
+
const { PublisherClient, SchemaServiceClient, SubscriberClient } = obj.v1
|
|
164
|
+
|
|
165
|
+
massWrap(PublisherClient.prototype, publisherMethods, wrapMethod)
|
|
166
|
+
massWrap(SubscriberClient.prototype, subscriberMethods, wrapMethod)
|
|
167
|
+
|
|
168
|
+
if (SchemaServiceClient) {
|
|
169
|
+
massWrap(SchemaServiceClient.prototype, schemaServiceMethods, wrapMethod)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return obj
|
|
173
|
+
})
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
const { addHook, channel, AsyncResource } = require('./helpers/instrument')
|
|
3
3
|
const shimmer = require('../../datadog-shimmer')
|
|
4
4
|
const log = require('../../dd-trace/src/log')
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
getCoveredFilenamesFromCoverage,
|
|
7
|
+
JEST_WORKER_TRACE_PAYLOAD_CODE,
|
|
8
|
+
JEST_WORKER_COVERAGE_PAYLOAD_CODE
|
|
9
|
+
} = require('../../dd-trace/src/plugins/util/test')
|
|
6
10
|
|
|
7
11
|
const testSessionStartCh = channel('ci:jest:session:start')
|
|
8
12
|
const testSessionFinishCh = channel('ci:jest:session:finish')
|
|
@@ -12,6 +16,9 @@ const testSessionConfigurationCh = channel('ci:jest:session:configuration')
|
|
|
12
16
|
const testSuiteStartCh = channel('ci:jest:test-suite:start')
|
|
13
17
|
const testSuiteFinishCh = channel('ci:jest:test-suite:finish')
|
|
14
18
|
|
|
19
|
+
const workerReportTraceCh = channel('ci:jest:worker-report:trace')
|
|
20
|
+
const workerReportCoverageCh = channel('ci:jest:worker-report:coverage')
|
|
21
|
+
|
|
15
22
|
const testSuiteCodeCoverageCh = channel('ci:jest:test-suite:code-coverage')
|
|
16
23
|
|
|
17
24
|
const testStartCh = channel('ci:jest:test:start')
|
|
@@ -215,7 +222,6 @@ function cliWrapper (cli, jestVersion) {
|
|
|
215
222
|
log.error(err)
|
|
216
223
|
}
|
|
217
224
|
}
|
|
218
|
-
|
|
219
225
|
const isSuitesSkipped = !!skippableSuites.length
|
|
220
226
|
|
|
221
227
|
const processArgv = process.argv.slice(2).join(' ')
|
|
@@ -310,7 +316,6 @@ function jestAdapterWrapper (jestAdapter, jestVersion) {
|
|
|
310
316
|
} else if (numFailingTests !== 0) {
|
|
311
317
|
status = 'fail'
|
|
312
318
|
}
|
|
313
|
-
testSuiteFinishCh.publish({ status, errorMessage })
|
|
314
319
|
|
|
315
320
|
const coverageFiles = getCoveredFilenamesFromCoverage(environment.global.__coverage__)
|
|
316
321
|
.map(filename => getTestSuitePath(filename, environment.rootDir))
|
|
@@ -327,6 +332,7 @@ function jestAdapterWrapper (jestAdapter, jestVersion) {
|
|
|
327
332
|
testSuiteCodeCoverageCh.publish([...coverageFiles, environment.testSuite])
|
|
328
333
|
})
|
|
329
334
|
}
|
|
335
|
+
testSuiteFinishCh.publish({ status, errorMessage })
|
|
330
336
|
return suiteResults
|
|
331
337
|
})
|
|
332
338
|
})
|
|
@@ -477,44 +483,27 @@ addHook({
|
|
|
477
483
|
file: 'build/jasmineAsyncInstall.js'
|
|
478
484
|
}, jasmineAsyncInstallWraper)
|
|
479
485
|
|
|
480
|
-
// Maximum time we allow the workers to shutdown
|
|
481
|
-
const JEST_WORKER_SHUTDOWN_TIMEOUT = 20
|
|
482
|
-
// https://github.com/facebook/jest/blob/d6ad15b0f88a05816c2fe034dd6900d28315d570/packages/jest-worker/src/types.ts#L38
|
|
483
|
-
const CHILD_MESSAGE_END = 2
|
|
484
|
-
|
|
485
|
-
// 25.1.0 is where waitForExit
|
|
486
486
|
addHook({
|
|
487
487
|
name: 'jest-worker',
|
|
488
488
|
versions: ['>=24.9.0'],
|
|
489
|
-
file: 'build/
|
|
490
|
-
}, (
|
|
491
|
-
const
|
|
492
|
-
shimmer.wrap(
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
this._workers.forEach(worker => {
|
|
498
|
-
worker.send([CHILD_MESSAGE_END], () => {}, () => {}, () => {})
|
|
489
|
+
file: 'build/workers/ChildProcessWorker.js'
|
|
490
|
+
}, (childProcessWorker) => {
|
|
491
|
+
const ChildProcessWorker = childProcessWorker.default
|
|
492
|
+
shimmer.wrap(ChildProcessWorker.prototype, '_onMessage', _onMessage => function () {
|
|
493
|
+
const [code, data] = arguments[0]
|
|
494
|
+
if (code === JEST_WORKER_TRACE_PAYLOAD_CODE) { // datadog trace payload
|
|
495
|
+
sessionAsyncResource.runInAsyncScope(() => {
|
|
496
|
+
workerReportTraceCh.publish(data)
|
|
499
497
|
})
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
498
|
+
return
|
|
499
|
+
}
|
|
500
|
+
if (code === JEST_WORKER_COVERAGE_PAYLOAD_CODE) { // datadog coverage payload
|
|
501
|
+
sessionAsyncResource.runInAsyncScope(() => {
|
|
502
|
+
workerReportCoverageCh.publish(data)
|
|
505
503
|
})
|
|
506
|
-
|
|
507
|
-
const workersWaitForExitPromise = Promise.all(this._workers.map(worker =>
|
|
508
|
-
worker.waitForExit()
|
|
509
|
-
))
|
|
510
|
-
|
|
511
|
-
// If the workers are able to shut down gracefully before the timeout, we proceed
|
|
512
|
-
await Promise.race([workersWaitForExitPromise, killPromise])
|
|
513
|
-
clearTimeout(timeoutId)
|
|
514
|
-
} catch (e) {
|
|
515
|
-
// ignore error
|
|
504
|
+
return
|
|
516
505
|
}
|
|
517
|
-
return
|
|
506
|
+
return _onMessage.apply(this, arguments)
|
|
518
507
|
})
|
|
519
|
-
return
|
|
508
|
+
return childProcessWorker
|
|
520
509
|
})
|
|
@@ -35,7 +35,7 @@ function wrapEmitter (corkedEmitter) {
|
|
|
35
35
|
}
|
|
36
36
|
arguments[1] = bindedFn
|
|
37
37
|
}
|
|
38
|
-
on.apply(this, arguments)
|
|
38
|
+
return on.apply(this, arguments)
|
|
39
39
|
}
|
|
40
40
|
shimmer.wrap(corkedEmitter, 'on', addListener)
|
|
41
41
|
shimmer.wrap(corkedEmitter, 'addListener', addListener)
|
|
@@ -47,7 +47,7 @@ function wrapEmitter (corkedEmitter) {
|
|
|
47
47
|
arguments[1] = emitterOn
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
off.apply(this, arguments)
|
|
50
|
+
return off.apply(this, arguments)
|
|
51
51
|
}
|
|
52
52
|
shimmer.wrap(corkedEmitter, 'off', removeListener)
|
|
53
53
|
shimmer.wrap(corkedEmitter, 'removeListener', removeListener)
|
|
@@ -87,5 +87,15 @@ addHook({ name: 'ldapjs', versions: ['>=2'] }, ldapjs => {
|
|
|
87
87
|
return _send.apply(this, arguments)
|
|
88
88
|
})
|
|
89
89
|
|
|
90
|
+
shimmer.wrap(ldapjs.Client.prototype, 'bind', bind => function (dn, password, controls, callback) {
|
|
91
|
+
if (typeof controls === 'function') {
|
|
92
|
+
arguments[2] = AsyncResource.bind(controls)
|
|
93
|
+
} else if (typeof callback === 'function') {
|
|
94
|
+
arguments[3] = AsyncResource.bind(callback)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return bind.apply(this, arguments)
|
|
98
|
+
})
|
|
99
|
+
|
|
90
100
|
return ldapjs
|
|
91
101
|
})
|
|
@@ -19,7 +19,7 @@ function wrapAddQueue (addQueue) {
|
|
|
19
19
|
|
|
20
20
|
addHook({
|
|
21
21
|
name: 'mongoose',
|
|
22
|
-
versions: ['>=4.6.4']
|
|
22
|
+
versions: ['>=4.6.4 <7'] // TODO: Mongoose v7 compat
|
|
23
23
|
}, mongoose => {
|
|
24
24
|
if (mongoose.Promise !== global.Promise) {
|
|
25
25
|
shimmer.wrap(mongoose.Promise.prototype, 'then', wrapThen)
|
|
@@ -127,7 +127,8 @@ function finish (req, res, result, err) {
|
|
|
127
127
|
return result
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
// TODO: 13.2 support
|
|
131
|
+
addHook({ name: 'next', versions: ['>=11.1 <13.2'], file: 'dist/server/next-server.js' }, nextServer => {
|
|
131
132
|
const Server = nextServer.default
|
|
132
133
|
|
|
133
134
|
shimmer.wrap(Server.prototype, 'handleRequest', wrapHandleRequest)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
4
|
+
const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
4
5
|
const { getAddress, getShortName } = require('./util')
|
|
5
6
|
|
|
6
7
|
class Amqp10ProducerPlugin extends ProducerPlugin {
|
|
@@ -20,7 +21,7 @@ class Amqp10ProducerPlugin extends ProducerPlugin {
|
|
|
20
21
|
'amqp.link.target.address': target,
|
|
21
22
|
'amqp.link.role': 'sender',
|
|
22
23
|
'out.host': address.host,
|
|
23
|
-
|
|
24
|
+
[CLIENT_PORT_KEY]: address.port,
|
|
24
25
|
'amqp.link.name': link.name,
|
|
25
26
|
'amqp.link.handle': link.handle,
|
|
26
27
|
'amqp.connection.host': address.host,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { TEXT_MAP } = require('../../../ext/formats')
|
|
4
|
+
const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
4
5
|
const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
5
6
|
const { getResourceName } = require('./util')
|
|
6
7
|
|
|
@@ -19,7 +20,7 @@ class AmqplibClientPlugin extends ClientPlugin {
|
|
|
19
20
|
kind: 'client',
|
|
20
21
|
meta: {
|
|
21
22
|
'out.host': stream._host,
|
|
22
|
-
|
|
23
|
+
[CLIENT_PORT_KEY]: stream.remotePort,
|
|
23
24
|
'amqp.queue': fields.queue,
|
|
24
25
|
'amqp.exchange': fields.exchange,
|
|
25
26
|
'amqp.routingKey': fields.routingKey,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const { TEXT_MAP } = require('../../../ext/formats')
|
|
4
|
+
const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
4
5
|
const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
5
6
|
const { getResourceName } = require('./util')
|
|
6
7
|
|
|
@@ -18,7 +19,7 @@ class AmqplibProducerPlugin extends ProducerPlugin {
|
|
|
18
19
|
kind: 'producer',
|
|
19
20
|
meta: {
|
|
20
21
|
'out.host': stream._host,
|
|
21
|
-
|
|
22
|
+
[CLIENT_PORT_KEY]: stream.remotePort,
|
|
22
23
|
'amqp.queue': fields.queue,
|
|
23
24
|
'amqp.exchange': fields.exchange,
|
|
24
25
|
'amqp.routingKey': fields.routingKey,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
3
4
|
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
4
5
|
|
|
5
6
|
class CassandraDriverPlugin extends DatabasePlugin {
|
|
@@ -21,7 +22,7 @@ class CassandraDriverPlugin extends DatabasePlugin {
|
|
|
21
22
|
'cassandra.query': query,
|
|
22
23
|
'cassandra.keyspace': keyspace,
|
|
23
24
|
'out.host': connectionOptions.host,
|
|
24
|
-
|
|
25
|
+
[CLIENT_PORT_KEY]: connectionOptions.port
|
|
25
26
|
}
|
|
26
27
|
})
|
|
27
28
|
}
|
|
@@ -36,7 +36,8 @@ class CucumberPlugin extends CiPlugin {
|
|
|
36
36
|
const testSuiteMetadata = getTestSuiteCommonTags(
|
|
37
37
|
this.command,
|
|
38
38
|
this.frameworkVersion,
|
|
39
|
-
getTestSuitePath(testSuiteFullPath, this.sourceRoot)
|
|
39
|
+
getTestSuitePath(testSuiteFullPath, this.sourceRoot),
|
|
40
|
+
'cucumber'
|
|
40
41
|
)
|
|
41
42
|
this.testSuiteSpan = this.tracer.startSpan('cucumber.test_suite', {
|
|
42
43
|
childOf: this.testModuleSpan,
|
|
@@ -16,6 +16,7 @@ const {
|
|
|
16
16
|
TEST_SESSION_ID,
|
|
17
17
|
TEST_COMMAND,
|
|
18
18
|
TEST_BUNDLE,
|
|
19
|
+
TEST_MODULE,
|
|
19
20
|
finishAllTraceSpans
|
|
20
21
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
21
22
|
|
|
@@ -95,8 +96,8 @@ module.exports = (on, config) => {
|
|
|
95
96
|
command = getCypressCommand(details)
|
|
96
97
|
frameworkVersion = getCypressVersion(details)
|
|
97
98
|
|
|
98
|
-
const testSessionSpanMetadata = getTestSessionCommonTags(command, frameworkVersion)
|
|
99
|
-
const testModuleSpanMetadata = getTestModuleCommonTags(command, frameworkVersion)
|
|
99
|
+
const testSessionSpanMetadata = getTestSessionCommonTags(command, frameworkVersion, 'cypress')
|
|
100
|
+
const testModuleSpanMetadata = getTestModuleCommonTags(command, frameworkVersion, 'cypress')
|
|
100
101
|
|
|
101
102
|
testSessionSpan = tracer.startSpan('cypress.test_session', {
|
|
102
103
|
childOf,
|
|
@@ -137,7 +138,7 @@ module.exports = (on, config) => {
|
|
|
137
138
|
if (testSuiteSpan) {
|
|
138
139
|
return null
|
|
139
140
|
}
|
|
140
|
-
const testSuiteSpanMetadata = getTestSuiteCommonTags(command, frameworkVersion, suite)
|
|
141
|
+
const testSuiteSpanMetadata = getTestSuiteCommonTags(command, frameworkVersion, suite, 'cypress')
|
|
141
142
|
testSuiteSpan = tracer.startSpan('cypress.test_suite', {
|
|
142
143
|
childOf: testModuleSpan,
|
|
143
144
|
tags: {
|
|
@@ -167,7 +168,8 @@ module.exports = (on, config) => {
|
|
|
167
168
|
[TEST_COMMAND]: command,
|
|
168
169
|
[TEST_MODULE_ID]: testModuleId,
|
|
169
170
|
[TEST_COMMAND]: command,
|
|
170
|
-
[TEST_BUNDLE]:
|
|
171
|
+
[TEST_BUNDLE]: 'cypress',
|
|
172
|
+
[TEST_MODULE]: 'cypress'
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
const {
|
|
@@ -6,15 +6,15 @@ class GoogleCloudPubsubClientPlugin extends ClientPlugin {
|
|
|
6
6
|
static get name () { return 'google-cloud-pubsub' }
|
|
7
7
|
static get operation () { return 'request' }
|
|
8
8
|
|
|
9
|
-
start ({
|
|
10
|
-
if (
|
|
9
|
+
start ({ request, api, projectId }) {
|
|
10
|
+
if (api === 'publish') return
|
|
11
11
|
|
|
12
12
|
this.startSpan('pubsub.request', {
|
|
13
13
|
service: this.config.service || `${this.tracer._service}-pubsub`,
|
|
14
|
-
resource: [
|
|
14
|
+
resource: [api, request.name].filter(x => x).join(' '),
|
|
15
15
|
kind: 'client',
|
|
16
16
|
meta: {
|
|
17
|
-
'pubsub.method':
|
|
17
|
+
'pubsub.method': api,
|
|
18
18
|
'gcloud.project_id': projectId
|
|
19
19
|
}
|
|
20
20
|
})
|
|
@@ -6,17 +6,18 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
6
6
|
static get name () { return 'google-cloud-pubsub' }
|
|
7
7
|
static get operation () { return 'request' }
|
|
8
8
|
|
|
9
|
-
start ({
|
|
10
|
-
if (
|
|
9
|
+
start ({ request, api, projectId }) {
|
|
10
|
+
if (api !== 'publish') return
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const messages = request.messages || []
|
|
13
|
+
const topic = request.topic
|
|
13
14
|
const span = this.startSpan('pubsub.request', { // TODO: rename
|
|
14
15
|
service: this.config.service || `${this.tracer._service}-pubsub`,
|
|
15
|
-
resource: `${
|
|
16
|
+
resource: `${api} ${topic}`,
|
|
16
17
|
kind: 'producer',
|
|
17
18
|
meta: {
|
|
18
19
|
'gcloud.project_id': projectId,
|
|
19
|
-
'pubsub.method':
|
|
20
|
+
'pubsub.method': api, // TODO: remove
|
|
20
21
|
'pubsub.topic': topic
|
|
21
22
|
}
|
|
22
23
|
})
|
|
@@ -9,7 +9,7 @@ const tags = require('../../../ext/tags')
|
|
|
9
9
|
const kinds = require('../../../ext/kinds')
|
|
10
10
|
const formats = require('../../../ext/formats')
|
|
11
11
|
const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
|
|
12
|
-
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
12
|
+
const { COMPONENT, CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
13
13
|
const urlFilter = require('../../dd-trace/src/plugins/util/urlfilter')
|
|
14
14
|
|
|
15
15
|
const HTTP_HEADERS = formats.HTTP_HEADERS
|
|
@@ -46,6 +46,7 @@ class Http2ClientPlugin extends Plugin {
|
|
|
46
46
|
childOf,
|
|
47
47
|
tags: {
|
|
48
48
|
[COMPONENT]: this.constructor.name,
|
|
49
|
+
[CLIENT_PORT_KEY]: parseInt(sessionDetails.port),
|
|
49
50
|
[SPAN_KIND]: CLIENT,
|
|
50
51
|
'service.name': getServiceName(this.tracer, this.config, sessionDetails),
|
|
51
52
|
'resource.name': method,
|