dd-trace 3.3.1 → 3.4.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 -0
- package/index.d.ts +7 -0
- package/package.json +5 -3
- package/packages/datadog-instrumentations/src/cassandra-driver.js +7 -7
- package/packages/datadog-instrumentations/src/helpers/hooks.js +2 -0
- package/packages/datadog-instrumentations/src/http2/server.js +67 -1
- package/packages/datadog-instrumentations/src/jest.js +76 -6
- package/packages/datadog-instrumentations/src/mariadb.js +89 -0
- package/packages/datadog-instrumentations/src/memcached.js +1 -4
- package/packages/datadog-instrumentations/src/next.js +10 -2
- package/packages/datadog-instrumentations/src/oracledb.js +8 -8
- package/packages/datadog-instrumentations/src/redis.js +12 -3
- package/packages/datadog-instrumentations/src/rhea.js +11 -0
- package/packages/datadog-plugin-cassandra-driver/src/index.js +22 -60
- package/packages/datadog-plugin-elasticsearch/src/index.js +24 -60
- package/packages/datadog-plugin-http2/src/server.js +41 -0
- package/packages/datadog-plugin-jest/src/index.js +97 -2
- package/packages/datadog-plugin-mariadb/src/index.js +10 -0
- package/packages/datadog-plugin-memcached/src/index.js +17 -52
- package/packages/datadog-plugin-mongodb-core/src/index.js +20 -48
- package/packages/datadog-plugin-mysql/src/index.js +23 -52
- package/packages/datadog-plugin-mysql2/src/index.js +1 -3
- package/packages/datadog-plugin-oracledb/src/index.js +29 -54
- package/packages/datadog-plugin-pg/src/index.js +24 -52
- package/packages/datadog-plugin-redis/src/index.js +29 -60
- package/packages/datadog-plugin-rhea/src/index.js +4 -1
- package/packages/datadog-plugin-tedious/src/index.js +20 -41
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +32 -54
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-itr-configuration.js +87 -0
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +79 -0
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +0 -1
- package/packages/dd-trace/src/plugin_manager.js +3 -0
- package/packages/dd-trace/src/plugins/cache.js +9 -0
- package/packages/dd-trace/src/plugins/client.js +7 -0
- package/packages/dd-trace/src/plugins/database.js +9 -0
- package/packages/dd-trace/src/plugins/index.js +2 -0
- package/packages/dd-trace/src/plugins/outgoing.js +31 -0
- package/packages/dd-trace/src/plugins/plugin.js +3 -0
- package/packages/dd-trace/src/plugins/storage.js +25 -0
- package/packages/dd-trace/src/plugins/tracing.js +91 -0
- package/packages/dd-trace/src/plugins/util/git.js +58 -18
- package/packages/dd-trace/src/plugins/util/test.js +7 -1
- package/packages/dd-trace/src/proxy.js +4 -0
- package/packages/dd-trace/src/telemetry/index.js +7 -1
|
@@ -1,65 +1,37 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
static get
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'span.kind': 'client',
|
|
25
|
-
'db.type': 'postgres',
|
|
26
|
-
'resource.name': statement
|
|
27
|
-
}
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
if (params) {
|
|
31
|
-
span.addTags({
|
|
32
|
-
'db.name': params.database,
|
|
33
|
-
'db.user': params.user,
|
|
34
|
-
'out.host': params.host,
|
|
35
|
-
'out.port': params.port
|
|
36
|
-
})
|
|
3
|
+
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
4
|
+
|
|
5
|
+
class PGPlugin extends DatabasePlugin {
|
|
6
|
+
static get name () { return 'pg' }
|
|
7
|
+
static get operation () { return 'query' }
|
|
8
|
+
static get system () { return 'postgres' }
|
|
9
|
+
|
|
10
|
+
start ({ params = {}, statement }) {
|
|
11
|
+
const service = getServiceName(this.config, params)
|
|
12
|
+
|
|
13
|
+
this.startSpan('pg.query', {
|
|
14
|
+
service,
|
|
15
|
+
resource: statement,
|
|
16
|
+
type: 'sql',
|
|
17
|
+
kind: 'client',
|
|
18
|
+
meta: {
|
|
19
|
+
'db.type': 'postgres',
|
|
20
|
+
'db.name': params.database,
|
|
21
|
+
'db.user': params.user,
|
|
22
|
+
'out.host': params.host,
|
|
23
|
+
'out.port': params.port
|
|
37
24
|
}
|
|
38
|
-
|
|
39
|
-
analyticsSampler.sample(span, this.config.measured)
|
|
40
|
-
this.enter(span, store)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
this.addSub(`apm:pg:query:error`, err => {
|
|
44
|
-
const span = storage.getStore().span
|
|
45
|
-
span.setTag('error', err)
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
this.addSub(`apm:pg:query:finish`, () => {
|
|
49
|
-
const span = storage.getStore().span
|
|
50
|
-
span.finish()
|
|
51
25
|
})
|
|
52
26
|
}
|
|
53
27
|
}
|
|
54
28
|
|
|
55
|
-
function getServiceName (
|
|
29
|
+
function getServiceName (config, params) {
|
|
56
30
|
if (typeof config.service === 'function') {
|
|
57
31
|
return config.service(params)
|
|
58
|
-
} else if (config.service) {
|
|
59
|
-
return config.service
|
|
60
|
-
} else {
|
|
61
|
-
return `${tracer._service}-postgres`
|
|
62
32
|
}
|
|
33
|
+
|
|
34
|
+
return config.service
|
|
63
35
|
}
|
|
64
36
|
|
|
65
37
|
module.exports = PGPlugin
|
|
@@ -1,68 +1,27 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { storage } = require('../../datadog-core')
|
|
5
|
-
const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
|
|
3
|
+
const CachePlugin = require('../../dd-trace/src/plugins/cache')
|
|
6
4
|
const urlFilter = require('../../dd-trace/src/plugins/util/urlfilter')
|
|
7
5
|
|
|
8
|
-
class RedisPlugin extends
|
|
9
|
-
static get name () {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
tags: {
|
|
27
|
-
'span.kind': 'client',
|
|
28
|
-
'resource.name': command,
|
|
29
|
-
'span.type': 'redis',
|
|
30
|
-
'db.type': 'redis',
|
|
31
|
-
'db.name': db || '0',
|
|
32
|
-
'redis.raw_command': formatCommand(command, args)
|
|
33
|
-
}
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
span.setTag('service.name', this.config.service || `${span.context()._tags['service.name']}-redis`)
|
|
37
|
-
|
|
38
|
-
analyticsSampler.sample(span, this.config.measured)
|
|
39
|
-
|
|
40
|
-
if (connectionOptions) {
|
|
41
|
-
span.addTags({
|
|
42
|
-
'out.host': connectionOptions.host,
|
|
43
|
-
'out.port': connectionOptions.port
|
|
44
|
-
})
|
|
6
|
+
class RedisPlugin extends CachePlugin {
|
|
7
|
+
static get name () { return 'redis' }
|
|
8
|
+
static get system () { return 'redis' }
|
|
9
|
+
|
|
10
|
+
start ({ db, command, args, connectionOptions = {}, connectionName }) {
|
|
11
|
+
if (!this.config.filter(command)) return this.skip()
|
|
12
|
+
|
|
13
|
+
this.startSpan('redis.command', {
|
|
14
|
+
service: getService(this.config, connectionName),
|
|
15
|
+
resource: command,
|
|
16
|
+
type: 'redis',
|
|
17
|
+
kind: 'client',
|
|
18
|
+
meta: {
|
|
19
|
+
'db.type': 'redis',
|
|
20
|
+
'db.name': db || '0',
|
|
21
|
+
'redis.raw_command': formatCommand(command, args),
|
|
22
|
+
'out.host': connectionOptions.host,
|
|
23
|
+
'out.port': connectionOptions.port
|
|
45
24
|
}
|
|
46
|
-
|
|
47
|
-
if (this.config.splitByInstance && connectionName) {
|
|
48
|
-
const service = this.config.service
|
|
49
|
-
? `${this.config.service}-${connectionName}`
|
|
50
|
-
: connectionName
|
|
51
|
-
|
|
52
|
-
span.setTag('service.name', service)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
this.enter(span, store)
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
this.addSub(`apm:${this.constructor.name}:command:error`, err => {
|
|
59
|
-
const span = storage.getStore().span
|
|
60
|
-
span.setTag('error', err)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
this.addSub(`apm:${this.constructor.name}:command:finish`, () => {
|
|
64
|
-
const span = storage.getStore().span
|
|
65
|
-
span.finish()
|
|
66
25
|
})
|
|
67
26
|
}
|
|
68
27
|
|
|
@@ -71,6 +30,16 @@ class RedisPlugin extends Plugin {
|
|
|
71
30
|
}
|
|
72
31
|
}
|
|
73
32
|
|
|
33
|
+
function getService (config, connectionName) {
|
|
34
|
+
if (config.splitByInstance && connectionName) {
|
|
35
|
+
return config.service
|
|
36
|
+
? `${config.service}-${connectionName}`
|
|
37
|
+
: connectionName
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return config.service
|
|
41
|
+
}
|
|
42
|
+
|
|
74
43
|
function formatCommand (command, args) {
|
|
75
44
|
command = command.toUpperCase()
|
|
76
45
|
|
|
@@ -30,11 +30,14 @@ class RheaPlugin extends Plugin {
|
|
|
30
30
|
}
|
|
31
31
|
})
|
|
32
32
|
analyticsSampler.sample(span, this.config.measured)
|
|
33
|
-
addDeliveryAnnotations(msg, this.tracer, span)
|
|
34
33
|
|
|
35
34
|
this.enter(span, store)
|
|
36
35
|
})
|
|
37
36
|
|
|
37
|
+
this.addSub('apm:rhea:encode', msg => {
|
|
38
|
+
addDeliveryAnnotations(msg, this.tracer, this.tracer.scope().active())
|
|
39
|
+
})
|
|
40
|
+
|
|
38
41
|
this.addSub(`apm:rhea:receive:start`, ({ msgObj, connection }) => {
|
|
39
42
|
const name = getResourceNameFromMessage(msgObj)
|
|
40
43
|
|
|
@@ -1,48 +1,27 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const { storage } = require('../../datadog-core')
|
|
5
|
-
const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
|
|
3
|
+
const DatabasePlugin = require('../../dd-trace/src/plugins/database')
|
|
6
4
|
|
|
7
|
-
class TediousPlugin extends
|
|
8
|
-
static get name () {
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
constructor (...args) {
|
|
13
|
-
super(...args)
|
|
14
|
-
|
|
15
|
-
this.addSub(`apm:tedious:request:start`, ({ queryOrProcedure, connectionConfig }) => {
|
|
16
|
-
const store = storage.getStore()
|
|
17
|
-
const childOf = store ? store.span : store
|
|
18
|
-
const span = this.tracer.startSpan('tedious.request', {
|
|
19
|
-
childOf,
|
|
20
|
-
tags: {
|
|
21
|
-
'span.kind': 'client',
|
|
22
|
-
'db.type': 'mssql',
|
|
23
|
-
'span.type': 'sql',
|
|
24
|
-
'component': 'tedious',
|
|
25
|
-
'service.name': this.config.service || `${this.tracer._service}-mssql`,
|
|
26
|
-
'resource.name': queryOrProcedure,
|
|
27
|
-
'out.host': connectionConfig.server,
|
|
28
|
-
'out.port': connectionConfig.options.port,
|
|
29
|
-
'db.user': connectionConfig.userName || connectionConfig.authentication.options.userName,
|
|
30
|
-
'db.name': connectionConfig.options.database,
|
|
31
|
-
'db.instance': connectionConfig.options.instanceName
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
analyticsSampler.sample(span, this.config.measured)
|
|
35
|
-
this.enter(span, store)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
this.addSub(`apm:tedious:request:error`, err => {
|
|
39
|
-
const span = storage.getStore().span
|
|
40
|
-
span.setTag('error', err)
|
|
41
|
-
})
|
|
5
|
+
class TediousPlugin extends DatabasePlugin {
|
|
6
|
+
static get name () { return 'tedious' }
|
|
7
|
+
static get operation () { return 'request' } // TODO: change to match other database plugins
|
|
8
|
+
static get system () { return 'mssql' }
|
|
42
9
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
10
|
+
start ({ queryOrProcedure, connectionConfig }) {
|
|
11
|
+
this.startSpan('tedious.request', {
|
|
12
|
+
service: this.config.service,
|
|
13
|
+
resource: queryOrProcedure,
|
|
14
|
+
type: 'sql',
|
|
15
|
+
kind: 'client',
|
|
16
|
+
meta: {
|
|
17
|
+
'db.type': 'mssql',
|
|
18
|
+
'component': 'tedious',
|
|
19
|
+
'out.host': connectionConfig.server,
|
|
20
|
+
'out.port': connectionConfig.options.port,
|
|
21
|
+
'db.user': connectionConfig.userName || connectionConfig.authentication.options.userName,
|
|
22
|
+
'db.name': connectionConfig.options.database,
|
|
23
|
+
'db.instance': connectionConfig.options.instanceName
|
|
24
|
+
}
|
|
46
25
|
})
|
|
47
26
|
}
|
|
48
27
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
const fs = require('fs')
|
|
3
|
-
const https = require('https')
|
|
4
3
|
const path = require('path')
|
|
5
4
|
|
|
6
5
|
const FormData = require('../../../exporters/common/form-data')
|
|
6
|
+
const request = require('../../../exporters/common/request')
|
|
7
7
|
|
|
8
8
|
const log = require('../../../log')
|
|
9
9
|
const {
|
|
@@ -18,7 +18,7 @@ const isValidSha = (sha) => /[0-9a-f]{40}/.test(sha)
|
|
|
18
18
|
function sanitizeCommits (commits) {
|
|
19
19
|
return commits.map(({ id: commitSha, type }) => {
|
|
20
20
|
if (type !== 'commit') {
|
|
21
|
-
throw new Error('Invalid commit response')
|
|
21
|
+
throw new Error('Invalid commit type response')
|
|
22
22
|
}
|
|
23
23
|
const sanitizedCommit = commitSha.replace(/[^0-9a-f]+/g, '')
|
|
24
24
|
if (sanitizedCommit !== commitSha || !isValidSha(sanitizedCommit)) {
|
|
@@ -71,33 +71,19 @@ function getCommitsToExclude ({ url, repositoryUrl }, callback) {
|
|
|
71
71
|
}))
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
callback(null, commitsToExclude, headCommit)
|
|
88
|
-
} else {
|
|
89
|
-
const error = new Error(`Error getting commits: ${res.statusCode} ${res.statusMessage}`)
|
|
90
|
-
callback(error)
|
|
91
|
-
}
|
|
92
|
-
})
|
|
74
|
+
request(localCommitData, options, (err, response, statusCode) => {
|
|
75
|
+
if (err) {
|
|
76
|
+
const error = new Error(`search_commits returned an error: status code ${statusCode}`)
|
|
77
|
+
return callback(error)
|
|
78
|
+
}
|
|
79
|
+
let commitsToExclude
|
|
80
|
+
try {
|
|
81
|
+
commitsToExclude = sanitizeCommits(JSON.parse(response).data)
|
|
82
|
+
} catch (e) {
|
|
83
|
+
return callback(new Error(`Can't parse search_commits response: ${e.message}`))
|
|
84
|
+
}
|
|
85
|
+
callback(null, commitsToExclude, headCommit)
|
|
93
86
|
})
|
|
94
|
-
|
|
95
|
-
request.write(localCommitData)
|
|
96
|
-
request.on('error', callback)
|
|
97
|
-
|
|
98
|
-
request.end()
|
|
99
|
-
|
|
100
|
-
return request
|
|
101
87
|
}
|
|
102
88
|
|
|
103
89
|
/**
|
|
@@ -127,7 +113,7 @@ function uploadPackFile ({ url, packFileToUpload, repositoryUrl, headCommit }, c
|
|
|
127
113
|
contentType: 'application/octet-stream'
|
|
128
114
|
})
|
|
129
115
|
} catch (e) {
|
|
130
|
-
callback(new Error(`
|
|
116
|
+
callback(new Error(`Could not read "${packFileToUpload}"`))
|
|
131
117
|
return
|
|
132
118
|
}
|
|
133
119
|
|
|
@@ -141,25 +127,13 @@ function uploadPackFile ({ url, packFileToUpload, repositoryUrl, headCommit }, c
|
|
|
141
127
|
...form.getHeaders()
|
|
142
128
|
}
|
|
143
129
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
} else {
|
|
151
|
-
const error = new Error(`Error uploading packfiles: ${res.statusCode} ${res.statusMessage}`)
|
|
152
|
-
error.status = res.statusCode
|
|
153
|
-
|
|
154
|
-
callback(error)
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
req.on('error', err => {
|
|
160
|
-
callback(err)
|
|
130
|
+
request(form, options, (err, _, statusCode) => {
|
|
131
|
+
if (err) {
|
|
132
|
+
const error = new Error(`Could not upload packfiles: status code ${statusCode}`)
|
|
133
|
+
return callback(error)
|
|
134
|
+
}
|
|
135
|
+
callback(null)
|
|
161
136
|
})
|
|
162
|
-
form.pipe(req)
|
|
163
137
|
}
|
|
164
138
|
|
|
165
139
|
/**
|
|
@@ -170,27 +144,31 @@ function sendGitMetadata (site, callback) {
|
|
|
170
144
|
|
|
171
145
|
const repositoryUrl = getRepositoryUrl()
|
|
172
146
|
|
|
147
|
+
if (!repositoryUrl) {
|
|
148
|
+
return callback(new Error('Repository URL is empty'))
|
|
149
|
+
}
|
|
150
|
+
|
|
173
151
|
getCommitsToExclude({ url, repositoryUrl }, (err, commitsToExclude, headCommit) => {
|
|
174
152
|
if (err) {
|
|
175
|
-
callback(err)
|
|
176
|
-
return
|
|
153
|
+
return callback(err)
|
|
177
154
|
}
|
|
178
155
|
const commitsToUpload = getCommitsToUpload(commitsToExclude)
|
|
179
156
|
|
|
180
157
|
if (!commitsToUpload.length) {
|
|
181
158
|
log.debug('No commits to upload')
|
|
182
|
-
callback(null)
|
|
183
|
-
return
|
|
159
|
+
return callback(null)
|
|
184
160
|
}
|
|
185
|
-
|
|
186
161
|
const packFilesToUpload = generatePackFilesForCommits(commitsToUpload)
|
|
187
162
|
|
|
163
|
+
if (!packFilesToUpload.length) {
|
|
164
|
+
return callback(new Error('Failed to generate packfiles'))
|
|
165
|
+
}
|
|
166
|
+
|
|
188
167
|
let packFileIndex = 0
|
|
189
168
|
// This uploads packfiles sequentially
|
|
190
169
|
const uploadPackFileCallback = (err) => {
|
|
191
170
|
if (err || packFileIndex === packFilesToUpload.length) {
|
|
192
|
-
callback(err)
|
|
193
|
-
return
|
|
171
|
+
return callback(err)
|
|
194
172
|
}
|
|
195
173
|
return uploadPackFile(
|
|
196
174
|
{
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const request = require('../../exporters/common/request')
|
|
2
|
+
const id = require('../../id')
|
|
3
|
+
|
|
4
|
+
function getItrConfiguration ({
|
|
5
|
+
site,
|
|
6
|
+
env,
|
|
7
|
+
service,
|
|
8
|
+
repositoryUrl,
|
|
9
|
+
sha,
|
|
10
|
+
osVersion,
|
|
11
|
+
osPlatform,
|
|
12
|
+
osArchitecture,
|
|
13
|
+
runtimeName,
|
|
14
|
+
runtimeVersion,
|
|
15
|
+
branch
|
|
16
|
+
}, done) {
|
|
17
|
+
const url = new URL(`https://api.${site}`)
|
|
18
|
+
|
|
19
|
+
const apiKey = process.env.DATADOG_API_KEY || process.env.DD_API_KEY
|
|
20
|
+
const appKey = process.env.DATADOG_APP_KEY ||
|
|
21
|
+
process.env.DD_APP_KEY ||
|
|
22
|
+
process.env.DATADOG_APPLICATION_KEY ||
|
|
23
|
+
process.env.DD_APPLICATION_KEY
|
|
24
|
+
|
|
25
|
+
if (!apiKey || !appKey) {
|
|
26
|
+
done(new Error('App key or API key undefined'))
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const options = {
|
|
31
|
+
path: '/api/v2/libraries/tests/services/setting',
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: {
|
|
34
|
+
'dd-api-key': apiKey,
|
|
35
|
+
'dd-application-key': appKey,
|
|
36
|
+
'Content-Type': 'application/json'
|
|
37
|
+
},
|
|
38
|
+
protocol: url.protocol,
|
|
39
|
+
hostname: url.hostname,
|
|
40
|
+
port: url.port
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const data = JSON.stringify({
|
|
44
|
+
data: {
|
|
45
|
+
id: id().toString(10),
|
|
46
|
+
type: 'ci_app_test_service_libraries_settings',
|
|
47
|
+
attributes: {
|
|
48
|
+
test_level: 'suite',
|
|
49
|
+
configurations: {
|
|
50
|
+
'os.platform': osPlatform,
|
|
51
|
+
'os.version': osVersion,
|
|
52
|
+
'os.architecture': osArchitecture,
|
|
53
|
+
'runtime.name': runtimeName,
|
|
54
|
+
'runtime.version': runtimeVersion
|
|
55
|
+
},
|
|
56
|
+
service,
|
|
57
|
+
env,
|
|
58
|
+
repository_url: repositoryUrl,
|
|
59
|
+
sha,
|
|
60
|
+
branch
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
request(data, options, (err, res) => {
|
|
66
|
+
if (err) {
|
|
67
|
+
done(err)
|
|
68
|
+
} else {
|
|
69
|
+
try {
|
|
70
|
+
const {
|
|
71
|
+
data: {
|
|
72
|
+
attributes: {
|
|
73
|
+
code_coverage: isCodeCoverageEnabled,
|
|
74
|
+
tests_skipping: isSuitesSkippingEnabled
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} = JSON.parse(res)
|
|
78
|
+
|
|
79
|
+
done(null, { isCodeCoverageEnabled, isSuitesSkippingEnabled })
|
|
80
|
+
} catch (e) {
|
|
81
|
+
done(e)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
module.exports = { getItrConfiguration }
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const request = require('../../exporters/common/request')
|
|
2
|
+
|
|
3
|
+
function getSkippableSuites ({
|
|
4
|
+
site,
|
|
5
|
+
env,
|
|
6
|
+
service,
|
|
7
|
+
repositoryUrl,
|
|
8
|
+
sha,
|
|
9
|
+
osVersion,
|
|
10
|
+
osPlatform,
|
|
11
|
+
osArchitecture,
|
|
12
|
+
runtimeName,
|
|
13
|
+
runtimeVersion
|
|
14
|
+
}, done) {
|
|
15
|
+
const url = new URL(`https://api.${site}`)
|
|
16
|
+
|
|
17
|
+
const apiKey = process.env.DATADOG_API_KEY || process.env.DD_API_KEY
|
|
18
|
+
const appKey = process.env.DATADOG_APP_KEY ||
|
|
19
|
+
process.env.DD_APP_KEY ||
|
|
20
|
+
process.env.DATADOG_APPLICATION_KEY ||
|
|
21
|
+
process.env.DD_APPLICATION_KEY
|
|
22
|
+
|
|
23
|
+
if (!apiKey || !appKey) {
|
|
24
|
+
return done(new Error('API key or Application key are undefined.'))
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const options = {
|
|
28
|
+
path: '/api/v2/ci/tests/skippable',
|
|
29
|
+
method: 'POST',
|
|
30
|
+
headers: {
|
|
31
|
+
'dd-api-key': apiKey,
|
|
32
|
+
'dd-application-key': appKey,
|
|
33
|
+
'Content-Type': 'application/json'
|
|
34
|
+
},
|
|
35
|
+
timeout: 15000,
|
|
36
|
+
protocol: url.protocol,
|
|
37
|
+
hostname: url.hostname,
|
|
38
|
+
port: url.port
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const data = JSON.stringify({
|
|
42
|
+
data: {
|
|
43
|
+
type: 'test_params',
|
|
44
|
+
attributes: {
|
|
45
|
+
test_level: 'suite',
|
|
46
|
+
configurations: {
|
|
47
|
+
'os.platform': osPlatform,
|
|
48
|
+
'os.version': osVersion,
|
|
49
|
+
'os.architecture': osArchitecture,
|
|
50
|
+
'runtime.name': runtimeName,
|
|
51
|
+
'runtime.version': runtimeVersion
|
|
52
|
+
},
|
|
53
|
+
service,
|
|
54
|
+
env,
|
|
55
|
+
repository_url: repositoryUrl,
|
|
56
|
+
sha
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
request(data, options, (err, res) => {
|
|
62
|
+
if (err) {
|
|
63
|
+
done(err)
|
|
64
|
+
} else {
|
|
65
|
+
let skippableSuites = []
|
|
66
|
+
try {
|
|
67
|
+
skippableSuites = JSON.parse(res)
|
|
68
|
+
.data
|
|
69
|
+
.filter(({ type }) => type === 'suite')
|
|
70
|
+
.map(({ attributes: { suite } }) => suite)
|
|
71
|
+
done(null, skippableSuites)
|
|
72
|
+
} catch (e) {
|
|
73
|
+
done(e)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = { getSkippableSuites }
|
|
@@ -12,7 +12,6 @@ const MAXIMUM_NUM_COVERAGE_FILES = 100
|
|
|
12
12
|
class CoverageCIVisibilityEncoder extends AgentEncoder {
|
|
13
13
|
constructor () {
|
|
14
14
|
super(...arguments)
|
|
15
|
-
this.codeCoverageBuffers = []
|
|
16
15
|
this._coverageBytes = new Chunk()
|
|
17
16
|
this.form = new FormData()
|
|
18
17
|
this.fileIndex = 1
|
|
@@ -123,6 +123,7 @@ module.exports = class PluginManager {
|
|
|
123
123
|
clientIpHeaderDisabled,
|
|
124
124
|
clientIpHeader,
|
|
125
125
|
isIntelligentTestRunnerEnabled,
|
|
126
|
+
site,
|
|
126
127
|
experimental
|
|
127
128
|
} = this._tracerConfig
|
|
128
129
|
|
|
@@ -154,6 +155,8 @@ module.exports = class PluginManager {
|
|
|
154
155
|
sharedConfig.service = serviceMapping[name]
|
|
155
156
|
}
|
|
156
157
|
|
|
158
|
+
sharedConfig.site = site
|
|
159
|
+
|
|
157
160
|
return sharedConfig
|
|
158
161
|
}
|
|
159
162
|
}
|
|
@@ -10,6 +10,7 @@ module.exports = {
|
|
|
10
10
|
get '@jest/core' () { return require('../../../datadog-plugin-jest/src') },
|
|
11
11
|
get '@koa/router' () { return require('../../../datadog-plugin-koa/src') },
|
|
12
12
|
get '@node-redis/client' () { return require('../../../datadog-plugin-redis/src') },
|
|
13
|
+
get '@redis/client' () { return require('../../../datadog-plugin-redis/src') },
|
|
13
14
|
get 'amqp10' () { return require('../../../datadog-plugin-amqp10/src') },
|
|
14
15
|
get 'amqplib' () { return require('../../../datadog-plugin-amqplib/src') },
|
|
15
16
|
get 'aws-sdk' () { return require('../../../datadog-plugin-aws-sdk/src') },
|
|
@@ -38,6 +39,7 @@ module.exports = {
|
|
|
38
39
|
get 'koa' () { return require('../../../datadog-plugin-koa/src') },
|
|
39
40
|
get 'koa-router' () { return require('../../../datadog-plugin-koa/src') },
|
|
40
41
|
get 'kafkajs' () { return require('../../../datadog-plugin-kafkajs/src') },
|
|
42
|
+
get 'mariadb' () { return require('../../../datadog-plugin-mariadb/src') },
|
|
41
43
|
get 'memcached' () { return require('../../../datadog-plugin-memcached/src') },
|
|
42
44
|
get 'microgateway-core' () { return require('../../../datadog-plugin-microgateway-core/src') },
|
|
43
45
|
get 'mocha' () { return require('../../../datadog-plugin-mocha/src') },
|