dd-trace 3.9.1 → 3.9.3

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.9.1",
3
+ "version": "3.9.3",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -176,6 +176,9 @@ function cliWrapper (cli) {
176
176
  const configurationPromise = new Promise((resolve) => {
177
177
  onDone = resolve
178
178
  })
179
+ if (!jestConfigurationCh.hasSubscribers) {
180
+ return runCLI.apply(this, arguments)
181
+ }
179
182
 
180
183
  sessionAsyncResource.runInAsyncScope(() => {
181
184
  jestConfigurationCh.publish({ onDone })
@@ -317,6 +317,9 @@ addHook({
317
317
  * If ITR is disabled, `onDone` is called immediately on the subscriber
318
318
  */
319
319
  shimmer.wrap(Mocha.prototype, 'run', run => function () {
320
+ if (!configurationCh.hasSubscribers) {
321
+ return run.apply(this, arguments)
322
+ }
320
323
  const onReceivedSkippableSuites = ({ err, skippableSuites }) => {
321
324
  if (err) {
322
325
  log.error(err)
@@ -332,6 +335,9 @@ addHook({
332
335
  log.error(err)
333
336
  return run.apply(this, arguments)
334
337
  }
338
+ if (!skippableSuitesCh.hasSubscribers) {
339
+ return run.apply(this, arguments)
340
+ }
335
341
 
336
342
  skippableSuitesCh.publish({
337
343
  onDone: mochaRunAsyncResource.bind(onReceivedSkippableSuites)
@@ -265,11 +265,7 @@ const web = {
265
265
 
266
266
  // Extract the parent span from the headers and start a new span as its child
267
267
  startChildSpan (tracer, name, headers) {
268
- const activeSpan = tracer.scope().active()
269
- const spanContext = activeSpan && activeSpan.context()
270
- const isLambda = spanContext && spanContext._name === 'aws.lambda'
271
-
272
- const childOf = (isLambda && activeSpan) || tracer.extract(FORMAT_HTTP_HEADERS, headers)
268
+ const childOf = tracer.scope().active() || tracer.extract(FORMAT_HTTP_HEADERS, headers)
273
269
 
274
270
  const span = tracer.startSpan(name, { childOf })
275
271