dd-trace 3.17.0 → 3.17.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dd-trace",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.1",
|
|
4
4
|
"description": "Datadog APM tracing client for JavaScript",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"path-to-regexp": "^0.1.2",
|
|
92
92
|
"protobufjs": "^7.1.2",
|
|
93
93
|
"retry": "^0.10.1",
|
|
94
|
-
"semver": "^
|
|
94
|
+
"semver": "^7.3.8"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@types/node": ">=14",
|
|
@@ -68,6 +68,12 @@ class NextPlugin extends Plugin {
|
|
|
68
68
|
const span = store.span
|
|
69
69
|
const req = this._requests.get(span)
|
|
70
70
|
|
|
71
|
+
// Only use error page names if there's not already a name
|
|
72
|
+
const current = span.context()._tags['next.page']
|
|
73
|
+
if (current && (page === '/404' || page === '/500' || page === '/_error')) {
|
|
74
|
+
return
|
|
75
|
+
}
|
|
76
|
+
|
|
71
77
|
span.addTags({
|
|
72
78
|
[COMPONENT]: this.constructor.id,
|
|
73
79
|
'resource.name': `${req.method} ${page}`.trim(),
|
|
@@ -50,7 +50,7 @@ function crashFlush () {
|
|
|
50
50
|
[ERROR_TYPE]: error.name
|
|
51
51
|
})
|
|
52
52
|
} else {
|
|
53
|
-
log.
|
|
53
|
+
log.debug('An impending timeout was reached, but no root span was found. No error will be tagged.')
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
tracer._processor.killAll()
|
|
@@ -59,6 +59,23 @@ function crashFlush () {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Extracts the context from the given Lambda handler arguments.
|
|
64
|
+
*
|
|
65
|
+
* @param {*} args any amount of arguments
|
|
66
|
+
* @returns the context, if extraction was succesful.
|
|
67
|
+
*/
|
|
68
|
+
function extractContext (args) {
|
|
69
|
+
let context = args.length > 1 ? args[1] : undefined
|
|
70
|
+
if (context === undefined || context.getRemainingTimeInMillis === undefined) {
|
|
71
|
+
context = args.length > 2 ? args[2] : undefined
|
|
72
|
+
if (context === undefined || context.getRemainingTimeInMillis === undefined) {
|
|
73
|
+
throw Error('Could not extract context')
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return context
|
|
77
|
+
}
|
|
78
|
+
|
|
62
79
|
/**
|
|
63
80
|
* Patches your AWS Lambda handler function to add some tracing support.
|
|
64
81
|
*
|
|
@@ -66,14 +83,21 @@ function crashFlush () {
|
|
|
66
83
|
*/
|
|
67
84
|
exports.datadog = function datadog (lambdaHandler) {
|
|
68
85
|
return (...args) => {
|
|
69
|
-
const context = args[1]
|
|
70
86
|
const patched = lambdaHandler.apply(this, args)
|
|
71
|
-
checkTimeout(context)
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
try {
|
|
89
|
+
const context = extractContext(args)
|
|
90
|
+
|
|
91
|
+
checkTimeout(context)
|
|
92
|
+
|
|
93
|
+
if (patched) {
|
|
94
|
+
// clear the timeout as soon as a result is returned
|
|
95
|
+
patched.then(_ => clearTimeout(__lambdaTimeout))
|
|
96
|
+
}
|
|
97
|
+
} catch (e) {
|
|
98
|
+
log.debug('Error patching AWS Lambda handler. Timeout spans will not be generated.')
|
|
76
99
|
}
|
|
100
|
+
|
|
77
101
|
return patched
|
|
78
102
|
}
|
|
79
103
|
}
|
|
@@ -89,6 +89,8 @@ async function assertInstrumentation (instrumentation, external) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
async function assertModules (name, version, external) {
|
|
92
|
+
const range = process.env.RANGE
|
|
93
|
+
if (range && !semver.subset(version, range)) return
|
|
92
94
|
addFolder(name)
|
|
93
95
|
addFolder(name, version)
|
|
94
96
|
assertFolder(name)
|