dd-trace 4.18.0 → 4.20.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 (57) hide show
  1. package/LICENSE-3rdparty.csv +2 -2
  2. package/README.md +3 -3
  3. package/ext/kinds.d.ts +1 -0
  4. package/ext/kinds.js +2 -1
  5. package/ext/tags.d.ts +2 -1
  6. package/ext/tags.js +6 -1
  7. package/package.json +6 -6
  8. package/packages/datadog-core/src/storage/async_resource.js +1 -1
  9. package/packages/datadog-esbuild/index.js +1 -20
  10. package/packages/datadog-instrumentations/src/helpers/bundler-register.js +1 -2
  11. package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -1
  12. package/packages/datadog-instrumentations/src/helpers/register.js +1 -1
  13. package/packages/datadog-instrumentations/src/restify.js +14 -1
  14. package/packages/datadog-plugin-kafkajs/src/consumer.js +8 -6
  15. package/packages/datadog-plugin-kafkajs/src/producer.js +9 -6
  16. package/packages/dd-trace/src/appsec/channels.js +1 -1
  17. package/packages/dd-trace/src/appsec/iast/iast-log.js +1 -1
  18. package/packages/dd-trace/src/appsec/iast/iast-plugin.js +1 -1
  19. package/packages/dd-trace/src/appsec/iast/index.js +1 -1
  20. package/packages/dd-trace/src/appsec/iast/path-line.js +1 -1
  21. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +1 -1
  22. package/packages/dd-trace/src/appsec/index.js +1 -1
  23. package/packages/dd-trace/src/appsec/recommended.json +272 -48
  24. package/packages/dd-trace/src/appsec/reporter.js +31 -34
  25. package/packages/dd-trace/src/appsec/rule_manager.js +9 -6
  26. package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-itr-configuration.js +17 -7
  27. package/packages/dd-trace/src/config.js +12 -5
  28. package/packages/dd-trace/src/datastreams/processor.js +60 -15
  29. package/packages/dd-trace/src/format.js +6 -1
  30. package/packages/dd-trace/src/id.js +12 -0
  31. package/packages/dd-trace/src/iitm.js +1 -1
  32. package/packages/dd-trace/src/log/channels.js +1 -1
  33. package/packages/dd-trace/src/opentelemetry/span.js +95 -2
  34. package/packages/dd-trace/src/opentelemetry/tracer.js +9 -10
  35. package/packages/dd-trace/src/opentracing/propagation/text_map.js +14 -5
  36. package/packages/dd-trace/src/opentracing/span.js +4 -0
  37. package/packages/dd-trace/src/opentracing/span_context.js +5 -2
  38. package/packages/dd-trace/src/plugin_manager.js +1 -1
  39. package/packages/dd-trace/src/plugins/database.js +1 -1
  40. package/packages/dd-trace/src/plugins/plugin.js +1 -1
  41. package/packages/dd-trace/src/plugins/util/ci.js +6 -19
  42. package/packages/dd-trace/src/plugins/util/git.js +2 -1
  43. package/packages/dd-trace/src/plugins/util/ip_extractor.js +7 -6
  44. package/packages/dd-trace/src/plugins/util/url.js +26 -0
  45. package/packages/dd-trace/src/plugins/util/user-provided-git.js +1 -14
  46. package/packages/dd-trace/src/profiling/config.js +18 -2
  47. package/packages/dd-trace/src/profiling/profilers/events.js +166 -0
  48. package/packages/dd-trace/src/profiling/profilers/shared.js +9 -0
  49. package/packages/dd-trace/src/profiling/profilers/wall.js +116 -58
  50. package/packages/dd-trace/src/ritm.js +1 -1
  51. package/packages/dd-trace/src/span_processor.js +4 -0
  52. package/packages/dd-trace/src/telemetry/dependencies.js +1 -1
  53. package/packages/dd-trace/src/telemetry/index.js +1 -1
  54. package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
  55. package/packages/dd-trace/src/tracer.js +4 -2
  56. package/packages/diagnostics_channel/index.js +0 -3
  57. package/packages/diagnostics_channel/src/index.js +0 -121
@@ -1,121 +0,0 @@
1
- 'use strict'
2
-
3
- const {
4
- Channel,
5
- channel
6
- } = require('diagnostics_channel') // eslint-disable-line n/no-restricted-require
7
-
8
- const [major, minor] = process.versions.node.split('.')
9
- const channels = new WeakSet()
10
-
11
- // Our own DC with a limited subset of functionality stable across Node versions.
12
- // TODO: Move the rest of the polyfill here.
13
- // TODO: Switch to using global subscribe/unsubscribe/hasSubscribers.
14
- const dc = { channel }
15
-
16
- // Prevent going to 0 subscribers to avoid bug in Node.
17
- // See https://github.com/nodejs/node/pull/47520
18
- if (major === '19' && minor === '9') {
19
- dc.channel = function () {
20
- const ch = channel.apply(this, arguments)
21
-
22
- if (!channels.has(ch)) {
23
- const subscribe = ch.subscribe
24
- const unsubscribe = ch.unsubscribe
25
-
26
- ch.subscribe = function () {
27
- delete ch.subscribe
28
- delete ch.unsubscribe
29
-
30
- const result = subscribe.apply(this, arguments)
31
-
32
- this.subscribe(() => {}) // Keep it active forever.
33
-
34
- return result
35
- }
36
-
37
- if (ch.unsubscribe === Channel.prototype.unsubscribe) {
38
- // Needed because another subscriber could have subscribed to something
39
- // that we unsubscribe to before the library is loaded.
40
- ch.unsubscribe = function () {
41
- delete ch.subscribe
42
- delete ch.unsubscribe
43
-
44
- this.subscribe(() => {}) // Keep it active forever.
45
-
46
- return unsubscribe.apply(this, arguments)
47
- }
48
- }
49
-
50
- channels.add(ch)
51
- }
52
-
53
- return ch
54
- }
55
- }
56
-
57
- if (!Channel.prototype.runStores) {
58
- const ActiveChannelPrototype = getActiveChannelPrototype()
59
-
60
- Channel.prototype.bindStore = ActiveChannelPrototype.bindStore = function (store, transform) {
61
- if (!this._stores) {
62
- this._stores = new Map()
63
- }
64
- this._stores.set(store, transform)
65
- }
66
-
67
- Channel.prototype.unbindStore = ActiveChannelPrototype.unbindStore = function (store) {
68
- if (!this._stores) return
69
- this._stores.delete(store)
70
- }
71
-
72
- Channel.prototype.runStores = ActiveChannelPrototype.runStores = function (data, fn, thisArg, ...args) {
73
- if (!this._stores) return Reflect.apply(fn, thisArg, args)
74
-
75
- let run = () => {
76
- this.publish(data)
77
- return Reflect.apply(fn, thisArg, args)
78
- }
79
-
80
- for (const entry of this._stores.entries()) {
81
- const store = entry[0]
82
- const transform = entry[1]
83
- run = wrapStoreRun(store, data, run, transform)
84
- }
85
-
86
- return run()
87
- }
88
- }
89
-
90
- function defaultTransform (data) {
91
- return data
92
- }
93
-
94
- function wrapStoreRun (store, data, next, transform = defaultTransform) {
95
- return () => {
96
- let context
97
- try {
98
- context = transform(data)
99
- } catch (err) {
100
- process.nextTick(() => {
101
- throw err
102
- })
103
- return next()
104
- }
105
-
106
- return store.run(context, next)
107
- }
108
- }
109
-
110
- function getActiveChannelPrototype () {
111
- const dummyChannel = channel('foo')
112
- const listener = () => {}
113
-
114
- dummyChannel.subscribe(listener)
115
- const ActiveChannelPrototype = Object.getPrototypeOf(dummyChannel)
116
- dummyChannel.unsubscribe(listener)
117
-
118
- return ActiveChannelPrototype
119
- }
120
-
121
- module.exports = dc