dd-trace 3.15.0 → 3.16.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/LICENSE-3rdparty.csv +1 -2
- 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/index.d.ts +6 -2
- package/package.json +18 -17
- package/packages/datadog-instrumentations/src/cucumber.js +80 -3
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +100 -27
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
- package/packages/datadog-instrumentations/src/jest.js +35 -3
- package/packages/datadog-instrumentations/src/mariadb.js +130 -11
- package/packages/datadog-instrumentations/src/mocha.js +30 -6
- package/packages/datadog-instrumentations/src/mongodb-core.js +8 -2
- package/packages/datadog-instrumentations/src/mongoose.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +32 -4
- package/packages/datadog-instrumentations/src/playwright.js +2 -2
- package/packages/datadog-plugin-amqp10/src/consumer.js +1 -1
- package/packages/datadog-plugin-amqp10/src/index.js +1 -1
- package/packages/datadog-plugin-amqp10/src/producer.js +3 -2
- package/packages/datadog-plugin-amqplib/src/client.js +3 -2
- package/packages/datadog-plugin-amqplib/src/consumer.js +1 -1
- package/packages/datadog-plugin-amqplib/src/index.js +1 -1
- package/packages/datadog-plugin-amqplib/src/producer.js +3 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +7 -2
- package/packages/datadog-plugin-aws-sdk/src/index.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +2 -0
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -0
- package/packages/datadog-plugin-bunyan/src/index.js +1 -1
- package/packages/datadog-plugin-cassandra-driver/src/index.js +3 -2
- package/packages/datadog-plugin-connect/src/index.js +1 -1
- package/packages/datadog-plugin-couchbase/src/index.js +1 -1
- package/packages/datadog-plugin-cucumber/src/index.js +33 -6
- package/packages/datadog-plugin-cypress/src/index.js +1 -1
- package/packages/datadog-plugin-cypress/src/plugin.js +40 -33
- package/packages/datadog-plugin-dns/src/index.js +1 -1
- package/packages/datadog-plugin-dns/src/lookup.js +1 -1
- package/packages/datadog-plugin-dns/src/lookup_service.js +1 -1
- package/packages/datadog-plugin-dns/src/resolve.js +1 -1
- package/packages/datadog-plugin-dns/src/reverse.js +1 -1
- package/packages/datadog-plugin-elasticsearch/src/index.js +1 -1
- package/packages/datadog-plugin-express/src/index.js +1 -1
- package/packages/datadog-plugin-fastify/src/index.js +1 -1
- package/packages/datadog-plugin-find-my-way/src/index.js +1 -1
- package/packages/datadog-plugin-fs/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +5 -5
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +1 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +7 -6
- package/packages/datadog-plugin-graphql/src/execute.js +1 -1
- package/packages/datadog-plugin-graphql/src/index.js +1 -1
- package/packages/datadog-plugin-graphql/src/parse.js +1 -1
- package/packages/datadog-plugin-graphql/src/resolve.js +1 -1
- package/packages/datadog-plugin-graphql/src/validate.js +1 -1
- package/packages/datadog-plugin-grpc/src/client.js +1 -1
- package/packages/datadog-plugin-grpc/src/index.js +1 -1
- package/packages/datadog-plugin-grpc/src/server.js +1 -1
- package/packages/datadog-plugin-hapi/src/index.js +1 -1
- package/packages/datadog-plugin-http/src/client.js +2 -2
- package/packages/datadog-plugin-http/src/index.js +1 -1
- package/packages/datadog-plugin-http/src/server.js +2 -2
- package/packages/datadog-plugin-http2/src/client.js +4 -3
- package/packages/datadog-plugin-http2/src/index.js +1 -1
- package/packages/datadog-plugin-http2/src/server.js +2 -2
- package/packages/datadog-plugin-ioredis/src/index.js +1 -1
- package/packages/datadog-plugin-jest/src/index.js +53 -19
- package/packages/datadog-plugin-kafkajs/src/consumer.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/index.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/producer.js +1 -1
- package/packages/datadog-plugin-koa/src/index.js +1 -1
- package/packages/datadog-plugin-mariadb/src/index.js +18 -1
- package/packages/datadog-plugin-memcached/src/index.js +3 -2
- package/packages/datadog-plugin-microgateway-core/src/index.js +1 -1
- package/packages/datadog-plugin-mocha/src/index.js +13 -9
- package/packages/datadog-plugin-moleculer/src/client.js +1 -1
- package/packages/datadog-plugin-moleculer/src/index.js +1 -1
- package/packages/datadog-plugin-moleculer/src/server.js +1 -1
- package/packages/datadog-plugin-mongodb-core/src/index.js +1 -1
- package/packages/datadog-plugin-mysql/src/index.js +3 -2
- package/packages/datadog-plugin-mysql2/src/index.js +1 -1
- package/packages/datadog-plugin-net/src/index.js +9 -75
- package/packages/datadog-plugin-net/src/ipc.js +1 -1
- package/packages/datadog-plugin-net/src/tcp.js +3 -2
- package/packages/datadog-plugin-next/src/index.js +3 -3
- package/packages/datadog-plugin-opensearch/src/index.js +1 -1
- package/packages/datadog-plugin-oracledb/src/index.js +3 -2
- package/packages/datadog-plugin-paperplane/src/index.js +1 -1
- package/packages/datadog-plugin-paperplane/src/logger.js +1 -1
- package/packages/datadog-plugin-paperplane/src/server.js +1 -1
- package/packages/datadog-plugin-pg/src/index.js +3 -2
- package/packages/datadog-plugin-pino/src/index.js +1 -1
- package/packages/datadog-plugin-playwright/src/index.js +5 -4
- package/packages/datadog-plugin-redis/src/index.js +3 -2
- package/packages/datadog-plugin-restify/src/index.js +1 -1
- package/packages/datadog-plugin-rhea/src/consumer.js +1 -1
- package/packages/datadog-plugin-rhea/src/index.js +1 -1
- package/packages/datadog-plugin-rhea/src/producer.js +3 -2
- package/packages/datadog-plugin-router/src/index.js +8 -8
- package/packages/datadog-plugin-sharedb/src/index.js +1 -1
- package/packages/datadog-plugin-tedious/src/index.js +3 -2
- package/packages/datadog-plugin-web/src/index.js +1 -1
- package/packages/datadog-plugin-winston/src/index.js +1 -1
- package/packages/dd-trace/src/appsec/gateway/engine/runner.js +2 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +2 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +2 -2
- package/packages/dd-trace/src/appsec/iast/iast-log.js +111 -0
- package/packages/dd-trace/src/appsec/iast/index.js +7 -4
- package/packages/dd-trace/src/appsec/iast/path-line.js +3 -6
- package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +2 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations.js +2 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/origin-types.js +2 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +2 -0
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +5 -3
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +5 -3
- package/packages/dd-trace/src/appsec/iast/telemetry/log_collector.js +96 -0
- package/packages/dd-trace/src/appsec/iast/telemetry/logs.js +87 -0
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +27 -2
- 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 +23 -4
- package/packages/dd-trace/src/constants.js +2 -1
- package/packages/dd-trace/src/datastreams/encoding.js +80 -0
- package/packages/dd-trace/src/exporter.js +7 -9
- package/packages/dd-trace/src/exporters/common/agents.js +42 -0
- package/packages/dd-trace/src/exporters/common/docker.js +4 -1
- package/packages/dd-trace/src/exporters/common/request.js +1 -4
- package/packages/dd-trace/src/lambda/handler.js +14 -6
- package/packages/dd-trace/src/opentracing/span.js +5 -0
- package/packages/dd-trace/src/plugin_manager.js +7 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +16 -16
- package/packages/dd-trace/src/plugins/index.js +1 -0
- package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
- package/packages/dd-trace/src/plugins/outgoing.js +2 -1
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +12 -0
- package/packages/dd-trace/src/plugins/util/ip_extractor.js +23 -27
- package/packages/dd-trace/src/plugins/util/test.js +26 -7
- package/packages/dd-trace/src/profiling/config.js +87 -20
- package/packages/dd-trace/src/profiling/constants.js +16 -0
- package/packages/dd-trace/src/profiling/exporter_cli.js +62 -0
- package/packages/dd-trace/src/profiling/exporters/agent.js +2 -1
- package/packages/dd-trace/src/profiling/profiler.js +21 -8
- package/packages/dd-trace/src/profiling/profilers/space.js +21 -1
- package/packages/dd-trace/src/span_sampler.js +3 -2
- package/packages/dd-trace/src/telemetry/index.js +16 -2
- package/packages/dd-trace/src/util.js +10 -1
- package/scripts/install_plugin_modules.js +5 -1
- package/scripts/junit_report.js +0 -25
- package/scripts/tdd.js +0 -34
package/LICENSE-3rdparty.csv
CHANGED
|
@@ -51,8 +51,6 @@ dev,int64-buffer,MIT,Copyright 2015-2016 Yusuke Kawasaki
|
|
|
51
51
|
dev,jszip,MIT,Copyright 2015-2016 Stuart Knightley and contributors
|
|
52
52
|
dev,mkdirp,MIT,Copyright 2010 James Halliday
|
|
53
53
|
dev,mocha,MIT,Copyright 2011-2018 JS Foundation and contributors https://js.foundation
|
|
54
|
-
dev,mocha-junit-reporter,MIT,Copyright (c) 2015 Michael Allen
|
|
55
|
-
dev,mocha-multi-reporters,MIT,Copyright 2019 Yousaf Nabi and 2015 Stanley Ng
|
|
56
54
|
dev,multer,MIT,Copyright 2014 Hage Yaapa
|
|
57
55
|
dev,msgpack-lite,MIT,Copyright 2015 Yusuke Kawasaki
|
|
58
56
|
dev,nock,MIT,Copyright 2017 Pedro Teixeira and other contributors
|
|
@@ -62,6 +60,7 @@ dev,proxyquire,MIT,Copyright 2013 Thorsten Lorenz
|
|
|
62
60
|
dev,rimraf,ISC,Copyright Isaac Z. Schlueter and Contributors
|
|
63
61
|
dev,sinon,BSD-3-Clause,Copyright 2010-2017 Christian Johansen
|
|
64
62
|
dev,sinon-chai,WTFPL and BSD-2-Clause,Copyright 2004 Sam Hocevar 2012–2017 Domenic Denicola
|
|
63
|
+
dev,tap,ISC,Copyright 2011-2022 Isaac Z. Schlueter and Contributors
|
|
65
64
|
dev,tape,MIT,Copyright James Halliday
|
|
66
65
|
dev,wait-on,MIT,Copyright 2015 Jeff Barczewski
|
|
67
66
|
file,aws-lambda-nodejs-runtime-interface-client,Apache 2.0,Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
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/index.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export declare interface Tracer extends opentracing.Tracer {
|
|
|
98
98
|
* * The function doesn't accept a callback and doesn't return a promise, in
|
|
99
99
|
* which case the span will finish at the end of the function execution.
|
|
100
100
|
*/
|
|
101
|
-
wrap<T = (...args: any[]) => any> (name: string, fn: T
|
|
101
|
+
wrap<T = (...args: any[]) => any> (name: string, fn: T): T;
|
|
102
102
|
wrap<T = (...args: any[]) => any> (name: string, options: TraceOptions & SpanOptions, fn: T): T;
|
|
103
103
|
wrap<T = (...args: any[]) => any> (name: string, options: (...args: any[]) => TraceOptions & SpanOptions, fn: T): T;
|
|
104
104
|
|
|
@@ -438,7 +438,11 @@ export declare interface TracerOptions {
|
|
|
438
438
|
* Controls how many code vulnerabilities can be detected in the same request
|
|
439
439
|
* @default 2
|
|
440
440
|
*/
|
|
441
|
-
maxContextOperations?: number
|
|
441
|
+
maxContextOperations?: number,
|
|
442
|
+
/**
|
|
443
|
+
* Whether to enable vulnerability deduplication
|
|
444
|
+
*/
|
|
445
|
+
deduplicationEnabled?: boolean
|
|
442
446
|
}
|
|
443
447
|
};
|
|
444
448
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -14,27 +14,29 @@
|
|
|
14
14
|
"type:test": "cd docs && yarn && yarn test",
|
|
15
15
|
"lint": "node scripts/check_licenses.js && eslint . && yarn audit --groups dependencies",
|
|
16
16
|
"services": "node ./scripts/install_plugin_modules && node packages/dd-trace/test/setup/services",
|
|
17
|
-
"tdd": "node scripts/tdd.js",
|
|
18
17
|
"test": "SERVICES=* yarn services && mocha --colors --exit --expose-gc 'packages/dd-trace/test/setup/node.js' 'packages/*/test/**/*.spec.js'",
|
|
19
|
-
"test:
|
|
20
|
-
"test:
|
|
21
|
-
"test:
|
|
18
|
+
"test:appsec": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" --exclude \"packages/dd-trace/test/appsec/iast/**/*.plugin.spec.js\" \"packages/dd-trace/test/appsec/**/*.spec.js\"",
|
|
19
|
+
"test:appsec:ci": "nyc --no-clean --include \"packages/dd-trace/src/appsec/**/*.js\" --exclude \"packages/dd-trace/test/appsec/iast/**/*.plugin.spec.js\" -- npm run test:appsec",
|
|
20
|
+
"test:appsec:plugins": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/appsec/iast/**/*.@($(echo $PLUGINS)).plugin.spec.js\"",
|
|
21
|
+
"test:appsec:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/test/appsec/iast/**/*.@($(echo $PLUGINS)).plugin.spec.js\" -- npm run test:appsec:plugins",
|
|
22
|
+
"test:trace:core": "tap packages/dd-trace/test/*.spec.js \"packages/dd-trace/test/{ci-visibility,encode,exporters,opentracing,plugins,telemetry}/**/*.spec.js\"",
|
|
23
|
+
"test:trace:core:ci": "npm run test:trace:core -- --coverage --nyc-arg=--include=\"packages/dd-trace/src/**/*.js\"",
|
|
24
|
+
"test:instrumentations": "mocha --colors -r 'packages/dd-trace/test/setup/mocha.js' 'packages/datadog-instrumentations/test/**/*.spec.js'",
|
|
22
25
|
"test:instrumentations:ci": "nyc --no-clean --include 'packages/datadog-instrumentations/src/**/*.js' -- npm run test:instrumentations",
|
|
23
|
-
"test:core": "
|
|
24
|
-
"test:core:ci": "
|
|
25
|
-
"test:lambda": "mocha --colors --exit
|
|
26
|
+
"test:core": "tap \"packages/datadog-core/test/**/*.spec.js\"",
|
|
27
|
+
"test:core:ci": "npm run test:core -- --coverage --nyc-arg=--include=\"packages/datadog-core/src/**/*.js\"",
|
|
28
|
+
"test:lambda": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/lambda/**/*.spec.js\"",
|
|
26
29
|
"test:lambda:ci": "nyc --no-clean --include \"packages/dd-trace/src/lambda/**/*.js\" -- npm run test:lambda",
|
|
27
|
-
"test:plugins": "mocha --colors --exit
|
|
28
|
-
"test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS)).js\" --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS))/**/*.js\" --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" --
|
|
30
|
+
"test:plugins": "mocha --colors --exit -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-instrumentations/test/@($(echo $PLUGINS)).spec.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\"",
|
|
31
|
+
"test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS)).js\" --include \"packages/datadog-instrumentations/src/@($(echo $PLUGINS))/**/*.js\" --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins",
|
|
29
32
|
"test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
|
|
30
|
-
"test:profiler": "
|
|
31
|
-
"test:profiler:ci": "
|
|
33
|
+
"test:profiler": "tap \"packages/dd-trace/test/profiling/**/*.spec.js\"",
|
|
34
|
+
"test:profiler:ci": "npm run test:profiler -- --coverage --nyc-arg=--include=\"packages/dd-trace/src/profiling/**/*.js\"",
|
|
32
35
|
"test:integration": "mocha --colors --timeout 30000 \"integration-tests/**/*.spec.js\"",
|
|
33
36
|
"test:shimmer": "mocha --colors 'packages/datadog-shimmer/test/**/*.spec.js'",
|
|
34
37
|
"test:shimmer:ci": "nyc --no-clean --include 'packages/datadog-shimmer/src/**/*.js' -- npm run test:shimmer",
|
|
35
38
|
"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'",
|
|
36
|
-
"leak:plugins": "yarn services && (cd packages/memwatch && yarn) && NODE_PATH=./packages/memwatch/node_modules node --no-warnings ./node_modules/.bin/tape \"packages/datadog-plugin-@($(echo $PLUGINS))/test/leak.js\""
|
|
37
|
-
"junit:upload": "node ./scripts/junit_report.js"
|
|
39
|
+
"leak:plugins": "yarn services && (cd packages/memwatch && yarn) && NODE_PATH=./packages/memwatch/node_modules node --no-warnings ./node_modules/.bin/tape \"packages/datadog-plugin-@($(echo $PLUGINS))/test/leak.js\""
|
|
38
40
|
},
|
|
39
41
|
"repository": {
|
|
40
42
|
"type": "git",
|
|
@@ -64,7 +66,7 @@
|
|
|
64
66
|
"@datadog/native-iast-rewriter": "2.0.1",
|
|
65
67
|
"@datadog/native-iast-taint-tracking": "1.1.1",
|
|
66
68
|
"@datadog/native-metrics": "^1.5.0",
|
|
67
|
-
"@datadog/pprof": "^2.
|
|
69
|
+
"@datadog/pprof": "^2.1.0",
|
|
68
70
|
"@datadog/sketches-js": "^2.1.0",
|
|
69
71
|
"crypto-randomuuid": "^1.0.0",
|
|
70
72
|
"diagnostics_channel": "^1.1.0",
|
|
@@ -114,8 +116,6 @@
|
|
|
114
116
|
"jszip": "^3.5.0",
|
|
115
117
|
"mkdirp": "^0.5.1",
|
|
116
118
|
"mocha": "8",
|
|
117
|
-
"mocha-junit-reporter": "^2.1.0",
|
|
118
|
-
"mocha-multi-reporters": "^1.5.1",
|
|
119
119
|
"msgpack-lite": "^0.1.26",
|
|
120
120
|
"multer": "^1.4.5-lts.1",
|
|
121
121
|
"nock": "^11.3.3",
|
|
@@ -125,6 +125,7 @@
|
|
|
125
125
|
"rimraf": "^3.0.0",
|
|
126
126
|
"sinon": "^11.1.2",
|
|
127
127
|
"sinon-chai": "^3.7.0",
|
|
128
|
+
"tap": "^16.3.4",
|
|
128
129
|
"tape": "^4.9.1",
|
|
129
130
|
"wait-on": "^5.0.0"
|
|
130
131
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
const { createCoverageMap } = require('istanbul-lib-coverage')
|
|
2
3
|
|
|
3
4
|
const { addHook, channel, AsyncResource } = require('./helpers/instrument')
|
|
4
5
|
const shimmer = require('../../datadog-shimmer')
|
|
@@ -12,10 +13,24 @@ const errorCh = channel('ci:cucumber:error')
|
|
|
12
13
|
|
|
13
14
|
const testSuiteStartCh = channel('ci:cucumber:test-suite:start')
|
|
14
15
|
const testSuiteFinishCh = channel('ci:cucumber:test-suite:finish')
|
|
16
|
+
const testSuiteCodeCoverageCh = channel('ci:cucumber:test-suite:code-coverage')
|
|
15
17
|
|
|
18
|
+
const itrConfigurationCh = channel('ci:cucumber:itr-configuration')
|
|
19
|
+
const skippableSuitesCh = channel('ci:cucumber:test-suite:skippable')
|
|
16
20
|
const sessionStartCh = channel('ci:cucumber:session:start')
|
|
17
21
|
const sessionFinishCh = channel('ci:cucumber:session:finish')
|
|
18
22
|
|
|
23
|
+
const {
|
|
24
|
+
getCoveredFilenamesFromCoverage,
|
|
25
|
+
resetCoverage,
|
|
26
|
+
mergeCoverage,
|
|
27
|
+
fromCoverageMapToCoverage,
|
|
28
|
+
getTestSuitePath
|
|
29
|
+
} = require('../../dd-trace/src/plugins/util/test')
|
|
30
|
+
|
|
31
|
+
// We'll preserve the original coverage here
|
|
32
|
+
const originalCoverageMap = createCoverageMap()
|
|
33
|
+
|
|
19
34
|
// TODO: remove in a later major version
|
|
20
35
|
const patched = new WeakSet()
|
|
21
36
|
|
|
@@ -88,12 +103,25 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
88
103
|
} else {
|
|
89
104
|
pickleResultByFile[testSuiteFullPath].push(status)
|
|
90
105
|
}
|
|
106
|
+
testFinishCh.publish({ status, skipReason, errorMessage })
|
|
91
107
|
// last test in suite
|
|
92
108
|
if (pickleResultByFile[testSuiteFullPath].length === pickleByFile[testSuiteFullPath].length) {
|
|
93
109
|
const testSuiteStatus = getSuiteStatusFromTestStatuses(pickleResultByFile[testSuiteFullPath])
|
|
110
|
+
if (global.__coverage__) {
|
|
111
|
+
const coverageFiles = getCoveredFilenamesFromCoverage(global.__coverage__)
|
|
112
|
+
|
|
113
|
+
testSuiteCodeCoverageCh.publish({
|
|
114
|
+
coverageFiles,
|
|
115
|
+
suiteFile: testSuiteFullPath
|
|
116
|
+
})
|
|
117
|
+
// We need to reset coverage to get a code coverage per suite
|
|
118
|
+
// Before that, we preserve the original coverage
|
|
119
|
+
mergeCoverage(global.__coverage__, originalCoverageMap)
|
|
120
|
+
resetCoverage(global.__coverage__)
|
|
121
|
+
}
|
|
122
|
+
|
|
94
123
|
testSuiteFinishCh.publish(testSuiteStatus)
|
|
95
124
|
}
|
|
96
|
-
testFinishCh.publish({ status, skipReason, errorMessage })
|
|
97
125
|
})
|
|
98
126
|
return promise
|
|
99
127
|
} catch (err) {
|
|
@@ -164,6 +192,13 @@ addHook({
|
|
|
164
192
|
file: 'lib/runtime/test_case_runner.js'
|
|
165
193
|
}, testCaseHook)
|
|
166
194
|
|
|
195
|
+
function getPicklesToRun (runtime, suitesToSkip) {
|
|
196
|
+
return runtime.pickleIds.filter((pickleId) => {
|
|
197
|
+
const test = runtime.eventDataCollector.getPickle(pickleId)
|
|
198
|
+
return !suitesToSkip.includes(getTestSuitePath(test.uri, process.cwd()))
|
|
199
|
+
}, {})
|
|
200
|
+
}
|
|
201
|
+
|
|
167
202
|
function getPickleByFile (runtime) {
|
|
168
203
|
return runtime.pickleIds.reduce((acc, pickleId) => {
|
|
169
204
|
const test = runtime.eventDataCollector.getPickle(pickleId)
|
|
@@ -182,19 +217,61 @@ addHook({
|
|
|
182
217
|
file: 'lib/runtime/index.js'
|
|
183
218
|
}, (runtimePackage, cucumberVersion) => {
|
|
184
219
|
shimmer.wrap(runtimePackage.default.prototype, 'start', start => async function () {
|
|
220
|
+
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
221
|
+
let onDone
|
|
222
|
+
|
|
223
|
+
const configPromise = new Promise(resolve => {
|
|
224
|
+
onDone = resolve
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
asyncResource.runInAsyncScope(() => {
|
|
228
|
+
itrConfigurationCh.publish({ onDone })
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
await configPromise
|
|
232
|
+
|
|
233
|
+
const skippableSuitesPromise = new Promise(resolve => {
|
|
234
|
+
onDone = resolve
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
asyncResource.runInAsyncScope(() => {
|
|
238
|
+
skippableSuitesCh.publish({ onDone })
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
const { err, skippableSuites } = await skippableSuitesPromise
|
|
242
|
+
|
|
243
|
+
if (!err) {
|
|
244
|
+
this.pickleIds = getPicklesToRun(this, skippableSuites)
|
|
245
|
+
}
|
|
246
|
+
|
|
185
247
|
pickleByFile = getPickleByFile(this)
|
|
186
248
|
|
|
187
249
|
const processArgv = process.argv.slice(2).join(' ')
|
|
188
250
|
const command = process.env.npm_lifecycle_script || `cucumber-js ${processArgv}`
|
|
189
251
|
|
|
190
|
-
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
191
252
|
asyncResource.runInAsyncScope(() => {
|
|
192
253
|
sessionStartCh.publish({ command, frameworkVersion: cucumberVersion })
|
|
193
254
|
})
|
|
194
255
|
const success = await start.apply(this, arguments)
|
|
195
256
|
|
|
257
|
+
let testCodeCoverageLinesTotal
|
|
258
|
+
|
|
259
|
+
if (global.__coverage__) {
|
|
260
|
+
try {
|
|
261
|
+
testCodeCoverageLinesTotal = originalCoverageMap.getCoverageSummary().lines.pct
|
|
262
|
+
} catch (e) {
|
|
263
|
+
// ignore errors
|
|
264
|
+
}
|
|
265
|
+
// restore the original coverage
|
|
266
|
+
global.__coverage__ = fromCoverageMapToCoverage(originalCoverageMap)
|
|
267
|
+
}
|
|
268
|
+
|
|
196
269
|
asyncResource.runInAsyncScope(() => {
|
|
197
|
-
sessionFinishCh.publish(
|
|
270
|
+
sessionFinishCh.publish({
|
|
271
|
+
status: success ? 'pass' : 'fail',
|
|
272
|
+
isSuitesSkipped: skippableSuites ? !!skippableSuites.length : false,
|
|
273
|
+
testCodeCoverageLinesTotal
|
|
274
|
+
})
|
|
198
275
|
})
|
|
199
276
|
return success
|
|
200
277
|
})
|
|
@@ -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
|
+
})
|
|
@@ -47,6 +47,7 @@ module.exports = {
|
|
|
47
47
|
'jest-environment-node': () => require('../jest'),
|
|
48
48
|
'jest-environment-jsdom': () => require('../jest'),
|
|
49
49
|
'jest-jasmine2': () => require('../jest'),
|
|
50
|
+
'jest-worker': () => require('../jest'),
|
|
50
51
|
'koa': () => require('../koa'),
|
|
51
52
|
'koa-router': () => require('../koa'),
|
|
52
53
|
'kafkajs': () => require('../kafkajs'),
|
|
@@ -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')
|
|
@@ -11,6 +15,10 @@ const testSessionConfigurationCh = channel('ci:jest:session:configuration')
|
|
|
11
15
|
|
|
12
16
|
const testSuiteStartCh = channel('ci:jest:test-suite:start')
|
|
13
17
|
const testSuiteFinishCh = channel('ci:jest:test-suite:finish')
|
|
18
|
+
|
|
19
|
+
const workerReportTraceCh = channel('ci:jest:worker-report:trace')
|
|
20
|
+
const workerReportCoverageCh = channel('ci:jest:worker-report:coverage')
|
|
21
|
+
|
|
14
22
|
const testSuiteCodeCoverageCh = channel('ci:jest:test-suite:code-coverage')
|
|
15
23
|
|
|
16
24
|
const testStartCh = channel('ci:jest:test:start')
|
|
@@ -214,7 +222,6 @@ function cliWrapper (cli, jestVersion) {
|
|
|
214
222
|
log.error(err)
|
|
215
223
|
}
|
|
216
224
|
}
|
|
217
|
-
|
|
218
225
|
const isSuitesSkipped = !!skippableSuites.length
|
|
219
226
|
|
|
220
227
|
const processArgv = process.argv.slice(2).join(' ')
|
|
@@ -309,7 +316,6 @@ function jestAdapterWrapper (jestAdapter, jestVersion) {
|
|
|
309
316
|
} else if (numFailingTests !== 0) {
|
|
310
317
|
status = 'fail'
|
|
311
318
|
}
|
|
312
|
-
testSuiteFinishCh.publish({ status, errorMessage })
|
|
313
319
|
|
|
314
320
|
const coverageFiles = getCoveredFilenamesFromCoverage(environment.global.__coverage__)
|
|
315
321
|
.map(filename => getTestSuitePath(filename, environment.rootDir))
|
|
@@ -326,6 +332,7 @@ function jestAdapterWrapper (jestAdapter, jestVersion) {
|
|
|
326
332
|
testSuiteCodeCoverageCh.publish([...coverageFiles, environment.testSuite])
|
|
327
333
|
})
|
|
328
334
|
}
|
|
335
|
+
testSuiteFinishCh.publish({ status, errorMessage })
|
|
329
336
|
return suiteResults
|
|
330
337
|
})
|
|
331
338
|
})
|
|
@@ -475,3 +482,28 @@ addHook({
|
|
|
475
482
|
versions: ['>=24.8.0'],
|
|
476
483
|
file: 'build/jasmineAsyncInstall.js'
|
|
477
484
|
}, jasmineAsyncInstallWraper)
|
|
485
|
+
|
|
486
|
+
addHook({
|
|
487
|
+
name: 'jest-worker',
|
|
488
|
+
versions: ['>=24.9.0'],
|
|
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)
|
|
497
|
+
})
|
|
498
|
+
return
|
|
499
|
+
}
|
|
500
|
+
if (code === JEST_WORKER_COVERAGE_PAYLOAD_CODE) { // datadog coverage payload
|
|
501
|
+
sessionAsyncResource.runInAsyncScope(() => {
|
|
502
|
+
workerReportCoverageCh.publish(data)
|
|
503
|
+
})
|
|
504
|
+
return
|
|
505
|
+
}
|
|
506
|
+
return _onMessage.apply(this, arguments)
|
|
507
|
+
})
|
|
508
|
+
return childProcessWorker
|
|
509
|
+
})
|