dd-trace 2.3.0 → 2.4.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.
Files changed (52) hide show
  1. package/ci/init.js +26 -2
  2. package/index.d.ts +51 -0
  3. package/package.json +2 -2
  4. package/packages/datadog-instrumentations/index.js +10 -0
  5. package/packages/datadog-instrumentations/src/amqp10.js +70 -0
  6. package/packages/datadog-instrumentations/src/amqplib.js +58 -0
  7. package/packages/datadog-instrumentations/src/cassandra-driver.js +191 -0
  8. package/packages/datadog-instrumentations/src/cucumber.js +27 -12
  9. package/packages/datadog-instrumentations/src/helpers/hook.js +44 -0
  10. package/packages/datadog-instrumentations/src/helpers/instrument.js +31 -58
  11. package/packages/datadog-instrumentations/src/http/client.js +170 -0
  12. package/packages/datadog-instrumentations/src/http/server.js +61 -0
  13. package/packages/datadog-instrumentations/src/http.js +4 -0
  14. package/packages/datadog-instrumentations/src/mocha.js +139 -0
  15. package/packages/datadog-instrumentations/src/mongodb-core.js +179 -0
  16. package/packages/datadog-instrumentations/src/net.js +117 -0
  17. package/packages/datadog-instrumentations/src/pg.js +75 -0
  18. package/packages/datadog-instrumentations/src/rhea.js +224 -0
  19. package/packages/datadog-instrumentations/src/tedious.js +66 -0
  20. package/packages/datadog-plugin-amqp10/src/index.js +79 -122
  21. package/packages/datadog-plugin-amqplib/src/index.js +77 -142
  22. package/packages/datadog-plugin-aws-sdk/src/services/sns.js +2 -2
  23. package/packages/datadog-plugin-cassandra-driver/src/index.js +52 -224
  24. package/packages/datadog-plugin-cucumber/src/index.js +3 -1
  25. package/packages/datadog-plugin-http/src/client.js +111 -254
  26. package/packages/datadog-plugin-http/src/index.js +29 -3
  27. package/packages/datadog-plugin-http/src/server.js +49 -32
  28. package/packages/datadog-plugin-jest/src/jest-jasmine2.js +5 -3
  29. package/packages/datadog-plugin-mocha/src/index.js +96 -207
  30. package/packages/datadog-plugin-mongodb-core/src/index.js +119 -3
  31. package/packages/datadog-plugin-net/src/index.js +65 -121
  32. package/packages/datadog-plugin-next/src/index.js +10 -10
  33. package/packages/datadog-plugin-pg/src/index.js +32 -69
  34. package/packages/datadog-plugin-rhea/src/index.js +59 -225
  35. package/packages/datadog-plugin-tedious/src/index.js +38 -86
  36. package/packages/dd-trace/lib/version.js +1 -1
  37. package/packages/dd-trace/src/appsec/recommended.json +137 -116
  38. package/packages/dd-trace/src/config.js +6 -0
  39. package/packages/dd-trace/src/iitm.js +5 -1
  40. package/packages/dd-trace/src/loader.js +6 -4
  41. package/packages/dd-trace/src/noop/tracer.js +4 -0
  42. package/packages/dd-trace/src/opentracing/propagation/text_map.js +34 -1
  43. package/packages/dd-trace/src/opentracing/span.js +34 -0
  44. package/packages/dd-trace/src/plugin_manager.js +4 -0
  45. package/packages/dd-trace/src/plugins/plugin.js +3 -1
  46. package/packages/dd-trace/src/plugins/util/web.js +99 -93
  47. package/packages/dd-trace/src/proxy.js +4 -0
  48. package/packages/dd-trace/src/ritm.js +60 -25
  49. package/packages/dd-trace/src/tracer.js +16 -0
  50. package/packages/datadog-plugin-mongodb-core/src/legacy.js +0 -59
  51. package/packages/datadog-plugin-mongodb-core/src/unified.js +0 -138
  52. package/packages/datadog-plugin-mongodb-core/src/util.js +0 -143
@@ -52,10 +52,36 @@ const web = {
52
52
  })
53
53
  },
54
54
 
55
+ startSpan (tracer, config, req, res, name) {
56
+ const context = this.patch(req)
57
+ context.config = config
58
+
59
+ let span
60
+
61
+ if (context.span) {
62
+ context.span.context()._name = name
63
+ span = context.span
64
+ } else {
65
+ span = web.startChildSpan(tracer, name, req.headers)
66
+ }
67
+
68
+ context.tracer = tracer
69
+ context.span = span
70
+ context.res = res
71
+
72
+ return span
73
+ },
74
+ wrap (req) {
75
+ const context = contexts.get(req)
76
+ if (!context.instrumented) {
77
+ this.wrapEnd(context)
78
+ this.wrapEvents(context)
79
+ context.instrumented = true
80
+ }
81
+ },
55
82
  // Start a span and activate a scope for a request.
56
83
  instrument (tracer, config, req, res, name, callback) {
57
- const context = this.patch(req)
58
- const span = startSpan(tracer, config, req, res, name)
84
+ const span = this.startSpan(tracer, config, req, res, name)
59
85
 
60
86
  if (!config.filter(req.url)) {
61
87
  span.setTag(MANUAL_DROP, true)
@@ -67,12 +93,7 @@ const web = {
67
93
 
68
94
  analyticsSampler.sample(span, config.measured, true)
69
95
 
70
- if (!context.instrumented) {
71
- wrapEnd(context)
72
- wrapEvents(context)
73
-
74
- context.instrumented = true
75
- }
96
+ this.wrap(req)
76
97
 
77
98
  return callback && tracer.scope().activate(span, () => callback(span))
78
99
  },
@@ -199,6 +220,7 @@ const web = {
199
220
  // Extract the parent span from the headers and start a new span as its child
200
221
  startChildSpan (tracer, name, headers) {
201
222
  const childOf = tracer.scope().active() || tracer.extract(FORMAT_HTTP_HEADERS, headers)
223
+
202
224
  const span = tracer.startSpan(name, { childOf })
203
225
 
204
226
  return span
@@ -221,103 +243,94 @@ const web = {
221
243
  const context = contexts.get(req)
222
244
  context.error = context.error || error
223
245
  }
224
- }
225
- }
226
-
227
- function startSpan (tracer, config, req, res, name) {
228
- const context = contexts.get(req)
229
-
230
- context.config = config
231
-
232
- let span
233
-
234
- if (context.span) {
235
- context.span.context()._name = name
236
- span = context.span
237
- } else {
238
- span = web.startChildSpan(tracer, name, req.headers)
239
- }
240
-
241
- context.tracer = tracer
242
- context.span = span
243
- context.res = res
244
-
245
- return span
246
- }
246
+ },
247
247
 
248
- function finish (context) {
249
- const { req, res } = context
248
+ finishMiddleware (context) {
249
+ if (context.finished) return
250
250
 
251
- if (context.finished && !req.stream) return
251
+ let span
252
252
 
253
- addRequestTags(context)
254
- addResponseTags(context)
253
+ while ((span = context.middleware.pop())) {
254
+ span.finish()
255
+ }
256
+ },
255
257
 
256
- context.config.hooks.request(context.span, req, res)
257
- addResourceTag(context)
258
+ finishSpan (context) {
259
+ const { req, res } = context
258
260
 
259
- context.span.finish()
260
- context.finished = true
261
- }
261
+ if (context.finished && !req.stream) return
262
262
 
263
- function finishMiddleware (context) {
264
- if (context.finished) return
263
+ addRequestTags(context)
264
+ addResponseTags(context)
265
265
 
266
- let span
266
+ context.config.hooks.request(context.span, req, res)
267
+ addResourceTag(context)
267
268
 
268
- while ((span = context.middleware.pop())) {
269
- span.finish()
270
- }
271
- }
269
+ context.span.finish()
270
+ context.finished = true
271
+ },
272
+ wrapWriteHead (context) {
273
+ const { req, res } = context
274
+ const writeHead = res.writeHead
272
275
 
273
- function wrapEnd (context) {
274
- const scope = context.tracer.scope()
275
- const req = context.req
276
- const res = context.res
277
- const end = res.end
276
+ return function (statusCode, statusMessage, headers) {
277
+ headers = typeof statusMessage === 'string' ? headers : statusMessage
278
+ headers = Object.assign(res.getHeaders(), headers)
278
279
 
279
- res.writeHead = wrapWriteHead(context)
280
+ if (req.method.toLowerCase() === 'options' && isOriginAllowed(req, headers)) {
281
+ addAllowHeaders(req, res, headers)
282
+ }
280
283
 
281
- ends.set(res, function () {
282
- for (const beforeEnd of context.beforeEnd) {
283
- beforeEnd()
284
+ return writeHead.apply(this, arguments)
284
285
  }
286
+ },
287
+ getContext (req) {
288
+ return contexts.get(req)
289
+ },
290
+ wrapRes (context, req, res, end) {
291
+ return function () {
292
+ for (const beforeEnd of context.beforeEnd) {
293
+ beforeEnd()
294
+ }
285
295
 
286
- finishMiddleware(context)
287
-
288
- if (incomingHttpRequestEnd.hasSubscribers) incomingHttpRequestEnd.publish({ req, res })
289
-
290
- const returnValue = end.apply(res, arguments)
291
-
292
- finish(context)
293
-
294
- return returnValue
295
- })
296
+ web.finishMiddleware(context)
296
297
 
297
- Object.defineProperty(res, 'end', {
298
- configurable: true,
299
- get () {
300
- return ends.get(this)
301
- },
302
- set (value) {
303
- ends.set(this, scope.bind(value, context.span))
304
- }
305
- })
306
- }
298
+ if (incomingHttpRequestEnd.hasSubscribers) {
299
+ incomingHttpRequestEnd.publish({ req, res })
300
+ }
307
301
 
308
- function wrapWriteHead (context) {
309
- const { req, res } = context
310
- const writeHead = res.writeHead
302
+ const returnValue = end.apply(res, arguments)
311
303
 
312
- return function (statusCode, statusMessage, headers) {
313
- headers = typeof statusMessage === 'string' ? headers : statusMessage
314
- headers = Object.assign(res.getHeaders(), headers)
304
+ web.finishSpan(context)
315
305
 
316
- if (req.method.toLowerCase() === 'options' && isOriginAllowed(req, headers)) {
317
- addAllowHeaders(req, res, headers)
306
+ return returnValue
318
307
  }
308
+ },
309
+ wrapEnd (context) {
310
+ const scope = context.tracer.scope()
311
+ const req = context.req
312
+ const res = context.res
313
+ const end = res.end
314
+
315
+ res.writeHead = web.wrapWriteHead(context)
316
+
317
+ ends.set(res, this.wrapRes(context, req, res, end))
318
+
319
+ Object.defineProperty(res, 'end', {
320
+ configurable: true,
321
+ get () {
322
+ return ends.get(this)
323
+ },
324
+ set (value) {
325
+ ends.set(this, scope.bind(value, context.span))
326
+ }
327
+ })
328
+ },
329
+ wrapEvents (context) {
330
+ const scope = context.tracer.scope()
331
+ const res = context.res
319
332
 
320
- return writeHead.apply(this, arguments)
333
+ scope.bind(res, context.span)
321
334
  }
322
335
  }
323
336
 
@@ -354,13 +367,6 @@ function splitHeader (str) {
354
367
  return typeof str === 'string' ? str.split(/\s*,\s*/) : []
355
368
  }
356
369
 
357
- function wrapEvents (context) {
358
- const scope = context.tracer.scope()
359
- const res = context.res
360
-
361
- scope.bind(res, context.span)
362
- }
363
-
364
370
  function reactivate (req, fn) {
365
371
  const context = contexts.get(req)
366
372
 
@@ -141,6 +141,10 @@ class Tracer extends BaseTracer {
141
141
  getRumData () {
142
142
  return this._tracer.getRumData.apply(this._tracer, arguments)
143
143
  }
144
+
145
+ setUser () {
146
+ return this._tracer.setUser.apply(this.tracer, arguments)
147
+ }
144
148
  }
145
149
 
146
150
  module.exports = Tracer
@@ -10,9 +10,10 @@ const origRequire = Module.prototype.require
10
10
 
11
11
  module.exports = Hook
12
12
 
13
- Hook.reset = function () {
14
- Module.prototype.require = origRequire
15
- }
13
+ let moduleHooks = Object.create(null)
14
+ let cache = Object.create(null)
15
+ let patching = Object.create(null)
16
+ let patchedRequire = null
16
17
 
17
18
  function Hook (modules, options, onrequire) {
18
19
  if (!(this instanceof Hook)) return new Hook(modules, options, onrequire)
@@ -25,35 +26,40 @@ function Hook (modules, options, onrequire) {
25
26
  options = {}
26
27
  }
27
28
 
29
+ modules = modules || []
28
30
  options = options || {}
29
31
 
30
- this.cache = {}
31
- this._unhooked = false
32
- this._origRequire = Module.prototype.require
32
+ this.modules = modules
33
+ this.options = options
34
+ this.onrequire = onrequire
33
35
 
34
- const self = this
35
- const patching = {}
36
+ if (Array.isArray(modules)) {
37
+ for (const mod of modules) {
38
+ const hooks = moduleHooks[mod]
36
39
 
37
- this._require = Module.prototype.require = function (request) {
38
- if (self._unhooked) {
39
- // if the patched require function could not be removed because
40
- // someone else patched it after it was patched here, we just
41
- // abort and pass the request onwards to the original require
42
- return self._origRequire.apply(this, arguments)
40
+ if (hooks) {
41
+ hooks.push(onrequire)
42
+ } else {
43
+ moduleHooks[mod] = [onrequire]
44
+ }
43
45
  }
46
+ }
44
47
 
48
+ if (patchedRequire) return
49
+
50
+ patchedRequire = Module.prototype.require = function (request) {
45
51
  const filename = Module._resolveFilename(request, this)
46
52
  const core = filename.indexOf(path.sep) === -1
47
- let name, basedir
53
+ let name, basedir, hooks
48
54
 
49
55
  // return known patched modules immediately
50
- if (self.cache.hasOwnProperty(filename)) {
56
+ if (cache[filename]) {
51
57
  // require.cache was potentially altered externally
52
- if (require.cache[filename] && require.cache[filename].exports !== self.cache[filename].original) {
58
+ if (require.cache[filename] && require.cache[filename].exports !== cache[filename].original) {
53
59
  return require.cache[filename].exports
54
60
  }
55
61
 
56
- return self.cache[filename].exports
62
+ return cache[filename].exports
57
63
  }
58
64
 
59
65
  // Check if this module has a patcher in-progress already.
@@ -63,7 +69,7 @@ function Hook (modules, options, onrequire) {
63
69
  patching[filename] = true
64
70
  }
65
71
 
66
- const exports = self._origRequire.apply(this, arguments)
72
+ const exports = origRequire.apply(this, arguments)
67
73
 
68
74
  // If it's already patched, just return it as-is.
69
75
  if (patched) return exports
@@ -73,7 +79,8 @@ function Hook (modules, options, onrequire) {
73
79
  delete patching[filename]
74
80
 
75
81
  if (core) {
76
- if (modules && modules.indexOf(filename) === -1) return exports // abort if module name isn't on whitelist
82
+ hooks = moduleHooks[filename]
83
+ if (!hooks) return exports // abort if module name isn't on whitelist
77
84
  name = filename
78
85
  } else {
79
86
  const stat = parse(filename)
@@ -81,7 +88,8 @@ function Hook (modules, options, onrequire) {
81
88
  name = stat.name
82
89
  basedir = stat.basedir
83
90
 
84
- if (modules && modules.indexOf(name) === -1) return exports // abort if module name isn't on whitelist
91
+ hooks = moduleHooks[name]
92
+ if (!hooks) return exports // abort if module name isn't on whitelist
85
93
 
86
94
  // figure out if this is the main module file, or a file inside the module
87
95
  const paths = Module._resolveLookupPaths(name, this, true)
@@ -99,10 +107,37 @@ function Hook (modules, options, onrequire) {
99
107
 
100
108
  // ensure that the cache entry is assigned a value before calling
101
109
  // onrequire, in case calling onrequire requires the same module.
102
- self.cache[filename] = { exports }
103
- self.cache[filename].original = exports
104
- self.cache[filename].exports = onrequire(exports, name, basedir)
110
+ cache[filename] = { exports }
111
+ cache[filename].original = exports
112
+
113
+ for (const hook of hooks) {
114
+ cache[filename].exports = hook(cache[filename].exports, name, basedir)
115
+ }
116
+
117
+ return cache[filename].exports
118
+ }
119
+ }
120
+
121
+ Hook.reset = function () {
122
+ Module.prototype.require = origRequire
123
+ patchedRequire = null
124
+ patching = Object.create(null)
125
+ cache = Object.create(null)
126
+ moduleHooks = Object.create(null)
127
+ }
128
+
129
+ Hook.prototype.unhook = function () {
130
+ for (const mod of this.modules) {
131
+ const hooks = (moduleHooks[mod] || []).filter(hook => hook !== this.onrequire)
132
+
133
+ if (hooks.length > 0) {
134
+ moduleHooks[mod] = hooks
135
+ } else {
136
+ delete moduleHooks[mod]
137
+ }
138
+ }
105
139
 
106
- return self.cache[filename].exports
140
+ if (Object.keys(moduleHooks).length === 0) {
141
+ Hook.reset()
107
142
  }
108
143
  }
@@ -122,6 +122,22 @@ class DatadogTracer extends Tracer {
122
122
  <meta name="dd-trace-id" content="${traceId}" />\
123
123
  <meta name="dd-trace-time" content="${traceTime}" />`
124
124
  }
125
+
126
+ setUser (user) {
127
+ if (!user || !user.id) return this
128
+
129
+ const span = this.scope().active()
130
+ if (!span) return this
131
+
132
+ const rootSpan = span._spanContext._trace.started[0]
133
+ if (!rootSpan) return this
134
+
135
+ for (const k of Object.keys(user)) {
136
+ rootSpan.setTag(`usr.${k}`, '' + user[k])
137
+ }
138
+
139
+ return this
140
+ }
125
141
  }
126
142
 
127
143
  function addError (span, error) {
@@ -1,59 +0,0 @@
1
- 'use strict'
2
-
3
- const { instrument } = require('./util')
4
-
5
- function createWrapCommand (tracer, config, name) {
6
- return function wrapCommand (command) {
7
- return function commandWithTrace (ns, ops) {
8
- return instrument(command, this, arguments, this, ns, ops, tracer, config, { name })
9
- }
10
- }
11
- }
12
-
13
- function createWrapQuery (tracer, config) {
14
- return function wrapQuery (query) {
15
- return function queryWithTrace () {
16
- const pool = this.server.s.pool
17
- const ns = this.ns
18
- const ops = this.cmd
19
-
20
- return instrument(query, this, arguments, pool, ns, ops, tracer, config)
21
- }
22
- }
23
- }
24
-
25
- function createWrapCursor (tracer, config, name) {
26
- return function wrapCursor (cursor) {
27
- return function cursorWithTrace () {
28
- const pool = this.server.s.pool
29
- const ns = this.ns
30
-
31
- return instrument(cursor, this, arguments, pool, ns, {}, tracer, config, { name })
32
- }
33
- }
34
- }
35
-
36
- module.exports = [
37
- {
38
- name: 'mongodb-core',
39
- versions: ['2 - 3.1.9'],
40
- patch ({ Cursor, Server }, tracer, config) {
41
- this.wrap(Server.prototype, 'command', createWrapCommand(tracer, config))
42
- this.wrap(Server.prototype, 'insert', createWrapCommand(tracer, config, 'insert'))
43
- this.wrap(Server.prototype, 'update', createWrapCommand(tracer, config, 'update'))
44
- this.wrap(Server.prototype, 'remove', createWrapCommand(tracer, config, 'remove'))
45
- this.wrap(Cursor.prototype, '_getmore', createWrapCursor(tracer, config, 'getMore'))
46
- this.wrap(Cursor.prototype, '_find', createWrapQuery(tracer, config))
47
- this.wrap(Cursor.prototype, 'kill', createWrapCursor(tracer, config, 'killCursors'))
48
- },
49
- unpatch ({ Cursor, Server }) {
50
- this.unwrap(Server.prototype, 'command')
51
- this.unwrap(Server.prototype, 'insert')
52
- this.unwrap(Server.prototype, 'update')
53
- this.unwrap(Server.prototype, 'remove')
54
- this.unwrap(Cursor.prototype, '_getmore')
55
- this.unwrap(Cursor.prototype, '_find')
56
- this.unwrap(Cursor.prototype, 'kill')
57
- }
58
- }
59
- ]
@@ -1,138 +0,0 @@
1
- 'use strict'
2
-
3
- const { instrument } = require('./util')
4
-
5
- function createWrapConnectionCommand (tracer, config, name) {
6
- return function wrapCommand (command) {
7
- return function commandWithTrace (ns, ops) {
8
- const hostParts = typeof this.address === 'string' ? this.address.split(':') : ''
9
- const options = hostParts.length === 2
10
- ? { host: hostParts[0], port: hostParts[1] }
11
- : {} // no port means the address is a random UUID so no host either
12
- const topology = { s: { options } }
13
-
14
- ns = `${ns.db}.${ns.collection}`
15
-
16
- return instrument(command, this, arguments, topology, ns, ops, tracer, config, { name })
17
- }
18
- }
19
- }
20
-
21
- function createWrapCommand (tracer, config, name) {
22
- return function wrapCommand (command) {
23
- return function commandWithTrace (server, ns, ops) {
24
- return instrument(command, this, arguments, server, ns, ops, tracer, config, { name })
25
- }
26
- }
27
- }
28
-
29
- function createWrapMaybePromise (tracer, config) {
30
- return function wrapMaybePromise (maybePromise) {
31
- return function maybePromiseWithTrace (parent, callback, fn) {
32
- const callbackIndex = arguments.length - 2
33
-
34
- callback = arguments[callbackIndex]
35
-
36
- if (typeof callback === 'function') {
37
- arguments[callbackIndex] = tracer.scope().bind(callback)
38
- }
39
-
40
- return maybePromise.apply(this, arguments)
41
- }
42
- }
43
- }
44
-
45
- function patch (wp, tracer, config) {
46
- this.wrap(wp, 'command', createWrapCommand(tracer, config))
47
- this.wrap(wp, 'insert', createWrapCommand(tracer, config, 'insert'))
48
- this.wrap(wp, 'update', createWrapCommand(tracer, config, 'update'))
49
- this.wrap(wp, 'remove', createWrapCommand(tracer, config, 'remove'))
50
- this.wrap(wp, 'query', createWrapCommand(tracer, config))
51
- this.wrap(wp, 'getMore', createWrapCommand(tracer, config, 'getMore'))
52
- this.wrap(wp, 'killCursors', createWrapCommand(tracer, config, 'killCursors'))
53
- }
54
-
55
- function unpatch (wp) {
56
- this.unwrap(wp, 'command')
57
- this.unwrap(wp, 'insert')
58
- this.unwrap(wp, 'update')
59
- this.unwrap(wp, 'remove')
60
- this.unwrap(wp, 'query')
61
- this.unwrap(wp, 'getMore')
62
- this.unwrap(wp, 'killCursors')
63
- }
64
-
65
- function patchConnection ({ Connection }, tracer, config) {
66
- const proto = Connection.prototype
67
-
68
- this.wrap(proto, 'command', createWrapConnectionCommand(tracer, config))
69
- this.wrap(proto, 'query', createWrapConnectionCommand(tracer, config))
70
- this.wrap(proto, 'getMore', createWrapConnectionCommand(tracer, config, 'getMore'))
71
- this.wrap(proto, 'killCursors', createWrapConnectionCommand(tracer, config, 'killCursors'))
72
- }
73
-
74
- function unpatchConnection ({ Connection }) {
75
- const proto = Connection.prototype
76
-
77
- this.unwrap(proto, 'command')
78
- this.unwrap(proto, 'query')
79
- this.unwrap(proto, 'getMore')
80
- this.unwrap(proto, 'killCursors')
81
- }
82
-
83
- function patchClass (WireProtocol, tracer, config) {
84
- this.wrap(WireProtocol.prototype, 'command', createWrapCommand(tracer, config))
85
- }
86
-
87
- function unpatchClass (WireProtocol) {
88
- this.unwrap(WireProtocol.prototype, 'command')
89
- }
90
-
91
- module.exports = [
92
- {
93
- name: 'mongodb',
94
- versions: ['>=4'],
95
- file: 'lib/cmap/connection.js',
96
- patch: patchConnection,
97
- unpatch: unpatchConnection
98
- },
99
- {
100
- name: 'mongodb',
101
- versions: ['>=3.5.4'],
102
- file: 'lib/utils.js',
103
- patch (util, tracer, config) {
104
- this.wrap(util, 'maybePromise', createWrapMaybePromise(tracer, config))
105
- },
106
- unpatch (util) {
107
- this.unwrap(util, 'maybePromise')
108
- }
109
- },
110
- {
111
- name: 'mongodb',
112
- versions: ['>=3.3 <4'],
113
- file: 'lib/core/wireprotocol/index.js',
114
- patch,
115
- unpatch
116
- },
117
- {
118
- name: 'mongodb-core',
119
- versions: ['>=3.2'],
120
- file: 'lib/wireprotocol/index.js',
121
- patch,
122
- unpatch
123
- },
124
- {
125
- name: 'mongodb-core',
126
- versions: ['~3.1.10'],
127
- file: 'lib/wireprotocol/3_2_support.js',
128
- patch: patchClass,
129
- unpatch: unpatchClass
130
- },
131
- {
132
- name: 'mongodb-core',
133
- versions: ['~3.1.10'],
134
- file: 'lib/wireprotocol/2_6_support.js',
135
- patch: patchClass,
136
- unpatch: unpatchClass
137
- }
138
- ]