dd-trace 3.19.0 → 3.21.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/index.d.ts +8 -1
- package/package.json +5 -4
- package/packages/datadog-instrumentations/src/grpc/client.js +9 -5
- package/packages/datadog-instrumentations/src/grpc/server.js +8 -4
- package/packages/datadog-instrumentations/src/helpers/register.js +4 -0
- package/packages/datadog-instrumentations/src/jest.js +20 -17
- package/packages/datadog-instrumentations/src/mocha.js +8 -4
- package/packages/datadog-instrumentations/src/next.js +6 -1
- package/packages/datadog-instrumentations/src/pg.js +3 -4
- package/packages/datadog-instrumentations/src/playwright.js +11 -1
- package/packages/datadog-plugin-amqp10/src/consumer.js +3 -1
- package/packages/datadog-plugin-amqp10/src/producer.js +3 -1
- package/packages/datadog-plugin-amqplib/src/client.js +3 -4
- package/packages/datadog-plugin-amqplib/src/consumer.js +3 -1
- package/packages/datadog-plugin-amqplib/src/producer.js +3 -1
- package/packages/datadog-plugin-aws-sdk/src/base.js +3 -0
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +4 -2
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +4 -3
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -0
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +8 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +7 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +3 -4
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +3 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +3 -1
- package/packages/datadog-plugin-http/src/client.js +2 -1
- package/packages/datadog-plugin-http2/src/client.js +2 -1
- package/packages/datadog-plugin-jest/src/util.js +10 -1
- package/packages/datadog-plugin-kafkajs/src/consumer.js +6 -1
- package/packages/datadog-plugin-kafkajs/src/producer.js +3 -1
- package/packages/datadog-plugin-pg/src/index.js +5 -5
- package/packages/datadog-plugin-rhea/src/consumer.js +3 -1
- package/packages/datadog-plugin-rhea/src/producer.js +5 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/command-injection-analyzer.js +2 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/ldap-injection-analyzer.js +2 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +22 -5
- package/packages/dd-trace/src/appsec/iast/analyzers/sql-injection-analyzer.js +40 -4
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-cipher-analyzer.js +2 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/weak-hash-analyzer.js +2 -1
- package/packages/dd-trace/src/appsec/iast/index.js +1 -1
- package/packages/dd-trace/src/appsec/iast/path-line.js +2 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/range-utils.js +37 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/command-sensitive-analyzer.js +29 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +35 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +95 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +144 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +113 -0
- package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +8 -0
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +4 -76
- package/packages/dd-trace/src/config.js +59 -25
- package/packages/dd-trace/src/constants.js +3 -1
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +14 -4
- package/packages/dd-trace/src/git_metadata_tagger.js +17 -0
- package/packages/dd-trace/src/git_properties.js +32 -0
- package/packages/dd-trace/src/plugin_manager.js +0 -2
- package/packages/dd-trace/src/plugins/client.js +2 -3
- package/packages/dd-trace/src/plugins/consumer.js +2 -17
- package/packages/dd-trace/src/plugins/incoming.js +7 -0
- package/packages/dd-trace/src/plugins/{outbound.js → outgoing.js} +2 -2
- package/packages/dd-trace/src/plugins/producer.js +2 -17
- package/packages/dd-trace/src/plugins/server.js +2 -2
- package/packages/dd-trace/src/plugins/tracing.js +0 -11
- package/packages/dd-trace/src/plugins/util/ci.js +62 -7
- package/packages/dd-trace/src/plugins/util/tags.js +5 -1
- package/packages/dd-trace/src/plugins/util/test.js +34 -17
- package/packages/dd-trace/src/profiling/constants.js +0 -1
- package/packages/dd-trace/src/profiling/profilers/space.js +1 -3
- package/packages/dd-trace/src/proxy.js +4 -0
- package/packages/dd-trace/src/serverless.js +25 -0
- package/packages/dd-trace/src/span_processor.js +3 -0
- package/packages/dd-trace/src/telemetry/send-data.js +13 -3
- package/packages/dd-trace/src/tracer.js +3 -2
- package/version.js +9 -0
- package/packages/dd-trace/src/plugins/inbound.js +0 -7
- package/packages/dd-trace/src/service-naming/index.js +0 -41
- package/packages/dd-trace/src/service-naming/schemas/definition.js +0 -28
- package/packages/dd-trace/src/service-naming/schemas/index.js +0 -6
- package/packages/dd-trace/src/service-naming/schemas/v0.js +0 -66
- package/packages/dd-trace/src/service-naming/schemas/v1.js +0 -58
package/index.d.ts
CHANGED
|
@@ -79,7 +79,8 @@ export declare interface Tracer extends opentracing.Tracer {
|
|
|
79
79
|
* which case the span will finish at the end of the function execution.
|
|
80
80
|
*
|
|
81
81
|
* If the `orphanable` option is set to false, the function will not be traced
|
|
82
|
-
* unless there is already an active span or `childOf` option.
|
|
82
|
+
* unless there is already an active span or `childOf` option. Note that this
|
|
83
|
+
* option is deprecated and has been removed in version 4.0.
|
|
83
84
|
*/
|
|
84
85
|
trace<T> (name: string, fn: (span?: Span, fn?: (error?: Error) => any) => T): T;
|
|
85
86
|
trace<T> (name: string, options: TraceOptions & SpanOptions, fn: (span?: Span, done?: (error?: Error) => string) => T): T;
|
|
@@ -443,6 +444,11 @@ export declare interface TracerOptions {
|
|
|
443
444
|
* Whether to enable vulnerability deduplication
|
|
444
445
|
*/
|
|
445
446
|
deduplicationEnabled?: boolean
|
|
447
|
+
/**
|
|
448
|
+
* Whether to enable vulnerability redaction
|
|
449
|
+
* @default true
|
|
450
|
+
*/
|
|
451
|
+
redactionEnabled?: boolean
|
|
446
452
|
}
|
|
447
453
|
};
|
|
448
454
|
|
|
@@ -491,6 +497,7 @@ export declare interface TracerOptions {
|
|
|
491
497
|
/**
|
|
492
498
|
* If false, require a parent in order to trace.
|
|
493
499
|
* @default true
|
|
500
|
+
* @deprecated since version 4.0
|
|
494
501
|
*/
|
|
495
502
|
orphanable?: boolean
|
|
496
503
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.21.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"test:integration:cucumber": "mocha --colors --timeout 30000 \"integration-tests/cucumber/*.spec.js\"",
|
|
37
37
|
"test:integration:cypress": "mocha --colors --timeout 30000 \"integration-tests/cypress/*.spec.js\"",
|
|
38
38
|
"test:integration:playwright": "mocha --colors --timeout 30000 \"integration-tests/playwright/*.spec.js\"",
|
|
39
|
+
"test:integration:serverless": "mocha --colors --timeout 30000 \"integration-tests/serverless/*.spec.js\"",
|
|
39
40
|
"test:shimmer": "mocha --colors 'packages/datadog-shimmer/test/**/*.spec.js'",
|
|
40
41
|
"test:shimmer:ci": "nyc --no-clean --include 'packages/datadog-shimmer/src/**/*.js' -- npm run test:shimmer",
|
|
41
42
|
"leak:core": "node ./scripts/install_plugin_modules && (cd packages/memwatch && yarn) && NODE_PATH=./packages/memwatch/node_modules node --no-warnings ./node_modules/.bin/tape 'packages/dd-trace/test/leak/**/*.js'",
|
|
@@ -67,9 +68,9 @@
|
|
|
67
68
|
"dependencies": {
|
|
68
69
|
"@datadog/native-appsec": "^3.1.0",
|
|
69
70
|
"@datadog/native-iast-rewriter": "2.0.1",
|
|
70
|
-
"@datadog/native-iast-taint-tracking": "^1.4.
|
|
71
|
-
"@datadog/native-metrics": "^
|
|
72
|
-
"@datadog/pprof": "^2.2.
|
|
71
|
+
"@datadog/native-iast-taint-tracking": "^1.4.1",
|
|
72
|
+
"@datadog/native-metrics": "^2.0.0",
|
|
73
|
+
"@datadog/pprof": "^2.2.1",
|
|
73
74
|
"@datadog/sketches-js": "^2.1.0",
|
|
74
75
|
"crypto-randomuuid": "^1.0.0",
|
|
75
76
|
"diagnostics_channel": "^1.1.0",
|
|
@@ -4,6 +4,8 @@ const types = require('./types')
|
|
|
4
4
|
const { addHook, channel, AsyncResource } = require('../helpers/instrument')
|
|
5
5
|
const shimmer = require('../../../datadog-shimmer')
|
|
6
6
|
|
|
7
|
+
const nodeMajor = parseInt(process.versions.node.split('.')[0])
|
|
8
|
+
|
|
7
9
|
const patched = new WeakSet()
|
|
8
10
|
const instances = new WeakMap()
|
|
9
11
|
|
|
@@ -232,13 +234,15 @@ function patch (grpc) {
|
|
|
232
234
|
return grpc
|
|
233
235
|
}
|
|
234
236
|
|
|
235
|
-
|
|
237
|
+
if (nodeMajor <= 14) {
|
|
238
|
+
addHook({ name: 'grpc', versions: ['>=1.24.3'] }, patch)
|
|
236
239
|
|
|
237
|
-
addHook({ name: 'grpc', versions: ['>=1.24.3'], file: 'src/client.js' }, client => {
|
|
238
|
-
|
|
240
|
+
addHook({ name: 'grpc', versions: ['>=1.24.3'], file: 'src/client.js' }, client => {
|
|
241
|
+
shimmer.wrap(client, 'makeClientConstructor', createWrapMakeClientConstructor())
|
|
239
242
|
|
|
240
|
-
|
|
241
|
-
})
|
|
243
|
+
return client
|
|
244
|
+
})
|
|
245
|
+
}
|
|
242
246
|
|
|
243
247
|
addHook({ name: '@grpc/grpc-js', versions: ['>=1.0.3'] }, patch)
|
|
244
248
|
|
|
@@ -4,6 +4,8 @@ const types = require('./types')
|
|
|
4
4
|
const { channel, addHook, AsyncResource } = require('../helpers/instrument')
|
|
5
5
|
const shimmer = require('../../../datadog-shimmer')
|
|
6
6
|
|
|
7
|
+
const nodeMajor = parseInt(process.versions.node.split('.')[0])
|
|
8
|
+
|
|
7
9
|
const startChannel = channel('apm:grpc:server:request:start')
|
|
8
10
|
const errorChannel = channel('apm:grpc:server:request:error')
|
|
9
11
|
const updateChannel = channel('apm:grpc:server:request:update')
|
|
@@ -139,11 +141,13 @@ function isEmitter (obj) {
|
|
|
139
141
|
return typeof obj.emit === 'function' && typeof obj.once === 'function'
|
|
140
142
|
}
|
|
141
143
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
if (nodeMajor <= 14) {
|
|
145
|
+
addHook({ name: 'grpc', versions: ['>=1.24.3'], file: 'src/server.js' }, server => {
|
|
146
|
+
shimmer.wrap(server.Server.prototype, 'register', wrapRegister)
|
|
144
147
|
|
|
145
|
-
|
|
146
|
-
})
|
|
148
|
+
return server
|
|
149
|
+
})
|
|
150
|
+
}
|
|
147
151
|
|
|
148
152
|
addHook({ name: '@grpc/grpc-js', versions: ['>=1.0.3'], file: 'build/src/server.js' }, server => {
|
|
149
153
|
shimmer.wrap(server.Server.prototype, 'register', wrapRegister)
|
|
@@ -22,6 +22,10 @@ for (const packageName of names) {
|
|
|
22
22
|
|
|
23
23
|
hooks[packageName]()
|
|
24
24
|
|
|
25
|
+
if (!instrumentations[packageName]) {
|
|
26
|
+
return moduleExports
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
for (const { name, file, versions, hook } of instrumentations[packageName]) {
|
|
26
30
|
const fullFilename = filename(name, file)
|
|
27
31
|
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
const semver = require('semver')
|
|
3
|
+
|
|
2
4
|
const { addHook, channel, AsyncResource } = require('./helpers/instrument')
|
|
3
5
|
const shimmer = require('../../datadog-shimmer')
|
|
4
6
|
const log = require('../../dd-trace/src/log')
|
|
7
|
+
const { version: ddTraceVersion } = require('../../../package.json')
|
|
5
8
|
const {
|
|
6
9
|
getCoveredFilenamesFromCoverage,
|
|
7
10
|
JEST_WORKER_TRACE_PAYLOAD_CODE,
|
|
8
11
|
JEST_WORKER_COVERAGE_PAYLOAD_CODE,
|
|
9
|
-
getTestLineStart
|
|
12
|
+
getTestLineStart,
|
|
13
|
+
getTestSuitePath,
|
|
14
|
+
getTestParametersString
|
|
10
15
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
16
|
+
const {
|
|
17
|
+
getFormattedJestTestParameters,
|
|
18
|
+
getJestTestName,
|
|
19
|
+
getJestSuitesToRun
|
|
20
|
+
} = require('../../datadog-plugin-jest/src/util')
|
|
11
21
|
|
|
12
22
|
const testSessionStartCh = channel('ci:jest:session:start')
|
|
13
23
|
const testSessionFinishCh = channel('ci:jest:session:finish')
|
|
@@ -34,13 +44,6 @@ let skippableSuites = []
|
|
|
34
44
|
let isCodeCoverageEnabled = false
|
|
35
45
|
let isSuitesSkippingEnabled = false
|
|
36
46
|
|
|
37
|
-
const {
|
|
38
|
-
getTestSuitePath,
|
|
39
|
-
getTestParametersString
|
|
40
|
-
} = require('../../dd-trace/src/plugins/util/test')
|
|
41
|
-
|
|
42
|
-
const { getFormattedJestTestParameters, getJestTestName } = require('../../datadog-plugin-jest/src/util')
|
|
43
|
-
|
|
44
47
|
const sessionAsyncResource = new AsyncResource('bound-anonymous-fn')
|
|
45
48
|
|
|
46
49
|
const specStatusToTestStatus = {
|
|
@@ -426,10 +429,7 @@ addHook({
|
|
|
426
429
|
const testPaths = await getTestPaths.apply(this, arguments)
|
|
427
430
|
const { tests } = testPaths
|
|
428
431
|
|
|
429
|
-
const filteredTests =
|
|
430
|
-
const relativePath = testPath.replace(`${rootDir}/`, '')
|
|
431
|
-
return !skippableSuites.includes(relativePath)
|
|
432
|
-
})
|
|
432
|
+
const filteredTests = getJestSuitesToRun(skippableSuites, tests, rootDir)
|
|
433
433
|
|
|
434
434
|
skippableSuites = []
|
|
435
435
|
|
|
@@ -451,6 +451,7 @@ addHook({
|
|
|
451
451
|
}, jestConfigSyncWrapper)
|
|
452
452
|
|
|
453
453
|
function jasmineAsyncInstallWraper (jasmineAsyncInstallExport, jestVersion) {
|
|
454
|
+
log.warn('jest-jasmine2 support is removed from dd-trace@v4. Consider changing to jest-circus as `testRunner`.')
|
|
454
455
|
return function (globalConfig, globalInput) {
|
|
455
456
|
globalInput._ddtrace = global._ddtrace
|
|
456
457
|
shimmer.wrap(globalInput.jasmine.Spec.prototype, 'execute', execute => function (onComplete) {
|
|
@@ -480,11 +481,13 @@ function jasmineAsyncInstallWraper (jasmineAsyncInstallExport, jestVersion) {
|
|
|
480
481
|
}
|
|
481
482
|
}
|
|
482
483
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
484
|
+
if (semver.lt(ddTraceVersion, '4.0.0')) {
|
|
485
|
+
addHook({
|
|
486
|
+
name: 'jest-jasmine2',
|
|
487
|
+
versions: ['>=24.8.0'],
|
|
488
|
+
file: 'build/jasmineAsyncInstall.js'
|
|
489
|
+
}, jasmineAsyncInstallWraper)
|
|
490
|
+
}
|
|
488
491
|
|
|
489
492
|
addHook({
|
|
490
493
|
name: 'jest-worker',
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
mergeCoverage,
|
|
11
11
|
getTestSuitePath,
|
|
12
12
|
fromCoverageMapToCoverage,
|
|
13
|
-
|
|
13
|
+
getCallSites
|
|
14
14
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
15
15
|
|
|
16
16
|
const testStartCh = channel('ci:mocha:test:start')
|
|
@@ -393,9 +393,13 @@ addHook({
|
|
|
393
393
|
file: 'lib/suite.js'
|
|
394
394
|
}, (Suite) => {
|
|
395
395
|
shimmer.wrap(Suite.prototype, 'addTest', addTest => function (test) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
const callSites = getCallSites()
|
|
397
|
+
let startLine
|
|
398
|
+
const testCallSite = callSites.find(site => site.getFileName() === test.file)
|
|
399
|
+
if (testCallSite) {
|
|
400
|
+
startLine = testCallSite.getLineNumber()
|
|
401
|
+
testToStartLine.set(test, startLine)
|
|
402
|
+
}
|
|
399
403
|
return addTest.apply(this, arguments)
|
|
400
404
|
})
|
|
401
405
|
return Suite
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
const { channel, addHook, AsyncResource } = require('./helpers/instrument')
|
|
6
6
|
const shimmer = require('../../datadog-shimmer')
|
|
7
|
+
const { MAJOR } = require('../../../version')
|
|
7
8
|
|
|
8
9
|
const startChannel = channel('apm:next:request:start')
|
|
9
10
|
const finishChannel = channel('apm:next:request:finish')
|
|
@@ -168,7 +169,11 @@ addHook({ name: 'next', versions: ['>=11.1 <13.2'], file: 'dist/server/next-serv
|
|
|
168
169
|
return nextServer
|
|
169
170
|
})
|
|
170
171
|
|
|
171
|
-
addHook({
|
|
172
|
+
addHook({
|
|
173
|
+
name: 'next',
|
|
174
|
+
versions: MAJOR >= 4 ? ['>=10.2 <11.1'] : ['>=9.5 <11.1'],
|
|
175
|
+
file: 'dist/next-server/server/next-server.js'
|
|
176
|
+
}, nextServer => {
|
|
172
177
|
const Server = nextServer.default
|
|
173
178
|
|
|
174
179
|
shimmer.wrap(Server.prototype, 'handleRequest', wrapHandleRequest)
|
|
@@ -30,9 +30,8 @@ function wrapQuery (query) {
|
|
|
30
30
|
const callbackResource = new AsyncResource('bound-anonymous-fn')
|
|
31
31
|
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
32
32
|
const processId = this.processID
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
33
|
+
|
|
34
|
+
let pgQuery = arguments[0] && typeof arguments[0] === 'object' ? arguments[0] : { text: arguments[0] }
|
|
36
35
|
|
|
37
36
|
return asyncResource.runInAsyncScope(() => {
|
|
38
37
|
startCh.publish({
|
|
@@ -41,7 +40,7 @@ function wrapQuery (query) {
|
|
|
41
40
|
processId
|
|
42
41
|
})
|
|
43
42
|
|
|
44
|
-
arguments[0] = pgQuery
|
|
43
|
+
arguments[0] = pgQuery
|
|
45
44
|
|
|
46
45
|
const finish = asyncResource.bind(function (error) {
|
|
47
46
|
if (error) {
|
|
@@ -214,10 +214,20 @@ function runnerHook (runnerExport, playwrightVersion) {
|
|
|
214
214
|
})
|
|
215
215
|
|
|
216
216
|
const runAllTestsReturn = await runAllTests.apply(this, arguments)
|
|
217
|
+
|
|
218
|
+
Object.values(remainingTestsByFile).forEach(tests => {
|
|
219
|
+
// `tests` should normally be empty, but if it isn't,
|
|
220
|
+
// there were tests that did not go through `testBegin` or `testEnd`,
|
|
221
|
+
// because they were skipped
|
|
222
|
+
tests.forEach(test => {
|
|
223
|
+
testBeginHandler(test)
|
|
224
|
+
testEndHandler(test, 'skip')
|
|
225
|
+
})
|
|
226
|
+
})
|
|
227
|
+
|
|
217
228
|
const sessionStatus = runAllTestsReturn.status || runAllTestsReturn
|
|
218
229
|
|
|
219
230
|
let onDone
|
|
220
|
-
|
|
221
231
|
const flushWait = new Promise(resolve => {
|
|
222
232
|
onDone = resolve
|
|
223
233
|
})
|
|
@@ -11,9 +11,11 @@ class Amqp10ConsumerPlugin extends ConsumerPlugin {
|
|
|
11
11
|
const source = getShortName(link)
|
|
12
12
|
const address = getAddress(link)
|
|
13
13
|
|
|
14
|
-
this.startSpan({
|
|
14
|
+
this.startSpan('amqp.receive', {
|
|
15
|
+
service: this.config.service || `${this.tracer._service}-amqp`,
|
|
15
16
|
resource: ['receive', source].filter(v => v).join(' '),
|
|
16
17
|
type: 'worker',
|
|
18
|
+
kind: 'consumer',
|
|
17
19
|
meta: {
|
|
18
20
|
'amqp.link.source.address': source,
|
|
19
21
|
'amqp.link.role': 'receiver',
|
|
@@ -13,8 +13,10 @@ class Amqp10ProducerPlugin extends ProducerPlugin {
|
|
|
13
13
|
const address = getAddress(link)
|
|
14
14
|
const target = getShortName(link)
|
|
15
15
|
|
|
16
|
-
this.startSpan({
|
|
16
|
+
this.startSpan('amqp.send', {
|
|
17
|
+
service: this.config.service || `${this.tracer._service}-amqp`,
|
|
17
18
|
resource: ['send', target].filter(v => v).join(' '),
|
|
19
|
+
kind: 'producer',
|
|
18
20
|
meta: {
|
|
19
21
|
'amqp.link.target.address': target,
|
|
20
22
|
'amqp.link.role': 'sender',
|
|
@@ -7,7 +7,6 @@ const { getResourceName } = require('./util')
|
|
|
7
7
|
|
|
8
8
|
class AmqplibClientPlugin extends ClientPlugin {
|
|
9
9
|
static get id () { return 'amqplib' }
|
|
10
|
-
static get type () { return 'messaging' }
|
|
11
10
|
static get operation () { return 'command' }
|
|
12
11
|
|
|
13
12
|
start ({ channel = {}, method, fields }) {
|
|
@@ -15,10 +14,10 @@ class AmqplibClientPlugin extends ClientPlugin {
|
|
|
15
14
|
if (method === 'basic.publish') return
|
|
16
15
|
|
|
17
16
|
const stream = (channel.connection && channel.connection.stream) || {}
|
|
18
|
-
const span = this.startSpan(
|
|
19
|
-
service: this.config.service || this.
|
|
17
|
+
const span = this.startSpan('amqp.command', {
|
|
18
|
+
service: this.config.service || `${this.tracer._service}-amqp`,
|
|
20
19
|
resource: getResourceName(method, fields),
|
|
21
|
-
kind:
|
|
20
|
+
kind: 'client',
|
|
22
21
|
meta: {
|
|
23
22
|
'out.host': stream._host,
|
|
24
23
|
[CLIENT_PORT_KEY]: stream.remotePort,
|
|
@@ -13,9 +13,11 @@ class AmqplibConsumerPlugin extends ConsumerPlugin {
|
|
|
13
13
|
|
|
14
14
|
const childOf = extract(this.tracer, message)
|
|
15
15
|
|
|
16
|
-
this.startSpan({
|
|
16
|
+
this.startSpan('amqp.command', {
|
|
17
17
|
childOf,
|
|
18
|
+
service: this.config.service || `${this.tracer._service}-amqp`,
|
|
18
19
|
resource: getResourceName(method, fields),
|
|
20
|
+
kind: 'consumer',
|
|
19
21
|
type: 'worker',
|
|
20
22
|
meta: {
|
|
21
23
|
'amqp.queue': fields.queue,
|
|
@@ -13,8 +13,10 @@ class AmqplibProducerPlugin extends ProducerPlugin {
|
|
|
13
13
|
if (method !== 'basic.publish') return
|
|
14
14
|
|
|
15
15
|
const stream = (channel.connection && channel.connection.stream) || {}
|
|
16
|
-
const span = this.startSpan({
|
|
16
|
+
const span = this.startSpan('amqp.command', {
|
|
17
|
+
service: this.config.service || `${this.tracer._service}-amqp`,
|
|
17
18
|
resource: getResourceName(method, fields),
|
|
19
|
+
kind: 'producer',
|
|
18
20
|
meta: {
|
|
19
21
|
'out.host': stream._host,
|
|
20
22
|
[CLIENT_PORT_KEY]: stream.remotePort,
|
|
@@ -38,6 +38,8 @@ class BaseAwsSdkPlugin extends Plugin {
|
|
|
38
38
|
'service.name': serviceName,
|
|
39
39
|
'aws.operation': operation,
|
|
40
40
|
'aws.region': awsRegion,
|
|
41
|
+
'region': awsRegion,
|
|
42
|
+
'aws_service': awsService,
|
|
41
43
|
'aws.service': awsService,
|
|
42
44
|
'component': 'aws-sdk'
|
|
43
45
|
}
|
|
@@ -60,6 +62,7 @@ class BaseAwsSdkPlugin extends Plugin {
|
|
|
60
62
|
const { span } = store
|
|
61
63
|
if (!span) return
|
|
62
64
|
span.setTag('aws.region', region)
|
|
65
|
+
span.setTag('region', region)
|
|
63
66
|
})
|
|
64
67
|
|
|
65
68
|
this.addSub(`apm:aws:request:complete:${this.serviceIdentifier}`, ({ response }) => {
|
|
@@ -12,7 +12,8 @@ class CloudwatchLogs extends BaseAwsSdkPlugin {
|
|
|
12
12
|
|
|
13
13
|
return Object.assign(tags, {
|
|
14
14
|
'resource.name': `${operation} ${params.logGroupName}`,
|
|
15
|
-
'aws.cloudwatch.logs.log_group_name': params.logGroupName
|
|
15
|
+
'aws.cloudwatch.logs.log_group_name': params.logGroupName,
|
|
16
|
+
'loggroupname': params.logGroupName
|
|
16
17
|
})
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -12,7 +12,8 @@ class DynamoDb extends BaseAwsSdkPlugin {
|
|
|
12
12
|
if (params.TableName) {
|
|
13
13
|
Object.assign(tags, {
|
|
14
14
|
'resource.name': `${operation} ${params.TableName}`,
|
|
15
|
-
'aws.dynamodb.table_name': params.TableName
|
|
15
|
+
'aws.dynamodb.table_name': params.TableName,
|
|
16
|
+
'tablename': params.TableName
|
|
16
17
|
})
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -27,7 +28,8 @@ class DynamoDb extends BaseAwsSdkPlugin {
|
|
|
27
28
|
// also add span type to match serverless convention
|
|
28
29
|
Object.assign(tags, {
|
|
29
30
|
'resource.name': `${operation} ${tableName}`,
|
|
30
|
-
'aws.dynamodb.table_name': tableName
|
|
31
|
+
'aws.dynamodb.table_name': tableName,
|
|
32
|
+
'tablename': tableName
|
|
31
33
|
})
|
|
32
34
|
}
|
|
33
35
|
}
|
|
@@ -7,10 +7,11 @@ class EventBridge extends BaseAwsSdkPlugin {
|
|
|
7
7
|
|
|
8
8
|
generateTags (params, operation, response) {
|
|
9
9
|
if (!params || !params.source) return {}
|
|
10
|
-
|
|
10
|
+
const rulename = params.Name ? params.Name : ''
|
|
11
11
|
return {
|
|
12
|
-
'resource.name': `${operation} ${params.source}
|
|
13
|
-
'aws.eventbridge.source': params.source
|
|
12
|
+
'resource.name': operation ? `${operation} ${params.source}` : params.source,
|
|
13
|
+
'aws.eventbridge.source': `${params.source}`,
|
|
14
|
+
'rulename': `${rulename}`
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -12,7 +12,8 @@ class Redshift extends BaseAwsSdkPlugin {
|
|
|
12
12
|
|
|
13
13
|
return Object.assign(tags, {
|
|
14
14
|
'resource.name': `${operation} ${params.ClusterIdentifier}`,
|
|
15
|
-
'aws.redshift.cluster_identifier': params.ClusterIdentifier
|
|
15
|
+
'aws.redshift.cluster_identifier': params.ClusterIdentifier,
|
|
16
|
+
'clusteridentifier': params.ClusterIdentifier
|
|
16
17
|
})
|
|
17
18
|
}
|
|
18
19
|
}
|
|
@@ -9,10 +9,17 @@ class Sns extends BaseAwsSdkPlugin {
|
|
|
9
9
|
if (!params) return {}
|
|
10
10
|
|
|
11
11
|
if (!params.TopicArn && !(response.data && response.data.TopicArn)) return {}
|
|
12
|
+
const TopicArn = params.TopicArn || response.data.TopicArn
|
|
13
|
+
// Split the ARN into its parts
|
|
14
|
+
// ex.'arn:aws:sns:us-east-1:123456789012:my-topic'
|
|
15
|
+
const arnParts = TopicArn.split(':')
|
|
12
16
|
|
|
17
|
+
// Get the topic name from the last part of the ARN
|
|
18
|
+
const topicName = arnParts[arnParts.length - 1]
|
|
13
19
|
return {
|
|
14
20
|
'resource.name': `${operation} ${params.TopicArn || response.data.TopicArn}`,
|
|
15
|
-
'aws.sns.topic_arn':
|
|
21
|
+
'aws.sns.topic_arn': TopicArn,
|
|
22
|
+
'topicname': topicName
|
|
16
23
|
}
|
|
17
24
|
|
|
18
25
|
// TODO: should arn be sanitized or quantized in some way here,
|
|
@@ -59,10 +59,16 @@ class Sqs extends BaseAwsSdkPlugin {
|
|
|
59
59
|
const tags = {}
|
|
60
60
|
|
|
61
61
|
if (!params || (!params.QueueName && !params.QueueUrl)) return tags
|
|
62
|
+
// 'https://sqs.us-east-1.amazonaws.com/123456789012/my-queue';
|
|
63
|
+
let queueName = params.QueueName
|
|
64
|
+
if (params.QueueUrl) {
|
|
65
|
+
queueName = params.QueueUrl.split('/')[params.QueueUrl.split('/').length - 1]
|
|
66
|
+
}
|
|
62
67
|
|
|
63
68
|
Object.assign(tags, {
|
|
64
69
|
'resource.name': `${operation} ${params.QueueName || params.QueueUrl}`,
|
|
65
|
-
'aws.sqs.queue_name': params.QueueName || params.QueueUrl
|
|
70
|
+
'aws.sqs.queue_name': params.QueueName || params.QueueUrl,
|
|
71
|
+
'queuename': queueName
|
|
66
72
|
})
|
|
67
73
|
|
|
68
74
|
switch (operation) {
|
|
@@ -4,16 +4,15 @@ const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
|
4
4
|
|
|
5
5
|
class GoogleCloudPubsubClientPlugin extends ClientPlugin {
|
|
6
6
|
static get id () { return 'google-cloud-pubsub' }
|
|
7
|
-
static get type () { return 'messaging' }
|
|
8
7
|
static get operation () { return 'request' }
|
|
9
8
|
|
|
10
9
|
start ({ request, api, projectId }) {
|
|
11
10
|
if (api === 'publish') return
|
|
12
11
|
|
|
13
|
-
this.startSpan(
|
|
14
|
-
service: this.config.service || this.
|
|
12
|
+
this.startSpan('pubsub.request', {
|
|
13
|
+
service: this.config.service || `${this.tracer._service}-pubsub`,
|
|
15
14
|
resource: [api, request.name].filter(x => x).join(' '),
|
|
16
|
-
kind:
|
|
15
|
+
kind: 'client',
|
|
17
16
|
meta: {
|
|
18
17
|
'pubsub.method': api,
|
|
19
18
|
'gcloud.project_id': projectId
|
|
@@ -11,9 +11,11 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
|
11
11
|
const topic = subscription.metadata && subscription.metadata.topic
|
|
12
12
|
const childOf = this.tracer.extract('text_map', message.attributes) || null
|
|
13
13
|
|
|
14
|
-
this.startSpan({
|
|
14
|
+
this.startSpan('pubsub.receive', {
|
|
15
15
|
childOf,
|
|
16
|
+
service: this.config.service,
|
|
16
17
|
resource: topic,
|
|
18
|
+
kind: 'consumer',
|
|
17
19
|
type: 'worker',
|
|
18
20
|
meta: {
|
|
19
21
|
'gcloud.project_id': subscription.pubsub.projectId,
|
|
@@ -11,8 +11,10 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
11
11
|
|
|
12
12
|
const messages = request.messages || []
|
|
13
13
|
const topic = request.topic
|
|
14
|
-
const span = this.startSpan({ // TODO: rename
|
|
14
|
+
const span = this.startSpan('pubsub.request', { // TODO: rename
|
|
15
|
+
service: this.config.service || `${this.tracer._service}-pubsub`,
|
|
15
16
|
resource: `${api} ${topic}`,
|
|
17
|
+
kind: 'producer',
|
|
16
18
|
meta: {
|
|
17
19
|
'gcloud.project_id': projectId,
|
|
18
20
|
'pubsub.method': api, // TODO: remove
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { getTestSuitePath } = require('../../dd-trace/src/plugins/util/test')
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* There are two ways to call `test.each` in `jest`:
|
|
3
5
|
* 1. With an array of arrays: https://jestjs.io/docs/api#1-testeachtablename-fn-timeout
|
|
@@ -45,4 +47,11 @@ function getJestTestName (test) {
|
|
|
45
47
|
return titles.join(' ')
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
function getJestSuitesToRun (skippableSuites, originalTests, rootDir) {
|
|
51
|
+
return originalTests.filter(({ path: testPath }) => {
|
|
52
|
+
const relativePath = getTestSuitePath(testPath, rootDir)
|
|
53
|
+
return !skippableSuites.includes(relativePath)
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = { getFormattedJestTestParameters, getJestTestName, getJestSuitesToRun }
|
|
@@ -8,9 +8,12 @@ class KafkajsConsumerPlugin extends ConsumerPlugin {
|
|
|
8
8
|
|
|
9
9
|
start ({ topic, partition, message }) {
|
|
10
10
|
const childOf = extract(this.tracer, message.headers)
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
this.startSpan('kafka.consume', {
|
|
12
13
|
childOf,
|
|
14
|
+
service: this.config.service || `${this.tracer._service}-kafka`,
|
|
13
15
|
resource: topic,
|
|
16
|
+
kind: 'consumer',
|
|
14
17
|
type: 'worker',
|
|
15
18
|
meta: {
|
|
16
19
|
'component': 'kafkajs',
|
|
@@ -30,6 +33,8 @@ function extract (tracer, bufferMap) {
|
|
|
30
33
|
const textMap = {}
|
|
31
34
|
|
|
32
35
|
for (const key of Object.keys(bufferMap)) {
|
|
36
|
+
if (bufferMap[key] === null || bufferMap[key] === undefined) continue
|
|
37
|
+
|
|
33
38
|
textMap[key] = bufferMap[key].toString()
|
|
34
39
|
}
|
|
35
40
|
|
|
@@ -7,8 +7,10 @@ class KafkajsProducerPlugin extends ProducerPlugin {
|
|
|
7
7
|
static get operation () { return 'produce' }
|
|
8
8
|
|
|
9
9
|
start ({ topic, messages }) {
|
|
10
|
-
const span = this.startSpan({
|
|
10
|
+
const span = this.startSpan('kafka.produce', {
|
|
11
|
+
service: this.config.service || `${this.tracer._service}-kafka`,
|
|
11
12
|
resource: topic,
|
|
13
|
+
kind: 'producer',
|
|
12
14
|
meta: {
|
|
13
15
|
'component': 'kafkajs',
|
|
14
16
|
'kafka.topic': topic
|