dd-trace 2.27.1 → 2.29.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 +2 -2
- package/README.md +9 -5
- package/ci/init.js +9 -1
- package/ext/exporters.d.ts +2 -1
- package/ext/exporters.js +2 -1
- package/index.d.ts +36 -3
- package/package.json +21 -19
- 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/ldapjs.js +12 -2
- 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 +33 -4
- package/packages/datadog-instrumentations/src/playwright.js +42 -13
- 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 +3 -3
- 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 +3 -3
- 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/addresses.js +3 -1
- package/packages/dd-trace/src/appsec/blocking.js +35 -9
- 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-context.js +6 -2
- package/packages/dd-trace/src/appsec/iast/iast-log.js +111 -0
- package/packages/dd-trace/src/appsec/iast/index.js +10 -6
- 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 +9 -4
- 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/appsec/index.js +4 -4
- package/packages/dd-trace/src/appsec/recommended.json +76 -75
- package/packages/dd-trace/src/appsec/remote_config/capabilities.js +2 -1
- package/packages/dd-trace/src/appsec/remote_config/index.js +3 -0
- package/packages/dd-trace/src/appsec/sdk/index.js +19 -1
- package/packages/dd-trace/src/appsec/sdk/noop.js +6 -0
- package/packages/dd-trace/src/appsec/sdk/set_user.js +30 -0
- package/packages/dd-trace/src/appsec/sdk/track_event.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +73 -0
- 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 +17 -9
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +14 -8
- 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 +12 -4
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +12 -4
- package/packages/dd-trace/src/config.js +24 -5
- 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 +19 -12
- package/packages/dd-trace/src/log/writer.js +32 -24
- package/packages/dd-trace/src/metrics.js +18 -0
- package/packages/dd-trace/src/noop/proxy.js +2 -2
- package/packages/dd-trace/src/opentracing/span.js +5 -0
- package/packages/dd-trace/src/opentracing/span_context.js +1 -1
- package/packages/dd-trace/src/plugin_manager.js +7 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +20 -17
- 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/exec.js +2 -2
- package/packages/dd-trace/src/plugins/util/git.js +16 -1
- 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/profiler.js +3 -0
- package/packages/dd-trace/src/profiling/config.js +92 -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/exporters/file.js +13 -2
- package/packages/dd-trace/src/profiling/profiler.js +42 -12
- package/packages/dd-trace/src/profiling/profilers/space.js +21 -1
- package/packages/dd-trace/src/profiling/profilers/wall.js +1 -0
- package/packages/dd-trace/src/proxy.js +1 -1
- package/packages/dd-trace/src/span_processor.js +1 -1
- package/packages/dd-trace/src/span_sampler.js +71 -54
- package/packages/dd-trace/src/startup-log.js +3 -6
- package/packages/dd-trace/src/telemetry/index.js +16 -2
- package/packages/dd-trace/src/tracer.js +0 -16
- 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
|
@@ -1,9 +1,10 @@
|
|
|
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 {
|
|
6
|
-
static get
|
|
7
|
+
static get id () { return 'cassandra-driver' }
|
|
7
8
|
static get system () { return 'cassandra' }
|
|
8
9
|
|
|
9
10
|
start ({ keyspace, query, connectionOptions = {} }) {
|
|
@@ -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
|
}
|
|
@@ -8,13 +8,14 @@ const {
|
|
|
8
8
|
TEST_STATUS,
|
|
9
9
|
finishAllTraceSpans,
|
|
10
10
|
getTestSuitePath,
|
|
11
|
-
getTestSuiteCommonTags
|
|
11
|
+
getTestSuiteCommonTags,
|
|
12
|
+
addIntelligentTestRunnerSpanTags
|
|
12
13
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
13
14
|
const { RESOURCE_NAME } = require('../../../ext/tags')
|
|
14
15
|
const { COMPONENT, ERROR_MESSAGE } = require('../../dd-trace/src/constants')
|
|
15
16
|
|
|
16
17
|
class CucumberPlugin extends CiPlugin {
|
|
17
|
-
static get
|
|
18
|
+
static get id () {
|
|
18
19
|
return 'cucumber'
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -23,12 +24,21 @@ class CucumberPlugin extends CiPlugin {
|
|
|
23
24
|
|
|
24
25
|
this.sourceRoot = process.cwd()
|
|
25
26
|
|
|
26
|
-
this.addSub('ci:cucumber:session:finish', (status) => {
|
|
27
|
+
this.addSub('ci:cucumber:session:finish', ({ status, isSuitesSkipped, testCodeCoverageLinesTotal }) => {
|
|
28
|
+
const { isSuitesSkippingEnabled, isCodeCoverageEnabled } = this.itrConfig || {}
|
|
29
|
+
addIntelligentTestRunnerSpanTags(
|
|
30
|
+
this.testSessionSpan,
|
|
31
|
+
this.testModuleSpan,
|
|
32
|
+
{ isSuitesSkipped, isSuitesSkippingEnabled, isCodeCoverageEnabled, testCodeCoverageLinesTotal }
|
|
33
|
+
)
|
|
34
|
+
|
|
27
35
|
this.testSessionSpan.setTag(TEST_STATUS, status)
|
|
28
36
|
this.testModuleSpan.setTag(TEST_STATUS, status)
|
|
29
37
|
this.testModuleSpan.finish()
|
|
30
38
|
this.testSessionSpan.finish()
|
|
31
39
|
finishAllTraceSpans(this.testSessionSpan)
|
|
40
|
+
|
|
41
|
+
this.itrConfig = null
|
|
32
42
|
this.tracer._exporter.flush()
|
|
33
43
|
})
|
|
34
44
|
|
|
@@ -36,12 +46,13 @@ class CucumberPlugin extends CiPlugin {
|
|
|
36
46
|
const testSuiteMetadata = getTestSuiteCommonTags(
|
|
37
47
|
this.command,
|
|
38
48
|
this.frameworkVersion,
|
|
39
|
-
getTestSuitePath(testSuiteFullPath, this.sourceRoot)
|
|
49
|
+
getTestSuitePath(testSuiteFullPath, this.sourceRoot),
|
|
50
|
+
'cucumber'
|
|
40
51
|
)
|
|
41
52
|
this.testSuiteSpan = this.tracer.startSpan('cucumber.test_suite', {
|
|
42
53
|
childOf: this.testModuleSpan,
|
|
43
54
|
tags: {
|
|
44
|
-
[COMPONENT]: this.constructor.
|
|
55
|
+
[COMPONENT]: this.constructor.id,
|
|
45
56
|
...this.testEnvironmentMetadata,
|
|
46
57
|
...testSuiteMetadata
|
|
47
58
|
}
|
|
@@ -53,6 +64,22 @@ class CucumberPlugin extends CiPlugin {
|
|
|
53
64
|
this.testSuiteSpan.finish()
|
|
54
65
|
})
|
|
55
66
|
|
|
67
|
+
this.addSub('ci:cucumber:test-suite:code-coverage', ({ coverageFiles, suiteFile }) => {
|
|
68
|
+
if (!this.itrConfig || !this.itrConfig.isCodeCoverageEnabled) {
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
const relativeCoverageFiles = [...coverageFiles, suiteFile]
|
|
72
|
+
.map(filename => getTestSuitePath(filename, this.sourceRoot))
|
|
73
|
+
|
|
74
|
+
const formattedCoverage = {
|
|
75
|
+
traceId: this.testSuiteSpan.context()._traceId,
|
|
76
|
+
spanId: this.testSuiteSpan.context()._spanId,
|
|
77
|
+
files: relativeCoverageFiles
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.tracer._exporter.exportCoverage(formattedCoverage)
|
|
81
|
+
})
|
|
82
|
+
|
|
56
83
|
this.addSub('ci:cucumber:test:start', ({ testName, fullTestSuite }) => {
|
|
57
84
|
const store = storage.getStore()
|
|
58
85
|
const testSuite = getTestSuitePath(fullTestSuite, this.sourceRoot)
|
|
@@ -67,7 +94,7 @@ class CucumberPlugin extends CiPlugin {
|
|
|
67
94
|
const span = this.tracer.startSpan('cucumber.step', {
|
|
68
95
|
childOf,
|
|
69
96
|
tags: {
|
|
70
|
-
[COMPONENT]: this.constructor.
|
|
97
|
+
[COMPONENT]: this.constructor.id,
|
|
71
98
|
'cucumber.step': resource,
|
|
72
99
|
[RESOURCE_NAME]: resource
|
|
73
100
|
}
|
|
@@ -3,7 +3,7 @@ const Plugin = require('../../dd-trace/src/plugins/plugin')
|
|
|
3
3
|
// Cypress plugin does not patch any library. This is just a placeholder to
|
|
4
4
|
// follow the structure of the plugins
|
|
5
5
|
class CypressPlugin extends Plugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () {
|
|
7
7
|
return 'cypress'
|
|
8
8
|
}
|
|
9
9
|
}
|
|
@@ -15,10 +15,12 @@ const {
|
|
|
15
15
|
TEST_MODULE_ID,
|
|
16
16
|
TEST_SESSION_ID,
|
|
17
17
|
TEST_COMMAND,
|
|
18
|
-
|
|
18
|
+
TEST_MODULE,
|
|
19
19
|
finishAllTraceSpans
|
|
20
20
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
21
21
|
|
|
22
|
+
const TEST_FRAMEWORK_NAME = 'cypress'
|
|
23
|
+
|
|
22
24
|
const { ORIGIN_KEY, COMPONENT } = require('../../dd-trace/src/constants')
|
|
23
25
|
|
|
24
26
|
const CYPRESS_STATUS_TO_TEST_STATUS = {
|
|
@@ -51,9 +53,9 @@ function getCypressVersion (details) {
|
|
|
51
53
|
|
|
52
54
|
function getCypressCommand (details) {
|
|
53
55
|
if (!details) {
|
|
54
|
-
return
|
|
56
|
+
return TEST_FRAMEWORK_NAME
|
|
55
57
|
}
|
|
56
|
-
return
|
|
58
|
+
return `${TEST_FRAMEWORK_NAME} ${details.specPattern || ''}`
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
function getSessionStatus (summary) {
|
|
@@ -78,7 +80,7 @@ function getSuiteStatus (suiteStats) {
|
|
|
78
80
|
|
|
79
81
|
module.exports = (on, config) => {
|
|
80
82
|
const tracer = require('../../dd-trace')
|
|
81
|
-
const testEnvironmentMetadata = getTestEnvironmentMetadata(
|
|
83
|
+
const testEnvironmentMetadata = getTestEnvironmentMetadata(TEST_FRAMEWORK_NAME)
|
|
82
84
|
|
|
83
85
|
const codeOwnersEntries = getCodeOwnersFileEntries()
|
|
84
86
|
|
|
@@ -95,21 +97,21 @@ module.exports = (on, config) => {
|
|
|
95
97
|
command = getCypressCommand(details)
|
|
96
98
|
frameworkVersion = getCypressVersion(details)
|
|
97
99
|
|
|
98
|
-
const testSessionSpanMetadata = getTestSessionCommonTags(command, frameworkVersion)
|
|
99
|
-
const testModuleSpanMetadata = getTestModuleCommonTags(command, frameworkVersion)
|
|
100
|
+
const testSessionSpanMetadata = getTestSessionCommonTags(command, frameworkVersion, TEST_FRAMEWORK_NAME)
|
|
101
|
+
const testModuleSpanMetadata = getTestModuleCommonTags(command, frameworkVersion, TEST_FRAMEWORK_NAME)
|
|
100
102
|
|
|
101
|
-
testSessionSpan = tracer.startSpan(
|
|
103
|
+
testSessionSpan = tracer.startSpan(`${TEST_FRAMEWORK_NAME}.test_session`, {
|
|
102
104
|
childOf,
|
|
103
105
|
tags: {
|
|
104
|
-
[COMPONENT]:
|
|
106
|
+
[COMPONENT]: TEST_FRAMEWORK_NAME,
|
|
105
107
|
...testEnvironmentMetadata,
|
|
106
108
|
...testSessionSpanMetadata
|
|
107
109
|
}
|
|
108
110
|
})
|
|
109
|
-
testModuleSpan = tracer.startSpan(
|
|
111
|
+
testModuleSpan = tracer.startSpan(`${TEST_FRAMEWORK_NAME}.test_module`, {
|
|
110
112
|
childOf: testSessionSpan,
|
|
111
113
|
tags: {
|
|
112
|
-
[COMPONENT]:
|
|
114
|
+
[COMPONENT]: TEST_FRAMEWORK_NAME,
|
|
113
115
|
...testEnvironmentMetadata,
|
|
114
116
|
...testModuleSpanMetadata
|
|
115
117
|
}
|
|
@@ -117,14 +119,16 @@ module.exports = (on, config) => {
|
|
|
117
119
|
})
|
|
118
120
|
|
|
119
121
|
on('after:run', (suiteStats) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
if (testSessionSpan && testModuleSpan) {
|
|
123
|
+
const testStatus = getSessionStatus(suiteStats)
|
|
124
|
+
testModuleSpan.setTag(TEST_STATUS, testStatus)
|
|
125
|
+
testSessionSpan.setTag(TEST_STATUS, testStatus)
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
testModuleSpan.finish()
|
|
128
|
+
testSessionSpan.finish()
|
|
126
129
|
|
|
127
|
-
|
|
130
|
+
finishAllTraceSpans(testSessionSpan)
|
|
131
|
+
}
|
|
128
132
|
|
|
129
133
|
return new Promise(resolve => {
|
|
130
134
|
tracer._tracer._exporter._writer.flush(() => {
|
|
@@ -137,11 +141,11 @@ module.exports = (on, config) => {
|
|
|
137
141
|
if (testSuiteSpan) {
|
|
138
142
|
return null
|
|
139
143
|
}
|
|
140
|
-
const testSuiteSpanMetadata = getTestSuiteCommonTags(command, frameworkVersion, suite)
|
|
141
|
-
testSuiteSpan = tracer.startSpan(
|
|
144
|
+
const testSuiteSpanMetadata = getTestSuiteCommonTags(command, frameworkVersion, suite, TEST_FRAMEWORK_NAME)
|
|
145
|
+
testSuiteSpan = tracer.startSpan(`${TEST_FRAMEWORK_NAME}.test_suite`, {
|
|
142
146
|
childOf: testModuleSpan,
|
|
143
147
|
tags: {
|
|
144
|
-
[COMPONENT]:
|
|
148
|
+
[COMPONENT]: TEST_FRAMEWORK_NAME,
|
|
145
149
|
...testEnvironmentMetadata,
|
|
146
150
|
...testSuiteSpanMetadata
|
|
147
151
|
}
|
|
@@ -149,25 +153,28 @@ module.exports = (on, config) => {
|
|
|
149
153
|
return null
|
|
150
154
|
},
|
|
151
155
|
'dd:testSuiteFinish': (suiteStats) => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
if (testSuiteSpan) {
|
|
157
|
+
const status = getSuiteStatus(suiteStats)
|
|
158
|
+
testSuiteSpan.setTag(TEST_STATUS, status)
|
|
159
|
+
testSuiteSpan.finish()
|
|
160
|
+
testSuiteSpan = null
|
|
161
|
+
}
|
|
156
162
|
return null
|
|
157
163
|
},
|
|
158
164
|
'dd:beforeEach': (test) => {
|
|
159
165
|
const { testName, testSuite } = test
|
|
160
|
-
const testSuiteId = testSuiteSpan.context().toSpanId()
|
|
161
|
-
const testSessionId = testSessionSpan.context().toTraceId()
|
|
162
|
-
const testModuleId = testModuleSpan.context().toSpanId()
|
|
163
166
|
|
|
164
167
|
const testSuiteTags = {
|
|
165
|
-
[TEST_SUITE_ID]: testSuiteId,
|
|
166
|
-
[TEST_SESSION_ID]: testSessionId,
|
|
167
168
|
[TEST_COMMAND]: command,
|
|
168
|
-
[TEST_MODULE_ID]: testModuleId,
|
|
169
169
|
[TEST_COMMAND]: command,
|
|
170
|
-
[
|
|
170
|
+
[TEST_MODULE]: TEST_FRAMEWORK_NAME
|
|
171
|
+
}
|
|
172
|
+
if (testSuiteSpan) {
|
|
173
|
+
testSuiteTags[TEST_SUITE_ID] = testSuiteSpan.context().toSpanId()
|
|
174
|
+
}
|
|
175
|
+
if (testSessionSpan && testModuleSpan) {
|
|
176
|
+
testSuiteTags[TEST_SESSION_ID] = testSessionSpan.context().toTraceId()
|
|
177
|
+
testSuiteTags[TEST_MODULE_ID] = testModuleSpan.context().toSpanId()
|
|
171
178
|
}
|
|
172
179
|
|
|
173
180
|
const {
|
|
@@ -183,10 +190,10 @@ module.exports = (on, config) => {
|
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
if (!activeSpan) {
|
|
186
|
-
activeSpan = tracer.startSpan(
|
|
193
|
+
activeSpan = tracer.startSpan(`${TEST_FRAMEWORK_NAME}.test`, {
|
|
187
194
|
childOf,
|
|
188
195
|
tags: {
|
|
189
|
-
[COMPONENT]:
|
|
196
|
+
[COMPONENT]: TEST_FRAMEWORK_NAME,
|
|
190
197
|
[ORIGIN_KEY]: CI_APP_ORIGIN,
|
|
191
198
|
...testSpanMetadata,
|
|
192
199
|
...testEnvironmentMetadata,
|
|
@@ -194,7 +201,7 @@ module.exports = (on, config) => {
|
|
|
194
201
|
}
|
|
195
202
|
})
|
|
196
203
|
}
|
|
197
|
-
return activeSpan ? activeSpan.
|
|
204
|
+
return activeSpan ? activeSpan.context().toTraceId() : null
|
|
198
205
|
},
|
|
199
206
|
'dd:afterEach': (test) => {
|
|
200
207
|
const { state, error, isRUMActive } = test
|
|
@@ -9,7 +9,7 @@ const DNSReversePlugin = require('./reverse')
|
|
|
9
9
|
// TODO: Are DNS spans really client spans?
|
|
10
10
|
|
|
11
11
|
class DNSPlugin extends CompositePlugin {
|
|
12
|
-
static get
|
|
12
|
+
static get id () { return 'dns' }
|
|
13
13
|
static get plugins () {
|
|
14
14
|
return {
|
|
15
15
|
lookup: DNSLookupPlugin,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
4
4
|
|
|
5
5
|
class DNSLookupServicePlugin extends ClientPlugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () { return 'dns' }
|
|
7
7
|
static get operation () { return 'lookup_service' }
|
|
8
8
|
|
|
9
9
|
start ([address, port]) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
4
4
|
|
|
5
5
|
class DNSResolvePlugin extends ClientPlugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () { return 'dns' }
|
|
7
7
|
static get operation () { return 'resolve' }
|
|
8
8
|
|
|
9
9
|
start ([hostname, maybeType]) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
4
4
|
|
|
5
5
|
class ElasticsearchPlugin extends DatabasePlugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () { return 'elasticsearch' }
|
|
7
7
|
|
|
8
8
|
start ({ params }) {
|
|
9
9
|
const body = getBody(params.body || params.bulkBody)
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
const ClientPlugin = require('../../dd-trace/src/plugins/client')
|
|
4
4
|
|
|
5
5
|
class GoogleCloudPubsubClientPlugin extends ClientPlugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () { 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
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
|
|
4
4
|
|
|
5
5
|
class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () { return 'google-cloud-pubsub' }
|
|
7
7
|
static get operation () { return 'receive' }
|
|
8
8
|
|
|
9
9
|
start ({ message }) {
|
|
@@ -7,7 +7,7 @@ const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
|
7
7
|
|
|
8
8
|
// TODO: Consider splitting channels for publish/receive in the instrumentation.
|
|
9
9
|
class GoogleCloudPubsubPlugin extends CompositePlugin {
|
|
10
|
-
static get
|
|
10
|
+
static get id () { return 'google-cloud-pubsub' }
|
|
11
11
|
static get plugins () {
|
|
12
12
|
return {
|
|
13
13
|
producer: ProducerPlugin,
|
|
@@ -3,20 +3,21 @@
|
|
|
3
3
|
const ProducerPlugin = require('../../dd-trace/src/plugins/producer')
|
|
4
4
|
|
|
5
5
|
class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () { 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
|
})
|
|
@@ -5,7 +5,7 @@ const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
|
5
5
|
let tools
|
|
6
6
|
|
|
7
7
|
class GraphQLExecutePlugin extends TracingPlugin {
|
|
8
|
-
static get
|
|
8
|
+
static get id () { return 'graphql' }
|
|
9
9
|
static get operation () { return 'execute' }
|
|
10
10
|
|
|
11
11
|
start ({ operation, args, docSource }) {
|
|
@@ -8,7 +8,7 @@ const GraphQLValidatePlugin = require('./validate')
|
|
|
8
8
|
const GraphQLResolvePlugin = require('./resolve')
|
|
9
9
|
|
|
10
10
|
class GraphQLPlugin extends CompositePlugin {
|
|
11
|
-
static get
|
|
11
|
+
static get id () { return 'graphql' }
|
|
12
12
|
static get plugins () {
|
|
13
13
|
return {
|
|
14
14
|
execute: GraphQLExecutePlugin,
|
|
@@ -5,7 +5,7 @@ const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
|
5
5
|
const collapsedPathSym = Symbol('collapsedPaths')
|
|
6
6
|
|
|
7
7
|
class GraphQLResolvePlugin extends TracingPlugin {
|
|
8
|
-
static get
|
|
8
|
+
static get id () { return 'graphql' }
|
|
9
9
|
static get operation () { return 'resolve' }
|
|
10
10
|
|
|
11
11
|
start ({ info, context }) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
4
4
|
|
|
5
5
|
class GraphQLValidatePlugin extends TracingPlugin {
|
|
6
|
-
static get
|
|
6
|
+
static get id () { return 'graphql' }
|
|
7
7
|
static get operation () { return 'validate' }
|
|
8
8
|
|
|
9
9
|
start ({ docSource, document }) {
|
|
@@ -5,7 +5,7 @@ const { TEXT_MAP } = require('../../../ext/formats')
|
|
|
5
5
|
const { addMetadataTags, getFilter, getMethodMetadata } = require('./util')
|
|
6
6
|
|
|
7
7
|
class GrpcClientPlugin extends ClientPlugin {
|
|
8
|
-
static get
|
|
8
|
+
static get id () { return 'grpc' }
|
|
9
9
|
static get operation () { return 'client:request' }
|
|
10
10
|
|
|
11
11
|
start ({ metadata, path, type }) {
|
|
@@ -5,7 +5,7 @@ const GrpcClientPlugin = require('./client')
|
|
|
5
5
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
6
6
|
|
|
7
7
|
class GrpcPlugin extends CompositePlugin {
|
|
8
|
-
static get
|
|
8
|
+
static get id () { return 'grpc' }
|
|
9
9
|
static get plugins () {
|
|
10
10
|
return {
|
|
11
11
|
server: GrpcServerPlugin,
|
|
@@ -5,7 +5,7 @@ const { TEXT_MAP } = require('../../../ext/formats')
|
|
|
5
5
|
const { addMetadataTags, getFilter, getMethodMetadata } = require('./util')
|
|
6
6
|
|
|
7
7
|
class GrpcServerPlugin extends ServerPlugin {
|
|
8
|
-
static get
|
|
8
|
+
static get id () { return 'grpc' }
|
|
9
9
|
static get operation () { return 'server:request' }
|
|
10
10
|
|
|
11
11
|
constructor (...args) {
|
|
@@ -16,7 +16,7 @@ const HTTP_REQUEST_HEADERS = tags.HTTP_REQUEST_HEADERS
|
|
|
16
16
|
const HTTP_RESPONSE_HEADERS = tags.HTTP_RESPONSE_HEADERS
|
|
17
17
|
|
|
18
18
|
class HttpClientPlugin extends Plugin {
|
|
19
|
-
static get
|
|
19
|
+
static get id () {
|
|
20
20
|
return 'http'
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -39,7 +39,7 @@ class HttpClientPlugin extends Plugin {
|
|
|
39
39
|
const span = this.tracer.startSpan('http.request', {
|
|
40
40
|
childOf,
|
|
41
41
|
tags: {
|
|
42
|
-
[COMPONENT]: this.constructor.
|
|
42
|
+
[COMPONENT]: this.constructor.id,
|
|
43
43
|
'span.kind': 'client',
|
|
44
44
|
'service.name': getServiceName(this.tracer, this.config, options),
|
|
45
45
|
'resource.name': method,
|
|
@@ -5,7 +5,7 @@ const HttpClientPlugin = require('./client')
|
|
|
5
5
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
6
6
|
|
|
7
7
|
class HttpPlugin extends CompositePlugin {
|
|
8
|
-
static get
|
|
8
|
+
static get id () { return 'http' }
|
|
9
9
|
static get plugins () {
|
|
10
10
|
return {
|
|
11
11
|
server: HttpServerPlugin,
|