dd-trace 3.49.0 → 3.50.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/CONTRIBUTING.md +98 -0
- package/README.md +4 -102
- package/ci/cypress/after-run.js +1 -0
- package/package.json +1 -1
- package/packages/datadog-instrumentations/src/cucumber.js +156 -42
- package/packages/datadog-instrumentations/src/jest.js +69 -35
- package/packages/datadog-plugin-amqplib/src/consumer.js +5 -2
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +60 -50
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +40 -17
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +62 -26
- package/packages/datadog-plugin-cucumber/src/index.js +25 -9
- package/packages/datadog-plugin-cypress/src/after-run.js +3 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +560 -0
- package/packages/datadog-plugin-cypress/src/plugin.js +6 -549
- package/packages/datadog-plugin-rhea/src/consumer.js +4 -1
- package/packages/dd-trace/src/config.js +3 -2
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +1 -1
- package/packages/dd-trace/src/opentracing/span.js +4 -4
- package/packages/dd-trace/src/profiling/exporters/agent.js +40 -31
|
@@ -61,45 +61,50 @@ class AgentExporter {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export ({ profiles, start, end, tags }) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
const fields = [
|
|
67
|
-
['recording-start', start.toISOString()],
|
|
68
|
-
['recording-end', end.toISOString()],
|
|
69
|
-
['language', 'javascript'],
|
|
70
|
-
['runtime', 'nodejs'],
|
|
71
|
-
['runtime_version', process.version],
|
|
72
|
-
['profiler_version', version],
|
|
73
|
-
['format', 'pprof'],
|
|
74
|
-
|
|
75
|
-
['tags[]', 'language:javascript'],
|
|
76
|
-
['tags[]', 'runtime:nodejs'],
|
|
77
|
-
['tags[]', `runtime_version:${process.version}`],
|
|
78
|
-
['tags[]', `process_id:${process.pid}`],
|
|
79
|
-
['tags[]', `profiler_version:${version}`],
|
|
80
|
-
['tags[]', 'format:pprof'],
|
|
81
|
-
...Object.entries(tags).map(([key, value]) => ['tags[]', `${key}:${value}`])
|
|
82
|
-
]
|
|
64
|
+
const fields = []
|
|
83
65
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
66
|
+
function typeToFile (type) {
|
|
67
|
+
return `${type}.pprof`
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const event = JSON.stringify({
|
|
71
|
+
attachments: Object.keys(profiles).map(typeToFile),
|
|
72
|
+
start: start.toISOString(),
|
|
73
|
+
end: end.toISOString(),
|
|
74
|
+
family: 'node',
|
|
75
|
+
version: '4',
|
|
76
|
+
tags_profiler: [
|
|
77
|
+
'language:javascript',
|
|
78
|
+
'runtime:nodejs',
|
|
79
|
+
`runtime_arch:${process.arch}`,
|
|
80
|
+
`runtime_os:${process.platform}`,
|
|
81
|
+
`runtime_version:${process.version}`,
|
|
82
|
+
`process_id:${process.pid}`,
|
|
83
|
+
`profiler_version:${version}`,
|
|
84
|
+
'format:pprof',
|
|
85
|
+
...Object.entries(tags).map(([key, value]) => `${key}:${value}`)
|
|
86
|
+
].join(',')
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
fields.push(['event', event, {
|
|
90
|
+
filename: 'event.json',
|
|
91
|
+
contentType: 'application/json'
|
|
92
|
+
}])
|
|
93
|
+
|
|
94
|
+
this._logger.debug(() => {
|
|
95
|
+
return `Building agent export report:\n${event}`
|
|
96
|
+
})
|
|
92
97
|
|
|
98
|
+
for (const [type, buffer] of Object.entries(profiles)) {
|
|
93
99
|
this._logger.debug(() => {
|
|
94
100
|
const bytes = buffer.toString('hex').match(/../g).join(' ')
|
|
95
101
|
return `Adding ${type} profile to agent export: ` + bytes
|
|
96
102
|
})
|
|
97
103
|
|
|
98
|
-
|
|
99
|
-
fields.push([
|
|
100
|
-
filename
|
|
101
|
-
contentType: 'application/octet-stream'
|
|
102
|
-
knownLength: buffer.length
|
|
104
|
+
const filename = typeToFile(type)
|
|
105
|
+
fields.push([filename, buffer, {
|
|
106
|
+
filename,
|
|
107
|
+
contentType: 'application/octet-stream'
|
|
103
108
|
}])
|
|
104
109
|
}
|
|
105
110
|
|
|
@@ -121,7 +126,11 @@ class AgentExporter {
|
|
|
121
126
|
const options = {
|
|
122
127
|
method: 'POST',
|
|
123
128
|
path: '/profiling/v1/input',
|
|
124
|
-
headers:
|
|
129
|
+
headers: {
|
|
130
|
+
'DD-EVP-ORIGIN': 'dd-trace-js',
|
|
131
|
+
'DD-EVP-ORIGIN-VERSION': version,
|
|
132
|
+
...form.getHeaders()
|
|
133
|
+
},
|
|
125
134
|
timeout: this._backoffTime * Math.pow(2, attempt)
|
|
126
135
|
}
|
|
127
136
|
|