dd-trace 3.0.0-pre.2 → 3.0.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.
Files changed (51) hide show
  1. package/LICENSE-3rdparty.csv +1 -2
  2. package/MIGRATING.md +119 -0
  3. package/ci/init.js +0 -1
  4. package/ext/formats.js +3 -5
  5. package/index.d.ts +1 -11
  6. package/package.json +6 -7
  7. package/packages/datadog-core/src/storage/index.js +1 -1
  8. package/packages/datadog-instrumentations/index.js +1 -52
  9. package/packages/datadog-instrumentations/src/connect.js +1 -1
  10. package/packages/datadog-instrumentations/src/grpc/client.js +2 -2
  11. package/packages/datadog-instrumentations/src/grpc/server.js +1 -1
  12. package/packages/datadog-instrumentations/src/hapi.js +3 -31
  13. package/packages/datadog-instrumentations/src/helpers/hooks.js +68 -0
  14. package/packages/datadog-instrumentations/src/helpers/instrument.js +5 -34
  15. package/packages/datadog-instrumentations/src/helpers/instrumentations.js +3 -0
  16. package/packages/datadog-instrumentations/src/helpers/register.js +59 -0
  17. package/packages/datadog-instrumentations/src/koa.js +1 -1
  18. package/packages/datadog-instrumentations/src/mocha.js +4 -1
  19. package/packages/datadog-instrumentations/src/pg.js +2 -2
  20. package/packages/datadog-instrumentations/src/restify.js +27 -5
  21. package/packages/datadog-instrumentations/src/router.js +1 -1
  22. package/packages/datadog-plugin-aws-sdk/src/base.js +1 -2
  23. package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +1 -2
  24. package/packages/datadog-plugin-mocha/src/index.js +2 -2
  25. package/packages/datadog-plugin-restify/src/index.js +7 -0
  26. package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +220 -0
  27. package/packages/dd-trace/src/config.js +6 -0
  28. package/packages/dd-trace/src/{profiling/exporters → exporters/common}/form-data.js +0 -0
  29. package/packages/dd-trace/src/id.js +16 -13
  30. package/packages/dd-trace/src/iitm.js +1 -1
  31. package/packages/dd-trace/src/noop/scope.js +2 -6
  32. package/packages/dd-trace/src/noop/span.js +12 -12
  33. package/packages/dd-trace/src/noop/tracer.js +8 -5
  34. package/packages/dd-trace/src/opentracing/propagation/text_map.js +6 -6
  35. package/packages/dd-trace/src/opentracing/span.js +63 -49
  36. package/packages/dd-trace/src/opentracing/span_context.js +1 -5
  37. package/packages/dd-trace/src/opentracing/tracer.js +31 -36
  38. package/packages/dd-trace/src/plugin_manager.js +99 -68
  39. package/packages/dd-trace/src/plugins/index.js +57 -44
  40. package/packages/dd-trace/src/plugins/util/ci.js +34 -9
  41. package/packages/dd-trace/src/plugins/util/git.js +52 -2
  42. package/packages/dd-trace/src/plugins/util/tags.js +4 -1
  43. package/packages/dd-trace/src/plugins/util/web.js +1 -1
  44. package/packages/dd-trace/src/profiling/exporters/agent.js +1 -1
  45. package/packages/dd-trace/src/profiling/profilers/cpu.js +3 -3
  46. package/packages/dd-trace/src/proxy.js +16 -12
  47. package/packages/dd-trace/src/scope.js +1 -58
  48. package/packages/dd-trace/src/startup-log.js +8 -19
  49. package/packages/dd-trace/src/telemetry.js +1 -14
  50. package/scripts/install_plugin_modules.js +17 -26
  51. package/ci/jest/env.js +0 -38
@@ -6,7 +6,10 @@ const handlers = ['use', 'pre']
6
6
  const methods = ['del', 'get', 'head', 'opts', 'post', 'put', 'patch']
7
7
 
8
8
  const handleChannel = channel('apm:restify:request:handle')
9
- const routeChannel = channel('apm:restify:request:route')
9
+ const errorChannel = channel('apm:restify:middleware:error')
10
+ const enterChannel = channel('apm:restify:middleware:enter')
11
+ const exitChannel = channel('apm:restify:middleware:exit')
12
+ const nextChannel = channel('apm:restify:middleware:next')
10
13
 
11
14
  function wrapSetupRequest (setupRequest) {
12
15
  return function (req, res) {
@@ -37,18 +40,37 @@ function wrapFn (fn) {
37
40
  if (Array.isArray(fn)) return wrapMiddleware(fn)
38
41
 
39
42
  return function (req, res, next) {
40
- if (req.route) {
41
- routeChannel.publish({ req, route: req.route })
43
+ if (typeof next === 'function') {
44
+ arguments[2] = wrapNext(req, next)
42
45
  }
43
46
 
44
- return fn.apply(this, arguments)
47
+ const route = req.route && req.route.path
48
+
49
+ enterChannel.publish({ req, route })
50
+
51
+ try {
52
+ return fn.apply(this, arguments)
53
+ } catch (error) {
54
+ errorChannel.publish({ req, error })
55
+ nextChannel.publish({ req })
56
+ exitChannel.publish({ req })
57
+ }
58
+ }
59
+ }
60
+
61
+ function wrapNext (req, next) {
62
+ return function () {
63
+ nextChannel.publish({ req })
64
+ exitChannel.publish({ req })
65
+
66
+ next.apply(this, arguments)
45
67
  }
46
68
  }
47
69
 
48
70
  addHook({ name: 'restify', versions: ['>=3'], file: 'lib/server.js' }, Server => {
49
71
  shimmer.wrap(Server.prototype, '_setupRequest', wrapSetupRequest)
50
72
  shimmer.massWrap(Server.prototype, handlers, wrapHandler)
51
- shimmer.wrap(Server.prototype, methods, wrapMethod)
73
+ shimmer.massWrap(Server.prototype, methods, wrapMethod)
52
74
 
53
75
  return Server
54
76
  })
@@ -97,7 +97,7 @@ function createWrapRouterMethod (name) {
97
97
  nextChannel.publish({ req })
98
98
  exitChannel.publish({ req })
99
99
 
100
- next.apply(null, arguments)
100
+ next.apply(this, arguments)
101
101
  }
102
102
  }
103
103
 
@@ -1,6 +1,5 @@
1
1
  'use strict'
2
2
 
3
- const Tags = require('opentracing').Tags
4
3
  const analyticsSampler = require('../../dd-trace/src/analytics_sampler')
5
4
  const Plugin = require('../../dd-trace/src/plugins/plugin')
6
5
  const { storage } = require('../../datadog-core')
@@ -33,7 +32,7 @@ class BaseAwsSdkPlugin extends Plugin {
33
32
  const serviceName = this.getServiceName(serviceIdentifier)
34
33
  const childOf = this.tracer.scope().active()
35
34
  const tags = {
36
- [Tags.SPAN_KIND]: 'client',
35
+ 'span.kind': 'client',
37
36
  'service.name': serviceName,
38
37
  'aws.operation': operation,
39
38
  'aws.region': awsRegion,
@@ -1,6 +1,5 @@
1
1
  'use strict'
2
2
 
3
- const Tags = require('opentracing').Tags
4
3
  const log = require('../../../dd-trace/src/log')
5
4
  const BaseAwsSdkPlugin = require('../base')
6
5
  const { storage } = require('../../../datadog-core')
@@ -25,7 +24,7 @@ class Sqs extends BaseAwsSdkPlugin {
25
24
  tags: Object.assign(
26
25
  {},
27
26
  this.requestTags.get(request) || {},
28
- { [Tags.SPAN_KIND]: 'server' }
27
+ { 'span.kind': 'server' }
29
28
  )
30
29
  }
31
30
  const span = plugin.tracer.startSpan('aws.response', options)
@@ -161,12 +161,12 @@ class MochaPlugin extends Plugin {
161
161
  const testSuiteSpan = this._testSuites.get(test.parent)
162
162
 
163
163
  if (testSuiteSpan) {
164
- const testSuiteId = testSuiteSpan.context()._spanId.toString('hex')
164
+ const testSuiteId = testSuiteSpan.context()._spanId.toString(16)
165
165
  testSuiteTags[TEST_SUITE_ID] = testSuiteId
166
166
  }
167
167
 
168
168
  if (this.testSessionSpan) {
169
- const testSessionId = this.testSessionSpan.context()._traceId.toString('hex')
169
+ const testSessionId = this.testSessionSpan.context()._traceId.toString(16)
170
170
  testSuiteTags[TEST_SESSION_ID] = testSessionId
171
171
  testSuiteTags[TEST_COMMAND] = this.command
172
172
  }
@@ -19,6 +19,13 @@ class RestifyPlugin extends RouterPlugin {
19
19
  web.setRoute(req, route)
20
20
  })
21
21
  }
22
+
23
+ configure (config) {
24
+ return super.configure({
25
+ ...config,
26
+ middleware: false // not supported
27
+ })
28
+ }
22
29
  }
23
30
 
24
31
  module.exports = RestifyPlugin
@@ -0,0 +1,220 @@
1
+
2
+ const fs = require('fs')
3
+ const https = require('https')
4
+ const path = require('path')
5
+
6
+ const FormData = require('../../../exporters/common/form-data')
7
+
8
+ const log = require('../../../log')
9
+ const {
10
+ getLatestCommits,
11
+ getRepositoryUrl,
12
+ generatePackFilesForCommits,
13
+ getCommitsToUpload
14
+ } = require('../../../plugins/util/git')
15
+
16
+ const isValidSha = (sha) => /[0-9a-f]{40}/.test(sha)
17
+
18
+ function sanitizeCommits (commits) {
19
+ return commits.map(({ id: commitSha, type }) => {
20
+ if (type !== 'commit') {
21
+ throw new Error('Invalid commit response')
22
+ }
23
+ const sanitizedCommit = commitSha.replace(/[^0-9a-f]+/g, '')
24
+ if (sanitizedCommit !== commitSha || !isValidSha(sanitizedCommit)) {
25
+ throw new Error('Invalid commit format')
26
+ }
27
+ return sanitizedCommit
28
+ })
29
+ }
30
+
31
+ function getCommonRequestOptions (url) {
32
+ return {
33
+ method: 'POST',
34
+ headers: {
35
+ 'dd-api-key': process.env.DATADOG_API_KEY || process.env.DD_API_KEY
36
+ },
37
+ timeout: 15000,
38
+ protocol: url.protocol,
39
+ hostname: url.hostname,
40
+ port: url.port
41
+ }
42
+ }
43
+
44
+ /**
45
+ * This function posts the SHAs of the commits of the last month
46
+ * The response are the commits for which the backend already has information
47
+ * This response is used to know which commits can be ignored from there on
48
+ */
49
+ function getCommitsToExclude ({ url, repositoryUrl }, callback) {
50
+ const latestCommits = getLatestCommits()
51
+ const [headCommit] = latestCommits
52
+
53
+ const commonOptions = getCommonRequestOptions(url)
54
+
55
+ const options = {
56
+ ...commonOptions,
57
+ headers: {
58
+ ...commonOptions.headers,
59
+ 'Content-Type': 'application/json'
60
+ },
61
+ path: '/api/v2/git/repository/search_commits'
62
+ }
63
+
64
+ const localCommitData = JSON.stringify({
65
+ meta: {
66
+ repository_url: repositoryUrl
67
+ },
68
+ data: latestCommits.map(commit => ({
69
+ id: commit,
70
+ type: 'commit'
71
+ }))
72
+ })
73
+
74
+ const request = https.request(options, (res) => {
75
+ let responseData = ''
76
+
77
+ res.on('data', chunk => { responseData += chunk })
78
+ res.on('end', () => {
79
+ if (res.statusCode === 200) {
80
+ let commitsToExclude
81
+ try {
82
+ commitsToExclude = sanitizeCommits(JSON.parse(responseData).data)
83
+ } catch (e) {
84
+ callback(new Error(`Can't parse response: ${e.message}`))
85
+ return
86
+ }
87
+ callback(null, commitsToExclude, headCommit)
88
+ } else {
89
+ const error = new Error(`Error getting commits: ${res.statusCode} ${res.statusMessage}`)
90
+ callback(error)
91
+ }
92
+ })
93
+ })
94
+
95
+ request.write(localCommitData)
96
+ request.on('error', callback)
97
+
98
+ request.end()
99
+
100
+ return request
101
+ }
102
+
103
+ /**
104
+ * This function uploads a git packfile
105
+ */
106
+ function uploadPackFile ({ url, packFileToUpload, repositoryUrl, headCommit }, callback) {
107
+ const form = new FormData()
108
+
109
+ const pushedSha = JSON.stringify({
110
+ data: {
111
+ id: headCommit,
112
+ type: 'commit'
113
+ },
114
+ meta: {
115
+ repository_url: repositoryUrl
116
+ }
117
+ })
118
+
119
+ form.append('pushedSha', pushedSha, { contentType: 'application/json' })
120
+
121
+ try {
122
+ const packFileContent = fs.readFileSync(packFileToUpload)
123
+ // The original filename includes a random prefix, so we remove it here
124
+ const [, filename] = path.basename(packFileToUpload).split('-')
125
+ form.append('packfile', packFileContent, {
126
+ filename,
127
+ contentType: 'application/octet-stream'
128
+ })
129
+ } catch (e) {
130
+ callback(new Error(`Error reading packfile: ${packFileToUpload}`))
131
+ return
132
+ }
133
+
134
+ const commonOptions = getCommonRequestOptions(url)
135
+
136
+ const options = {
137
+ ...commonOptions,
138
+ path: '/api/v2/git/repository/packfile',
139
+ headers: {
140
+ ...commonOptions.headers,
141
+ ...form.getHeaders()
142
+ }
143
+ }
144
+
145
+ const req = https.request(options, res => {
146
+ res.on('data', () => {})
147
+ res.on('end', () => {
148
+ if (res.statusCode === 204) {
149
+ callback(null)
150
+ } else {
151
+ const error = new Error(`Error uploading packfiles: ${res.statusCode} ${res.statusMessage}`)
152
+ error.status = res.statusCode
153
+
154
+ callback(error)
155
+ }
156
+ })
157
+ })
158
+
159
+ req.on('error', err => {
160
+ callback(err)
161
+ })
162
+ form.pipe(req)
163
+ }
164
+
165
+ /**
166
+ * This function uploads git metadata to CI Visibility's backend.
167
+ */
168
+ function sendGitMetadata (site, callback) {
169
+ const url = new URL(`https://api.${site}`)
170
+
171
+ const repositoryUrl = getRepositoryUrl()
172
+
173
+ getCommitsToExclude({ url, repositoryUrl }, (err, commitsToExclude, headCommit) => {
174
+ if (err) {
175
+ callback(err)
176
+ return
177
+ }
178
+ const commitsToUpload = getCommitsToUpload(commitsToExclude)
179
+
180
+ if (!commitsToUpload.length) {
181
+ log.debug('No commits to upload')
182
+ callback(null)
183
+ return
184
+ }
185
+
186
+ const packFilesToUpload = generatePackFilesForCommits(commitsToUpload)
187
+
188
+ let packFileIndex = 0
189
+ // This uploads packfiles sequentially
190
+ const uploadPackFileCallback = (err) => {
191
+ if (err || packFileIndex === packFilesToUpload.length) {
192
+ callback(err)
193
+ return
194
+ }
195
+ return uploadPackFile(
196
+ {
197
+ packFileToUpload: packFilesToUpload[packFileIndex++],
198
+ url,
199
+ repositoryUrl,
200
+ headCommit
201
+ },
202
+ uploadPackFileCallback
203
+ )
204
+ }
205
+
206
+ uploadPackFile(
207
+ {
208
+ url,
209
+ packFileToUpload: packFilesToUpload[packFileIndex++],
210
+ repositoryUrl,
211
+ headCommit
212
+ },
213
+ uploadPackFileCallback
214
+ )
215
+ })
216
+ }
217
+
218
+ module.exports = {
219
+ sendGitMetadata
220
+ }
@@ -181,6 +181,11 @@ ken|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)
181
181
  |[\\-]{5}BEGIN[a-z\\s]+PRIVATE\\sKEY[\\-]{5}[^\\-]+[\\-]{5}END[a-z\\s]+PRIVATE\\sKEY|ssh-rsa\\s*[a-z0-9\\/\\.+]{100,}`
182
182
  )
183
183
 
184
+ const DD_CIVISIBILITY_GIT_UPLOAD_ENABLED = coalesce(
185
+ process.env.DD_CIVISIBILITY_GIT_UPLOAD_ENABLED,
186
+ false
187
+ )
188
+
184
189
  const sampler = (options.experimental && options.experimental.sampler) || {}
185
190
  const ingestion = options.ingestion || {}
186
191
  const dogstatsd = coalesce(options.dogstatsd, {})
@@ -256,6 +261,7 @@ ken|consumer_?(?:id|key|secret)|sign(?:ed|ature)?|auth(?:entication|orization)?)
256
261
  obfuscatorKeyRegex: DD_APPSEC_OBFUSCATION_PARAMETER_KEY_REGEXP,
257
262
  obfuscatorValueRegex: DD_APPSEC_OBFUSCATION_PARAMETER_VALUE_REGEXP
258
263
  }
264
+ this.isGitUploadEnabled = isTrue(DD_CIVISIBILITY_GIT_UPLOAD_ENABLED)
259
265
 
260
266
  tagger.add(this.tags, {
261
267
  service: this.service,
@@ -14,17 +14,17 @@ let batch = 0
14
14
 
15
15
  // Internal representation of a trace or span ID.
16
16
  class Identifier {
17
- constructor (value, radix) {
17
+ constructor (value, radix = 16) {
18
18
  this._isUint64BE = true // msgpack-lite compatibility
19
- this._buffer = typeof radix === 'number'
20
- ? fromString(value, radix)
21
- : createBuffer(value)
19
+ this._buffer = radix === 16
20
+ ? createBuffer(value)
21
+ : fromString(value, radix)
22
22
  }
23
23
 
24
- toString (radix) {
25
- return typeof radix === 'number'
26
- ? toNumberString(this._buffer, radix)
27
- : toHexString(this._buffer)
24
+ toString (radix = 16) {
25
+ return radix === 16
26
+ ? toHexString(this._buffer)
27
+ : toNumberString(this._buffer, radix)
28
28
  }
29
29
 
30
30
  toBuffer () {
@@ -49,10 +49,13 @@ function createBuffer (value) {
49
49
  if (value === '0') return zeroId
50
50
  if (!value) return pseudoRandom()
51
51
 
52
- const size = Math.ceil(value.length / 2)
53
- const buffer = new Array(size)
52
+ const size = Math.ceil(value.length / 16) * 16
53
+ const bytes = size / 2
54
+ const buffer = new Array(bytes)
54
55
 
55
- for (let i = 0; i < size; i++) {
56
+ value = value.padStart(size, '0')
57
+
58
+ for (let i = 0; i < bytes; i++) {
56
59
  buffer[i] = parseInt(value.substring(i * 2, i * 2 + 2), 16)
57
60
  }
58
61
 
@@ -100,8 +103,8 @@ function fromString (str, raddix) {
100
103
 
101
104
  // Convert a buffer to a numerical string.
102
105
  function toNumberString (buffer, radix) {
103
- let high = readInt32(buffer, 0)
104
- let low = readInt32(buffer, 4)
106
+ let high = readInt32(buffer, buffer.length - 8)
107
+ let low = readInt32(buffer, buffer.length - 4)
105
108
  let str = ''
106
109
 
107
110
  radix = radix || 10
@@ -3,7 +3,7 @@
3
3
  const semver = require('semver')
4
4
  const logger = require('./log')
5
5
 
6
- if (semver.satisfies(process.versions.node, '^12.20.0 || >=14.13.1')) {
6
+ if (semver.satisfies(process.versions.node, '>=14.13.1')) {
7
7
  module.exports = require('import-in-the-middle')
8
8
  } else {
9
9
  logger.warn('ESM is not fully supported by this version of Node.js, ' +
@@ -11,12 +11,8 @@ class Scope {
11
11
  return callback()
12
12
  }
13
13
 
14
- bind (target, span) {
15
- return target
16
- }
17
-
18
- unbind (target) {
19
- return target
14
+ bind (fn, span) {
15
+ return fn
20
16
  }
21
17
  }
22
18
 
@@ -1,26 +1,26 @@
1
1
  'use strict'
2
2
 
3
- const Span = require('opentracing').Span
4
- const NoopSpanContext = require('../noop/span_context')
3
+ const NoopSpanContext = require('./span_context')
5
4
  const id = require('../id')
6
5
  const { storage } = require('../../../datadog-core') // TODO: noop storage?
7
6
 
8
- class NoopSpan extends Span {
7
+ class NoopSpan {
9
8
  constructor (tracer, parent) {
10
- super()
11
-
12
9
  this._store = storage.getStore()
13
10
  this._noopTracer = tracer
14
11
  this._noopContext = this._createContext(parent)
15
12
  }
16
13
 
17
- _context () {
18
- return this._noopContext
19
- }
20
-
21
- _tracer () {
22
- return this._noopTracer
23
- }
14
+ context () { return this._noopContext }
15
+ tracer () { return this._noopTracer }
16
+ setOperationName (name) { return this }
17
+ setBaggageItem (key, value) { return this }
18
+ getBaggageItem (key) {}
19
+ setTag (key, value) { return this }
20
+ addTags (keyValueMap) { return this }
21
+ log () { return this }
22
+ logEvent () {}
23
+ finish (finishTime) {}
24
24
 
25
25
  _createContext (parent) {
26
26
  const spanId = id()
@@ -1,13 +1,10 @@
1
1
  'use strict'
2
2
 
3
- const Tracer = require('opentracing').Tracer
4
3
  const Scope = require('../noop/scope')
5
4
  const Span = require('./span')
6
5
 
7
- class NoopTracer extends Tracer {
6
+ class NoopTracer {
8
7
  constructor (config) {
9
- super(config)
10
-
11
8
  this._scope = new Scope()
12
9
  this._span = new Span(this)
13
10
  }
@@ -31,10 +28,16 @@ class NoopTracer extends Tracer {
31
28
  setUrl () {
32
29
  }
33
30
 
34
- _startSpan (name, options) {
31
+ startSpan (name, options) {
35
32
  return this._span
36
33
  }
37
34
 
35
+ inject (spanContext, format, carrier) {}
36
+
37
+ extract (format, carrier) {
38
+ return this._span.context()
39
+ }
40
+
38
41
  setUser () {
39
42
  return this
40
43
  }
@@ -82,8 +82,8 @@ class TextMapPropagator {
82
82
  _injectB3 (spanContext, carrier) {
83
83
  if (!this._config.experimental.b3) return
84
84
 
85
- carrier[b3TraceKey] = spanContext._traceId.toString('hex')
86
- carrier[b3SpanKey] = spanContext._spanId.toString('hex')
85
+ carrier[b3TraceKey] = spanContext._traceId.toString(16)
86
+ carrier[b3SpanKey] = spanContext._spanId.toString(16)
87
87
  carrier[b3SampledKey] = spanContext._sampling.priority >= AUTO_KEEP ? '1' : '0'
88
88
 
89
89
  if (spanContext._sampling.priority > AUTO_KEEP) {
@@ -91,7 +91,7 @@ class TextMapPropagator {
91
91
  }
92
92
 
93
93
  if (spanContext._parentId) {
94
- carrier[b3ParentKey] = spanContext._parentId.toString('hex')
94
+ carrier[b3ParentKey] = spanContext._parentId.toString(16)
95
95
  }
96
96
  }
97
97
 
@@ -99,8 +99,8 @@ class TextMapPropagator {
99
99
  if (!this._config.experimental.traceparent) return
100
100
 
101
101
  const sampling = spanContext._sampling.priority >= AUTO_KEEP ? '01' : '00'
102
- const traceId = spanContext._traceId.toString('hex').padStart(32, '0')
103
- const spanId = spanContext._spanId.toString('hex').padStart(16, '0')
102
+ const traceId = spanContext._traceId.toString(16).padStart(32, '0')
103
+ const spanId = spanContext._spanId.toString(16).padStart(16, '0')
104
104
  carrier[traceparentKey] = `01-${traceId}-${spanId}-${sampling}`
105
105
  }
106
106
 
@@ -129,7 +129,7 @@ class TextMapPropagator {
129
129
  const b3 = this._extractB3Headers(carrier)
130
130
  const debug = b3[b3FlagsKey] === '1'
131
131
  const priority = this._getPriority(b3[b3SampledKey], debug)
132
- const spanContext = this._extractGenericContext(b3, b3TraceKey, b3SpanKey)
132
+ const spanContext = this._extractGenericContext(b3, b3TraceKey, b3SpanKey, 16)
133
133
 
134
134
  if (priority !== undefined) {
135
135
  if (!spanContext) {