dd-trace 2.1.0 → 2.2.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 (59) hide show
  1. package/LICENSE-3rdparty.csv +0 -2
  2. package/index.d.ts +22 -12
  3. package/package.json +3 -5
  4. package/packages/datadog-instrumentations/index.js +13 -3
  5. package/packages/datadog-instrumentations/src/bunyan.js +22 -0
  6. package/packages/datadog-instrumentations/src/couchbase.js +143 -0
  7. package/packages/datadog-instrumentations/src/elasticsearch.js +79 -0
  8. package/packages/datadog-instrumentations/src/generic-pool.js +48 -0
  9. package/packages/datadog-instrumentations/src/ioredis.js +49 -0
  10. package/packages/datadog-instrumentations/src/mongoose.js +30 -0
  11. package/packages/datadog-instrumentations/src/mysql.js +2 -2
  12. package/packages/datadog-instrumentations/src/mysql2.js +5 -5
  13. package/packages/datadog-instrumentations/src/pino.js +105 -0
  14. package/packages/datadog-instrumentations/src/redis.js +118 -0
  15. package/packages/datadog-instrumentations/src/sharedb.js +78 -0
  16. package/packages/datadog-instrumentations/src/winston.js +57 -0
  17. package/packages/datadog-plugin-aws-sdk/src/helpers.js +1 -1
  18. package/packages/datadog-plugin-bunyan/src/index.js +5 -22
  19. package/packages/datadog-plugin-couchbase/src/index.js +51 -148
  20. package/packages/datadog-plugin-elasticsearch/src/index.js +41 -82
  21. package/packages/datadog-plugin-fastify/src/fastify.js +22 -1
  22. package/packages/datadog-plugin-fastify/src/find-my-way.js +0 -1
  23. package/packages/datadog-plugin-google-cloud-pubsub/src/index.js +8 -6
  24. package/packages/datadog-plugin-graphql/src/index.js +34 -28
  25. package/packages/datadog-plugin-grpc/src/client.js +20 -6
  26. package/packages/datadog-plugin-http2/src/server.js +2 -0
  27. package/packages/datadog-plugin-ioredis/src/index.js +5 -35
  28. package/packages/datadog-plugin-jest/src/jest-environment.js +26 -30
  29. package/packages/datadog-plugin-koa/src/index.js +6 -2
  30. package/packages/datadog-plugin-microgateway-core/src/index.js +1 -3
  31. package/packages/datadog-plugin-mocha/src/index.js +5 -3
  32. package/packages/datadog-plugin-mongodb-core/src/util.js +31 -7
  33. package/packages/datadog-plugin-mysql/src/index.js +4 -5
  34. package/packages/datadog-plugin-mysql2/src/index.js +11 -0
  35. package/packages/datadog-plugin-next/src/index.js +9 -4
  36. package/packages/datadog-plugin-oracledb/src/index.js +10 -7
  37. package/packages/datadog-plugin-pino/src/index.js +5 -158
  38. package/packages/datadog-plugin-redis/src/index.js +96 -80
  39. package/packages/datadog-plugin-restify/src/index.js +18 -3
  40. package/packages/datadog-plugin-rhea/src/index.js +8 -5
  41. package/packages/datadog-plugin-router/src/index.js +23 -14
  42. package/packages/datadog-plugin-sharedb/src/index.js +47 -87
  43. package/packages/datadog-plugin-winston/src/index.js +5 -110
  44. package/packages/datadog-shimmer/src/shimmer.js +1 -1
  45. package/packages/dd-trace/lib/version.js +1 -1
  46. package/packages/dd-trace/src/appsec/index.js +6 -1
  47. package/packages/dd-trace/src/appsec/reporter.js +3 -2
  48. package/packages/dd-trace/src/constants.js +1 -6
  49. package/packages/dd-trace/src/opentracing/propagation/text_map.js +0 -34
  50. package/packages/dd-trace/src/plugins/index.js +1 -3
  51. package/packages/dd-trace/src/plugins/log_plugin.js +44 -0
  52. package/packages/dd-trace/src/plugins/plugin.js +7 -0
  53. package/packages/dd-trace/src/plugins/util/web.js +102 -84
  54. package/packages/dd-trace/src/priority_sampler.js +1 -49
  55. package/packages/dd-trace/src/scope.js +47 -23
  56. package/packages/dd-trace/src/tagger.js +14 -21
  57. package/packages/dd-trace/src/tracer.js +1 -1
  58. package/packages/datadog-plugin-generic-pool/src/index.js +0 -52
  59. package/packages/datadog-plugin-mongoose/src/index.js +0 -51
@@ -21,7 +21,7 @@ class DatadogTracer extends Tracer {
21
21
  }
22
22
 
23
23
  trace (name, options, fn) {
24
- options = Object.assign({}, {
24
+ options = Object.assign({
25
25
  childOf: this.scope().active()
26
26
  }, options)
27
27
 
@@ -1,52 +0,0 @@
1
- 'use strict'
2
-
3
- function createWrapAcquire (tracer, config) {
4
- return function wrapAcquire (acquire) {
5
- return function acquireWithTrace (callback, priority) {
6
- if (typeof callback === 'function') {
7
- arguments[0] = tracer.scope().bind(callback)
8
- }
9
-
10
- return acquire.apply(this, arguments)
11
- }
12
- }
13
- }
14
-
15
- function createWrapPool (tracer, config, instrumenter) {
16
- return function wrapPool (Pool) {
17
- if (typeof Pool !== 'function') return Pool
18
-
19
- return function PoolWithTrace (factory) {
20
- const pool = Pool.apply(this, arguments)
21
-
22
- if (pool && typeof pool.acquire === 'function') {
23
- instrumenter.wrap(pool, 'acquire', createWrapAcquire(tracer, config))
24
- }
25
-
26
- return pool
27
- }
28
- }
29
- }
30
-
31
- module.exports = [
32
- {
33
- name: 'generic-pool',
34
- versions: ['^2.4'],
35
- patch (genericPool, tracer, config) {
36
- this.wrap(genericPool.Pool.prototype, 'acquire', createWrapAcquire(tracer, config))
37
- },
38
- unpatch (genericPool) {
39
- this.unwrap(genericPool.Pool.prototype, 'acquire')
40
- }
41
- },
42
- {
43
- name: 'generic-pool',
44
- versions: ['2 - 2.3'],
45
- patch (genericPool, tracer, config) {
46
- this.wrap(genericPool, 'Pool', createWrapPool(tracer, config, this))
47
- },
48
- unpatch (genericPool) {
49
- this.unwrap(genericPool, 'Pool')
50
- }
51
- }
52
- ]
@@ -1,51 +0,0 @@
1
- 'use strict'
2
-
3
- const { wrapThen } = require('../../datadog-instrumentations/src/helpers/promise')
4
-
5
- function createWrapCollectionAddQueue (tracer, config) {
6
- return function wrapAddQueue (addQueue) {
7
- return function addQueueWithTrace (name) {
8
- const scope = tracer.scope()
9
-
10
- if (typeof name === 'function') {
11
- arguments[0] = scope.bind(name)
12
- } else if (typeof this[name] === 'function') {
13
- arguments[0] = scope.bind((...args) => this[name](...args))
14
- }
15
-
16
- return addQueue.apply(this, arguments)
17
- }
18
- }
19
- }
20
-
21
- function createWrapWrapCallback (tracer, config) {
22
- return function wrapWrapCallback ($wrapCallback) {
23
- return function $wrapCallbackWithTrace (cb) {
24
- arguments[0] = tracer.scope().bind(cb)
25
- return $wrapCallback.apply(this, arguments)
26
- }
27
- }
28
- }
29
-
30
- module.exports = [
31
- {
32
- name: 'mongoose',
33
- versions: ['>=4.6.4'],
34
- patch (mongoose, tracer, config) {
35
- if (mongoose.Promise !== global.Promise) {
36
- this.wrap(mongoose.Promise.prototype, 'then', wrapThen)
37
- }
38
-
39
- this.wrap(mongoose.Collection.prototype, 'addQueue', createWrapCollectionAddQueue(tracer, config))
40
- this.wrap(mongoose.Model, '$wrapCallback', createWrapWrapCallback(tracer, config))
41
- },
42
- unpatch (mongoose) {
43
- if (mongoose.Promise !== global.Promise) {
44
- this.unwrap(mongoose.Promise.prototype, 'then')
45
- }
46
-
47
- this.unwrap(mongoose.Collection.prototype, 'addQueue')
48
- this.unwrap(mongoose.Model, '$wrapCallback')
49
- }
50
- }
51
- ]