dd-trace 5.46.0 → 5.47.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 (41) hide show
  1. package/LICENSE-3rdparty.csv +1 -2
  2. package/package.json +8 -9
  3. package/packages/datadog-instrumentations/orchestrion.yml +52 -0
  4. package/packages/datadog-instrumentations/src/cucumber.js +2 -1
  5. package/packages/datadog-instrumentations/src/jest.js +11 -2
  6. package/packages/datadog-instrumentations/src/langchain.js +49 -53
  7. package/packages/datadog-instrumentations/src/mocha/main.js +1 -1
  8. package/packages/datadog-instrumentations/src/mocha/utils.js +11 -3
  9. package/packages/datadog-instrumentations/src/orchestrion-config/index.js +5 -0
  10. package/packages/datadog-instrumentations/src/playwright.js +14 -2
  11. package/packages/datadog-instrumentations/src/vitest.js +11 -3
  12. package/packages/datadog-plugin-cucumber/src/index.js +11 -4
  13. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +17 -5
  14. package/packages/datadog-plugin-jest/src/index.js +11 -4
  15. package/packages/datadog-plugin-langchain/src/index.js +18 -12
  16. package/packages/datadog-plugin-langchain/src/tracing.js +66 -6
  17. package/packages/datadog-plugin-mocha/src/index.js +17 -5
  18. package/packages/datadog-plugin-mongodb-core/src/index.js +5 -1
  19. package/packages/datadog-plugin-playwright/src/index.js +10 -3
  20. package/packages/datadog-plugin-vitest/src/index.js +13 -8
  21. package/packages/datadog-shimmer/src/shimmer.js +3 -42
  22. package/packages/dd-trace/src/appsec/iast/taint-tracking/filter.js +3 -3
  23. package/packages/dd-trace/src/appsec/iast/taint-tracking/index.js +0 -3
  24. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +24 -11
  25. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-telemetry.js +3 -32
  26. package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +98 -56
  27. package/packages/dd-trace/src/config.js +9 -0
  28. package/packages/dd-trace/src/exporters/common/docker.js +37 -7
  29. package/packages/dd-trace/src/exporters/common/request.js +1 -4
  30. package/packages/dd-trace/src/llmobs/plugins/base.js +2 -2
  31. package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +62 -3
  32. package/packages/dd-trace/src/llmobs/plugins/openai.js +1 -0
  33. package/packages/dd-trace/src/llmobs/plugins/vertexai.js +2 -1
  34. package/packages/dd-trace/src/log/index.js +2 -0
  35. package/packages/dd-trace/src/log/writer.js +19 -2
  36. package/packages/dd-trace/src/opentracing/propagation/text_map.js +17 -3
  37. package/packages/dd-trace/src/opentracing/span.js +10 -0
  38. package/packages/dd-trace/src/plugins/util/test.js +7 -0
  39. package/packages/dd-trace/src/profiling/exporters/agent.js +1 -5
  40. package/packages/dd-trace/src/profiling/profilers/wall.js +3 -1
  41. package/packages/dd-trace/src/proxy.js +5 -1
@@ -16,8 +16,6 @@ const perf = require('perf_hooks').performance
16
16
  const telemetryMetrics = require('../../telemetry/metrics')
17
17
  const profilersNamespace = telemetryMetrics.manager.namespace('profilers')
18
18
 
19
- const containerId = docker.id()
20
-
21
19
  const statusCodeCounters = []
22
20
  const requestCounter = profilersNamespace.count('profile_api.requests', [])
23
21
  const sizeDistribution = profilersNamespace.distribution('profile_api.bytes', [])
@@ -155,9 +153,7 @@ class AgentExporter extends EventSerializer {
155
153
  timeout: this._backoffTime * Math.pow(2, attempt)
156
154
  }
157
155
 
158
- if (containerId) {
159
- options.headers['Datadog-Container-ID'] = containerId
160
- }
156
+ docker.inject(options.headers)
161
157
 
162
158
  if (this._url.protocol === 'unix:') {
163
159
  options.socketPath = this._url.pathname
@@ -70,7 +70,9 @@ function ensureChannelsActivated () {
70
70
  class NativeWallProfiler {
71
71
  constructor (options = {}) {
72
72
  this.type = 'wall'
73
- this._asyncIdEnabled = !!options.asyncIdEnabled
73
+ // Currently there's a crash sometimes on worker threads trying to collect async IDs so for the
74
+ // time being we'll constrain it to only the main thread.
75
+ this._asyncIdEnabled = !!options.asyncIdEnabled && require('worker_threads').isMainThread
74
76
  this._codeHotspotsEnabled = !!options.codeHotspotsEnabled
75
77
  this._cpuProfilingEnabled = !!options.cpuProfilingEnabled
76
78
  this._endpointCollectionEnabled = !!options.endpointCollectionEnabled
@@ -70,7 +70,8 @@ class Tracer extends NoopProxy {
70
70
  this._modules = {
71
71
  appsec: new LazyModule(() => require('./appsec')),
72
72
  iast: new LazyModule(() => require('./appsec/iast')),
73
- llmobs: new LazyModule(() => require('./llmobs'))
73
+ llmobs: new LazyModule(() => require('./llmobs')),
74
+ rewriter: new LazyModule(() => require('./appsec/iast/taint-tracking/rewriter'))
74
75
  }
75
76
  }
76
77
 
@@ -178,6 +179,8 @@ class Tracer extends NoopProxy {
178
179
 
179
180
  this._enableOrDisableTracing(config)
180
181
 
182
+ this._modules.rewriter.enable(config)
183
+
181
184
  if (config.tracing) {
182
185
  if (config.isManualApiEnabled) {
183
186
  const TestApiManualPlugin = require('./ci-visibility/test-api-manual/test-api-manual-plugin')
@@ -247,6 +250,7 @@ class Tracer extends NoopProxy {
247
250
  if (config.iast.enabled) {
248
251
  this._modules.iast.enable(config, this._tracer)
249
252
  }
253
+ // This needs to be after the IAST module is enabled
250
254
  } else if (this._tracingInitialized) {
251
255
  this._modules.appsec.disable()
252
256
  this._modules.iast.disable()