dd-trace 3.14.0 → 3.14.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.14.0",
3
+ "version": "3.14.1",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -26,7 +26,11 @@ class HapiPlugin extends RouterPlugin {
26
26
  web.setRoute(req, route)
27
27
  })
28
28
 
29
- this.addSub(`apm:hapi:request:error`, this.addError)
29
+ this.addSub('apm:hapi:request:error', error => {
30
+ if (!error || !error.isBoom || !this.config.validateStatus(error.output.statusCode)) {
31
+ this.addError(error)
32
+ }
33
+ })
30
34
 
31
35
  this.addSub('apm:hapi:extension:enter', ({ req }) => {
32
36
  this.enter(this._requestSpans.get(req))
@@ -302,6 +302,7 @@ class TextMapPropagator {
302
302
  const matches = headerValue.trim().match(traceparentExpr)
303
303
  if (matches.length) {
304
304
  const [ version, traceId, spanId, flags, tail ] = matches.slice(1)
305
+ const traceparent = { version }
305
306
  const tracestate = TraceState.fromString(carrier.tracestate)
306
307
  if (invalidSegment.test(traceId)) return null
307
308
  if (invalidSegment.test(spanId)) return null
@@ -316,6 +317,7 @@ class TextMapPropagator {
316
317
  traceId: id(traceId, 16),
317
318
  spanId: id(spanId, 16),
318
319
  sampling: { priority: parseInt(flags, 10) & 1 ? 1 : 0 },
320
+ traceparent,
319
321
  tracestate
320
322
  })
321
323
 
@@ -14,6 +14,7 @@ class DatadogSpanContext {
14
14
  this._tags = props.tags || {}
15
15
  this._sampling = props.sampling || {}
16
16
  this._baggageItems = props.baggageItems || {}
17
+ this._traceparent = props.traceparent
17
18
  this._tracestate = props.tracestate
18
19
  this._noop = props.noop || null
19
20
  this._trace = props.trace || {
@@ -32,10 +33,11 @@ class DatadogSpanContext {
32
33
  }
33
34
 
34
35
  toTraceparent () {
35
- const sampling = this._sampling.priority >= AUTO_KEEP ? '01' : '00'
36
+ const flags = this._sampling.priority >= AUTO_KEEP ? '01' : '00'
36
37
  const traceId = this._traceId.toString(16).padStart(32, '0')
37
38
  const spanId = this._spanId.toString(16).padStart(16, '0')
38
- return `01-${traceId}-${spanId}-${sampling}`
39
+ const version = (this._traceparent && this._traceparent.version) || '00'
40
+ return `${version}-${traceId}-${spanId}-${flags}`
39
41
  }
40
42
  }
41
43