dd-trace 4.0.0-pre-133a3e0 → 4.0.0-pre-e7fe5c1
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/index.d.ts
CHANGED
|
@@ -77,9 +77,6 @@ export declare interface Tracer extends opentracing.Tracer {
|
|
|
77
77
|
* span will finish when that callback is called.
|
|
78
78
|
* * The function doesn't accept a callback and doesn't return a promise, in
|
|
79
79
|
* which case the span will finish at the end of the function execution.
|
|
80
|
-
*
|
|
81
|
-
* If the `orphanable` option is set to false, the function will not be traced
|
|
82
|
-
* unless there is already an active span or `childOf` option.
|
|
83
80
|
*/
|
|
84
81
|
trace<T> (name: string, fn: (span?: Span, fn?: (error?: Error) => any) => T): T;
|
|
85
82
|
trace<T> (name: string, options: TraceOptions & SpanOptions, fn: (span?: Span, done?: (error?: Error) => string) => T): T;
|
|
@@ -488,12 +485,6 @@ export declare interface TracerOptions {
|
|
|
488
485
|
*/
|
|
489
486
|
logLevel?: 'error' | 'debug'
|
|
490
487
|
|
|
491
|
-
/**
|
|
492
|
-
* If false, require a parent in order to trace.
|
|
493
|
-
* @default true
|
|
494
|
-
*/
|
|
495
|
-
orphanable?: boolean
|
|
496
|
-
|
|
497
488
|
/**
|
|
498
489
|
* Enables DBM to APM link using tag injection.
|
|
499
490
|
* @default 'disabled'
|
package/package.json
CHANGED
|
@@ -22,6 +22,10 @@ for (const packageName of names) {
|
|
|
22
22
|
|
|
23
23
|
hooks[packageName]()
|
|
24
24
|
|
|
25
|
+
if (!instrumentations[packageName]) {
|
|
26
|
+
return moduleExports
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
for (const { name, file, versions, hook } of instrumentations[packageName]) {
|
|
26
30
|
const fullFilename = filename(name, file)
|
|
27
31
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
+
const semver = require('semver')
|
|
3
|
+
|
|
2
4
|
const { addHook, channel, AsyncResource } = require('./helpers/instrument')
|
|
3
5
|
const shimmer = require('../../datadog-shimmer')
|
|
4
6
|
const log = require('../../dd-trace/src/log')
|
|
7
|
+
const { version: ddTraceVersion } = require('../../../package.json')
|
|
5
8
|
const {
|
|
6
9
|
getCoveredFilenamesFromCoverage,
|
|
7
10
|
JEST_WORKER_TRACE_PAYLOAD_CODE,
|
|
@@ -480,11 +483,13 @@ function jasmineAsyncInstallWraper (jasmineAsyncInstallExport, jestVersion) {
|
|
|
480
483
|
}
|
|
481
484
|
}
|
|
482
485
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
if (semver.lt(ddTraceVersion, '4.0.0')) {
|
|
487
|
+
addHook({
|
|
488
|
+
name: 'jest-jasmine2',
|
|
489
|
+
versions: ['>=24.8.0'],
|
|
490
|
+
file: 'build/jasmineAsyncInstall.js'
|
|
491
|
+
}, jasmineAsyncInstallWraper)
|
|
492
|
+
}
|
|
488
493
|
|
|
489
494
|
addHook({
|
|
490
495
|
name: 'jest-worker',
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
const request = require('../exporters/common/request')
|
|
2
2
|
let seqId = 0
|
|
3
|
+
|
|
4
|
+
function getPayload (payload) {
|
|
5
|
+
// Some telemetry endpoints payloads accept collections of elements such as the 'logs' endpoint.
|
|
6
|
+
// 'logs' request type payload is meant to send library logs to Datadog’s backend.
|
|
7
|
+
if (Array.isArray(payload)) {
|
|
8
|
+
return payload
|
|
9
|
+
} else {
|
|
10
|
+
const { logger, tags, serviceMapping, ...trimmedPayload } = payload
|
|
11
|
+
return trimmedPayload
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
3
15
|
function sendData (config, application, host, reqType, payload = {}) {
|
|
4
16
|
const {
|
|
5
17
|
hostname,
|
|
@@ -7,8 +19,6 @@ function sendData (config, application, host, reqType, payload = {}) {
|
|
|
7
19
|
url
|
|
8
20
|
} = config
|
|
9
21
|
|
|
10
|
-
const { logger, tags, serviceMapping, ...trimmedPayload } = payload
|
|
11
|
-
|
|
12
22
|
const options = {
|
|
13
23
|
url,
|
|
14
24
|
hostname,
|
|
@@ -27,7 +37,7 @@ function sendData (config, application, host, reqType, payload = {}) {
|
|
|
27
37
|
tracer_time: Math.floor(Date.now() / 1000),
|
|
28
38
|
runtime_id: config.tags['runtime-id'],
|
|
29
39
|
seq_id: ++seqId,
|
|
30
|
-
payload:
|
|
40
|
+
payload: getPayload(payload),
|
|
31
41
|
application,
|
|
32
42
|
host
|
|
33
43
|
})
|
|
@@ -26,10 +26,6 @@ class DatadogTracer extends Tracer {
|
|
|
26
26
|
childOf: this.scope().active()
|
|
27
27
|
}, options)
|
|
28
28
|
|
|
29
|
-
if (!options.childOf && options.orphanable === false) {
|
|
30
|
-
return fn(null, () => {})
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
const span = this.startSpan(name, options)
|
|
34
30
|
|
|
35
31
|
addTags(span, options)
|
|
@@ -81,10 +77,6 @@ class DatadogTracer extends Tracer {
|
|
|
81
77
|
optionsObj = optionsObj.apply(this, arguments)
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
if (optionsObj && optionsObj.orphanable === false && !tracer.scope().active()) {
|
|
85
|
-
return fn.apply(this, arguments)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
80
|
const lastArgId = arguments.length - 1
|
|
89
81
|
const cb = arguments[lastArgId]
|
|
90
82
|
|