dd-trace 5.71.0 → 5.73.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 (84) hide show
  1. package/LICENSE-3rdparty.csv +7 -0
  2. package/index.d.ts +114 -1
  3. package/package.json +25 -4
  4. package/packages/datadog-esbuild/index.js +8 -0
  5. package/packages/datadog-instrumentations/src/azure-event-hubs.js +37 -0
  6. package/packages/datadog-instrumentations/src/azure-functions.js +3 -0
  7. package/packages/datadog-instrumentations/src/azure-service-bus.js +49 -22
  8. package/packages/datadog-instrumentations/src/cookie-parser.js +2 -0
  9. package/packages/datadog-instrumentations/src/cucumber.js +7 -7
  10. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  11. package/packages/datadog-instrumentations/src/jest.js +85 -47
  12. package/packages/datadog-instrumentations/src/mocha/main.js +8 -9
  13. package/packages/datadog-instrumentations/src/mocha/utils.js +4 -5
  14. package/packages/datadog-instrumentations/src/mocha/worker.js +2 -2
  15. package/packages/datadog-instrumentations/src/pg.js +1 -1
  16. package/packages/datadog-instrumentations/src/playwright.js +5 -5
  17. package/packages/datadog-instrumentations/src/vitest.js +8 -8
  18. package/packages/datadog-plugin-amqplib/src/consumer.js +1 -1
  19. package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +73 -27
  20. package/packages/datadog-plugin-azure-event-hubs/src/index.js +15 -0
  21. package/packages/datadog-plugin-azure-event-hubs/src/producer.js +82 -0
  22. package/packages/datadog-plugin-azure-functions/src/index.js +50 -3
  23. package/packages/datadog-plugin-azure-service-bus/src/index.js +1 -1
  24. package/packages/datadog-plugin-azure-service-bus/src/producer.js +60 -12
  25. package/packages/datadog-plugin-cucumber/src/index.js +3 -3
  26. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +9 -9
  27. package/packages/datadog-plugin-jest/src/index.js +53 -18
  28. package/packages/datadog-plugin-jest/src/util.js +10 -2
  29. package/packages/datadog-plugin-mocha/src/index.js +2 -2
  30. package/packages/datadog-plugin-playwright/src/index.js +2 -2
  31. package/packages/datadog-plugin-vitest/src/index.js +2 -2
  32. package/packages/datadog-plugin-ws/src/close.js +1 -1
  33. package/packages/datadog-plugin-ws/src/producer.js +1 -1
  34. package/packages/datadog-plugin-ws/src/receiver.js +1 -1
  35. package/packages/datadog-plugin-ws/src/server.js +5 -3
  36. package/packages/dd-trace/src/appsec/index.js +9 -1
  37. package/packages/dd-trace/src/appsec/reporter.js +2 -3
  38. package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +5 -0
  39. package/packages/dd-trace/src/config.js +108 -26
  40. package/packages/dd-trace/src/config_defaults.js +12 -0
  41. package/packages/dd-trace/src/git_properties.js +90 -5
  42. package/packages/dd-trace/src/llmobs/plugins/ai/util.js +8 -3
  43. package/packages/dd-trace/src/llmobs/plugins/base.js +11 -12
  44. package/packages/dd-trace/src/llmobs/sdk.js +20 -4
  45. package/packages/dd-trace/src/llmobs/tagger.js +12 -0
  46. package/packages/dd-trace/src/noop/proxy.js +3 -0
  47. package/packages/dd-trace/src/openfeature/constants/constants.js +51 -0
  48. package/packages/dd-trace/src/openfeature/flagging_provider.js +45 -0
  49. package/packages/dd-trace/src/openfeature/index.js +77 -0
  50. package/packages/dd-trace/src/openfeature/noop.js +101 -0
  51. package/packages/dd-trace/src/openfeature/writers/base.js +181 -0
  52. package/packages/dd-trace/src/openfeature/writers/exposures.js +173 -0
  53. package/packages/dd-trace/src/openfeature/writers/util.js +43 -0
  54. package/packages/dd-trace/src/opentelemetry/logs/batch_log_processor.js +100 -0
  55. package/packages/dd-trace/src/opentelemetry/logs/index.js +87 -0
  56. package/packages/dd-trace/src/opentelemetry/logs/logger.js +77 -0
  57. package/packages/dd-trace/src/opentelemetry/logs/logger_provider.js +126 -0
  58. package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +53 -0
  59. package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +252 -0
  60. package/packages/dd-trace/src/opentelemetry/otlp/common.proto +116 -0
  61. package/packages/dd-trace/src/opentelemetry/otlp/logs.proto +226 -0
  62. package/packages/dd-trace/src/opentelemetry/otlp/logs_service.proto +78 -0
  63. package/packages/dd-trace/src/opentelemetry/otlp/metrics.proto +720 -0
  64. package/packages/dd-trace/src/opentelemetry/otlp/metrics_service.proto +78 -0
  65. package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +177 -0
  66. package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +163 -0
  67. package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +66 -0
  68. package/packages/dd-trace/src/opentelemetry/otlp/resource.proto +45 -0
  69. package/packages/dd-trace/src/plugins/ci_plugin.js +7 -6
  70. package/packages/dd-trace/src/plugins/index.js +1 -0
  71. package/packages/dd-trace/src/plugins/util/test.js +6 -5
  72. package/packages/dd-trace/src/profiling/config.js +21 -1
  73. package/packages/dd-trace/src/profiling/exporters/event_serializer.js +3 -2
  74. package/packages/dd-trace/src/profiling/profiler.js +44 -22
  75. package/packages/dd-trace/src/profiling/profilers/events.js +12 -3
  76. package/packages/dd-trace/src/profiling/profilers/space.js +35 -24
  77. package/packages/dd-trace/src/profiling/profilers/wall.js +14 -6
  78. package/packages/dd-trace/src/proxy.js +22 -1
  79. package/packages/dd-trace/src/remote_config/capabilities.js +1 -0
  80. package/packages/dd-trace/src/remote_config/index.js +1 -0
  81. package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +4 -0
  82. package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +8 -0
  83. package/packages/dd-trace/src/supported-configurations.json +18 -0
  84. package/packages/dd-trace/src/telemetry/telemetry.js +13 -1
@@ -3,11 +3,14 @@ require,@datadog/libdatadog,Apache license 2.0,Copyright 2024 Datadog Inc.
3
3
  require,@datadog/native-appsec,Apache license 2.0,Copyright 2018 Datadog Inc.
4
4
  require,@datadog/native-metrics,Apache license 2.0,Copyright 2018 Datadog Inc.
5
5
  require,@datadog/native-iast-taint-tracking,Apache license 2.0,Copyright 2018 Datadog Inc.
6
+ require,@datadog/openfeature-node-server,Apache license 2.0,Copyright 2024 Datadog Inc.
6
7
  require,@datadog/pprof,Apache license 2.0,Copyright 2019 Google Inc.
7
8
  require,@datadog/sketches-js,Apache license 2.0,Copyright 2020 Datadog Inc.
8
9
  require,@datadog/wasm-js-rewriter,Apache license 2.0,Copyright 2018 Datadog Inc.
9
10
  require,@opentelemetry/api,Apache license 2.0,Copyright OpenTelemetry Authors
11
+ require,@opentelemetry/api-logs,Apache license 2.0,Copyright OpenTelemetry Authors
10
12
  require,@opentelemetry/core,Apache license 2.0,Copyright OpenTelemetry Authors
13
+ require,@opentelemetry/resources,Apache license 2.0,Copyright OpenTelemetry Authors
11
14
  require,@isaacs/ttlcache,ISC,Copyright (c) 2022-2023 - Isaac Z. Schlueter and Contributors
12
15
  require,crypto-randomuuid,MIT,Copyright 2021 Node.js Foundation and contributors
13
16
  require,dc-polyfill,MIT,Copyright 2023 Datadog Inc.
@@ -41,6 +44,8 @@ dev,@types/tap,MIT,Copyright (c) Microsoft Corp.
41
44
  dev,@eslint/eslintrc,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
42
45
  dev,@eslint/js,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
43
46
  dev,@msgpack/msgpack,ISC,Copyright 2019 The MessagePack Community
47
+ dev,@openfeature/core,Apache-2.0,Copyright OpenFeature Authors
48
+ dev,@openfeature/server-sdk,Apache-2.0,Copyright OpenFeature Authors
44
49
  dev,@stylistic/eslint-plugin,MIT,Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
45
50
  dev,axios,MIT,Copyright 2014-present Matt Zabriskie
46
51
  dev,benchmark,MIT,Copyright 2010-2016 Mathias Bynens Robert Kieffer John-David Dalton
@@ -59,6 +64,8 @@ dev,globals,MIT,Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://si
59
64
  dev,graphql,MIT,Copyright 2015 Facebook Inc.
60
65
  dev,jszip,MIT,Copyright 2015-2016 Stuart Knightley and contributors
61
66
  dev,mocha,MIT,Copyright 2011-2018 JS Foundation and contributors https://js.foundation
67
+ dev,mocha-multi-reporters,MIT,Copyright 2015-2019 Yousaf Nabi and Stanley Ng
68
+ dev,mocha-junit-reporter,MIT, Copyright 2015 Michael Allen
62
69
  dev,multer,MIT,Copyright 2014 Hage Yaapa
63
70
  dev,nock,MIT,Copyright 2017 Pedro Teixeira and other contributors
64
71
  dev,nyc,ISC,Copyright 2015 Contributors
package/index.d.ts CHANGED
@@ -139,6 +139,16 @@ interface Tracer extends opentracing.Tracer {
139
139
  */
140
140
  llmobs: tracer.llmobs.LLMObs;
141
141
 
142
+ /**
143
+ * OpenFeature Provider with Remote Config integration.
144
+ *
145
+ * Extends DatadogNodeServerProvider with Remote Config integration for dynamic flag configuration.
146
+ * Enable with DD_FLAGGING_PROVIDER_ENABLED=true.
147
+ *
148
+ * @beta This feature is in preview and not ready for production use
149
+ */
150
+ openfeature: tracer.OpenFeatureProvider;
151
+
142
152
  /**
143
153
  * AI Guard SDK
144
154
  */
@@ -172,6 +182,7 @@ interface Plugins {
172
182
  "apollo": tracer.plugins.apollo;
173
183
  "avsc": tracer.plugins.avsc;
174
184
  "aws-sdk": tracer.plugins.aws_sdk;
185
+ "azure-event-hubs": tracer.plugins.azure_event_hubs;
175
186
  "azure-functions": tracer.plugins.azure_functions;
176
187
  "azure-service-bus": tracer.plugins.azure_service_bus;
177
188
  "bunyan": tracer.plugins.bunyan;
@@ -199,7 +210,7 @@ interface Plugins {
199
210
  "ioredis": tracer.plugins.ioredis;
200
211
  "iovalkey": tracer.plugins.iovalkey;
201
212
  "jest": tracer.plugins.jest;
202
- "kafkajs": tracer.plugins.kafkajs
213
+ "kafkajs": tracer.plugins.kafkajs;
203
214
  "knex": tracer.plugins.knex;
204
215
  "koa": tracer.plugins.koa;
205
216
  "langchain": tracer.plugins.langchain;
@@ -623,6 +634,21 @@ declare namespace tracer {
623
634
  */
624
635
  maxContentSize?: number
625
636
  }
637
+
638
+ /**
639
+ * Configuration for Feature Flagging & Experimentation.
640
+ *
641
+ * @beta This feature is in preview and not ready for production use
642
+ */
643
+ flaggingProvider?: {
644
+ /**
645
+ * Whether to enable the feature flagging provider.
646
+ * Requires Remote Config to be properly configured.
647
+ *
648
+ * @default false
649
+ */
650
+ enabled?: boolean
651
+ }
626
652
  };
627
653
 
628
654
  /**
@@ -1098,6 +1124,65 @@ declare namespace tracer {
1098
1124
  eventTrackingV2: EventTrackingV2
1099
1125
  }
1100
1126
 
1127
+ /**
1128
+ * Flagging Provider (OpenFeature-compatible).
1129
+ *
1130
+ * Wraps @datadog/openfeature-node-server with Remote Config integration for dynamic flag configuration.
1131
+ * Implements the OpenFeature Provider interface for flag evaluation.
1132
+ *
1133
+ * @beta This feature is in preview and not ready for production use
1134
+ */
1135
+ export interface OpenFeatureProvider {
1136
+ /**
1137
+ * Metadata about this provider.
1138
+ */
1139
+ metadata: { name: string; [key: string]: any };
1140
+
1141
+ /**
1142
+ * Resolves a boolean flag value.
1143
+ *
1144
+ * @param flagKey The key of the flag to evaluate
1145
+ * @param defaultValue The default value to return if evaluation fails
1146
+ * @param context Evaluation context (e.g., user attributes)
1147
+ * @param logger Optional logger instance
1148
+ * @returns Promise resolving to evaluation result with value and reason
1149
+ */
1150
+ resolveBooleanEvaluation(flagKey: string, defaultValue: boolean, context: object, logger: object): Promise<{ value: boolean; reason?: string; [key: string]: any }>;
1151
+
1152
+ /**
1153
+ * Resolves a string flag value.
1154
+ *
1155
+ * @param flagKey The key of the flag to evaluate
1156
+ * @param defaultValue The default value to return if evaluation fails
1157
+ * @param context Evaluation context (e.g., user attributes)
1158
+ * @param logger Optional logger instance
1159
+ * @returns Promise resolving to evaluation result with value and reason
1160
+ */
1161
+ resolveStringEvaluation(flagKey: string, defaultValue: string, context: object, logger: object): Promise<{ value: string; reason?: string; [key: string]: any }>;
1162
+
1163
+ /**
1164
+ * Resolves a number flag value.
1165
+ *
1166
+ * @param flagKey The key of the flag to evaluate
1167
+ * @param defaultValue The default value to return if evaluation fails
1168
+ * @param context Evaluation context (e.g., user attributes)
1169
+ * @param logger Optional logger instance
1170
+ * @returns Promise resolving to evaluation result with value and reason
1171
+ */
1172
+ resolveNumberEvaluation(flagKey: string, defaultValue: number, context: object, logger: object): Promise<{ value: number; reason?: string; [key: string]: any }>;
1173
+
1174
+ /**
1175
+ * Resolves an object flag value.
1176
+ *
1177
+ * @param flagKey The key of the flag to evaluate
1178
+ * @param defaultValue The default value to return if evaluation fails
1179
+ * @param context Evaluation context (e.g., user attributes)
1180
+ * @param logger Optional logger instance
1181
+ * @returns Promise resolving to evaluation result with value and reason
1182
+ */
1183
+ resolveObjectEvaluation<T = any>(flagKey: string, defaultValue: T, context: object, logger: object): Promise<{ value: T; reason?: string; [key: string]: any }>;
1184
+ }
1185
+
1101
1186
  export namespace aiguard {
1102
1187
 
1103
1188
  /**
@@ -1618,6 +1703,12 @@ declare namespace tracer {
1618
1703
  [key: string]: boolean | Object | undefined;
1619
1704
  }
1620
1705
 
1706
+ /**
1707
+ * This plugin automatically instruments the
1708
+ * @azure/event-hubs module
1709
+ */
1710
+ interface azure_event_hubs extends Integration {}
1711
+
1621
1712
  /**
1622
1713
  * This plugin automatically instruments the
1623
1714
  * @azure/functions module.
@@ -1629,6 +1720,7 @@ declare namespace tracer {
1629
1720
  * @azure/service-bus module
1630
1721
  */
1631
1722
  interface azure_service_bus extends Integration {}
1723
+
1632
1724
  /**
1633
1725
  * This plugin patches the [bunyan](https://github.com/trentm/node-bunyan)
1634
1726
  * to automatically inject trace identifiers in log records when the
@@ -2846,6 +2938,15 @@ declare namespace tracer {
2846
2938
  */
2847
2939
  submitEvaluation (spanContext: llmobs.ExportedLLMObsSpan, options: llmobs.EvaluationOptions): void
2848
2940
 
2941
+
2942
+ /**
2943
+ * Annotates all spans, including auto-instrumented spans, with the provided tags created in the context of the callback function.
2944
+ * @param options The annotation context options.
2945
+ * @param fn The callback over which to apply the annotation context options.
2946
+ * @returns The result of the function.
2947
+ */
2948
+ annotationContext<T> (options: llmobs.AnnotationContextOptions, fn: () => T): T
2949
+
2849
2950
  /**
2850
2951
  * Flushes any remaining spans and evaluation metrics to LLM Observability.
2851
2952
  */
@@ -3007,6 +3108,18 @@ declare namespace tracer {
3007
3108
  tags?: { [key: string]: any }
3008
3109
  }
3009
3110
 
3111
+ interface AnnotationContextOptions {
3112
+ /**
3113
+ * Dictionary of JSON serializable key-value tag pairs to set or update on the LLMObs span regarding the span's context.
3114
+ */
3115
+ tags?: { [key: string]: any },
3116
+
3117
+ /**
3118
+ * Set to override the span name for any spans annotated within the returned context.
3119
+ */
3120
+ name?: string,
3121
+ }
3122
+
3010
3123
  /**
3011
3124
  * An object containing the span ID and trace ID of interest
3012
3125
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "5.71.0",
3
+ "version": "5.73.0",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -44,8 +44,9 @@
44
44
  "test:llmobs:sdk:ci": "nyc --no-clean --include \"packages/dd-trace/src/llmobs/**/*.js\" -- npm run test:llmobs:sdk",
45
45
  "test:llmobs:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/dd-trace/test/llmobs/plugins/@($(echo $PLUGINS))/*.spec.js\"",
46
46
  "test:llmobs:plugins:ci": "yarn services && nyc --no-clean --include \"packages/dd-trace/src/llmobs/**/*.js\" -- npm run test:llmobs:plugins",
47
- "test:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/*.spec.js\"",
47
+ "test:plugins": "mocha -r \"packages/dd-trace/test/setup/mocha.js\" \"packages/datadog-plugin-@($(echo $PLUGINS))/test/**/@($(echo ${SPEC:-'*'})).spec.js\"",
48
48
  "test:plugins:ci": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins",
49
+ "test:plugins:ci:flaky": "yarn services && nyc --no-clean --include \"packages/datadog-plugin-@($(echo $PLUGINS))/src/**/*.js\" -- npm run test:plugins -- --bail --retries 2",
49
50
  "test:plugins:upstream": "node ./packages/dd-trace/test/plugins/suite.js",
50
51
  "test:profiler": "tap \"packages/dd-trace/test/profiling/**/*.spec.js\"",
51
52
  "test:profiler:ci": "npm run test:profiler -- --coverage --nyc-arg=--include=\"packages/dd-trace/src/profiling/**/*.js\"",
@@ -56,6 +57,7 @@
56
57
  "test:integration:cypress": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/cypress/*.spec.js\"",
57
58
  "test:integration:debugger": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/debugger/*.spec.js\"",
58
59
  "test:integration:esbuild": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/esbuild/*.spec.js\"",
60
+ "test:integration:openfeature": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/openfeature/*.spec.js\"",
59
61
  "test:integration:jest": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/jest/*.spec.js\"",
60
62
  "test:integration:mocha": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/mocha/*.spec.js\"",
61
63
  "test:integration:playwright": "mocha --timeout 60000 -r \"packages/dd-trace/test/setup/core.js\" \"integration-tests/playwright/*.spec.js\"",
@@ -118,15 +120,18 @@
118
120
  ],
119
121
  "dependencies": {
120
122
  "@datadog/libdatadog": "0.7.0",
121
- "@datadog/native-appsec": "10.2.1",
123
+ "@datadog/native-appsec": "10.3.0",
122
124
  "@datadog/native-iast-taint-tracking": "4.0.0",
123
125
  "@datadog/native-metrics": "3.1.1",
124
- "@datadog/pprof": "5.10.0",
126
+ "@datadog/openfeature-node-server": "0.1.0-preview.12",
127
+ "@datadog/pprof": "5.11.1",
125
128
  "@datadog/sketches-js": "2.1.1",
126
129
  "@datadog/wasm-js-rewriter": "4.0.1",
127
130
  "@isaacs/ttlcache": "^1.4.1",
128
131
  "@opentelemetry/api": ">=1.0.0 <1.10.0",
132
+ "@opentelemetry/api-logs": "<1.0.0",
129
133
  "@opentelemetry/core": ">=1.14.0 <1.31.0",
134
+ "@opentelemetry/resources": ">=1.0.0 <1.10.0",
130
135
  "crypto-randomuuid": "^1.0.0",
131
136
  "dc-polyfill": "^0.1.10",
132
137
  "ignore": "^7.0.5",
@@ -151,11 +156,25 @@
151
156
  "tlhunter-sorted-set": "^0.1.0",
152
157
  "ttl-set": "^1.0.0"
153
158
  },
159
+ "peerDependencies": {
160
+ "@openfeature/core": "^1.9.0",
161
+ "@openfeature/server-sdk": "~1.19.0"
162
+ },
163
+ "peerDependenciesMeta": {
164
+ "@openfeature/core": {
165
+ "optional": true
166
+ },
167
+ "@openfeature/server-sdk": {
168
+ "optional": true
169
+ }
170
+ },
154
171
  "devDependencies": {
155
172
  "@babel/helpers": "^7.27.6",
156
173
  "@eslint/eslintrc": "^3.3.1",
157
174
  "@eslint/js": "^9.29.0",
158
175
  "@msgpack/msgpack": "^3.1.2",
176
+ "@openfeature/core": "^1.8.1",
177
+ "@openfeature/server-sdk": "~1.19.0",
159
178
  "@stylistic/eslint-plugin": "^5.0.0",
160
179
  "@types/chai": "^4.3.16",
161
180
  "@types/mocha": "^10.0.10",
@@ -179,6 +198,8 @@
179
198
  "graphql": "*",
180
199
  "jszip": "^3.10.1",
181
200
  "mocha": "^11.6.0",
201
+ "mocha-junit-reporter": "^2.2.1",
202
+ "mocha-multi-reporters": "^1.5.1",
182
203
  "multer": "^2.0.2",
183
204
  "nock": "^13.5.6",
184
205
  "nyc": "^15.1.0",
@@ -115,6 +115,14 @@ module.exports.setup = function (build) {
115
115
  ${isSourceMapEnabled ? `globalThis.__DD_ESBUILD_BASEPATH = '${require('../dd-trace/src/util').ddBasePath}';` : ''}
116
116
  ${build.initialOptions.banner.js}`
117
117
  }
118
+
119
+ try {
120
+ require.resolve('@openfeature/core')
121
+ } catch (error) {
122
+ build.initialOptions.external ??= []
123
+ build.initialOptions.external.push('@openfeature/core')
124
+ }
125
+
118
126
  if (isESMBuild(build)) {
119
127
  if (!build.initialOptions.banner.js.includes('import { createRequire as $dd_createRequire } from \'module\'')) {
120
128
  build.initialOptions.banner.js = `import { createRequire as $dd_createRequire } from 'module';
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ const {
4
+ addHook
5
+ } = require('./helpers/instrument')
6
+ const shimmer = require('../../datadog-shimmer')
7
+ const dc = require('dc-polyfill')
8
+
9
+ const producerCh = dc.tracingChannel('apm:azure-event-hubs:send')
10
+
11
+ addHook({
12
+ name: '@azure/event-hubs',
13
+ versions: ['>=6.0.0']
14
+ }, obj => {
15
+ const EventHubProducerClient = obj.EventHubProducerClient
16
+ shimmer.wrap(EventHubProducerClient.prototype, 'createBatch',
17
+ createBatch => async function () {
18
+ const batch = await createBatch.apply(this, arguments)
19
+ shimmer.wrap(batch, 'tryAdd',
20
+ tryAdd => function (eventData) {
21
+ const config = this._context.config
22
+ const functionName = tryAdd.name
23
+ return producerCh.tracePromise(
24
+ tryAdd,
25
+ { functionName, eventData, batch: this, config },
26
+ this, ...arguments)
27
+ })
28
+ return batch
29
+ })
30
+ shimmer.wrap(EventHubProducerClient.prototype, 'sendBatch',
31
+ sendBatch => function (eventData) {
32
+ const config = this._context.config
33
+ const functionName = sendBatch.name
34
+ return producerCh.tracePromise(sendBatch, { functionName, eventData, config }, this, ...arguments)
35
+ })
36
+ return obj
37
+ })
@@ -23,6 +23,9 @@ addHook({ name: '@azure/functions', versions: ['>=4'], patchDefault: false }, (a
23
23
  shimmer.wrap(app, 'serviceBusQueue', wrapHandler)
24
24
  shimmer.wrap(app, 'serviceBusTopic', wrapHandler)
25
25
 
26
+ // Event Hub triggers
27
+ shimmer.wrap(app, 'eventHub', wrapHandler)
28
+
26
29
  return azureFunction
27
30
  })
28
31
 
@@ -1,38 +1,65 @@
1
1
  'use strict'
2
2
 
3
3
  const {
4
- channel,
5
4
  addHook
6
5
  } = require('./helpers/instrument')
7
6
 
8
7
  const shimmer = require('../../datadog-shimmer')
8
+ const dc = require('dc-polyfill')
9
9
 
10
- const producerStartCh = channel('apm:azure-service-bus:send:start')
11
- const producerErrorCh = channel('apm:azure-service-bus:send:error')
12
- const producerFinishCh = channel('apm:azure-service-bus:send:finish')
10
+ const producerCh = dc.tracingChannel('apm:azure-service-bus:send')
13
11
 
14
12
  addHook({ name: '@azure/service-bus', versions: ['>=7.9.2'], patchDefault: false }, (obj) => {
15
13
  const ServiceBusClient = obj.ServiceBusClient
16
- shimmer.wrap(ServiceBusClient.prototype, 'createSender', createSender => function (queueOrTopicName) {
17
- const sender = createSender.apply(this, arguments)
18
- shimmer.wrap(sender._sender, 'send', send => function (msg) {
19
- const ctx = { sender, msg }
20
- return producerStartCh.runStores(ctx, () => {
21
- return send.apply(this, arguments)
22
- .then(
23
- response => {
24
- producerFinishCh.publish(ctx)
25
- },
26
- error => {
27
- ctx.error = error
28
- producerErrorCh.publish(ctx)
29
- producerFinishCh.publish(ctx)
30
- throw error
31
- }
14
+ let didItShim = false
15
+ shimmer.wrap(ServiceBusClient.prototype, 'createSender',
16
+ createSender => function (queueOrTopicName) {
17
+ const sender = createSender.apply(this, arguments)
18
+ if (didItShim) return sender
19
+ const senderPrototype = sender.constructor.prototype
20
+ const senderSenderPrototype = sender._sender.constructor.prototype
21
+ shimmer.wrap(senderPrototype, 'scheduleMessages', scheduleMessages =>
22
+ function (msg, scheduledEnqueueTimeUtc) {
23
+ const functionName = scheduleMessages.name
24
+ const config = this._context.config
25
+ const entityPath = this._entityPath
26
+ return producerCh.tracePromise(
27
+ scheduleMessages,
28
+ { config, entityPath, functionName, msg, scheduledEnqueueTimeUtc },
29
+ this, ...arguments
32
30
  )
31
+ })
32
+
33
+ shimmer.wrap(senderPrototype, 'createMessageBatch', createMessageBatch => async function () {
34
+ const batch = await createMessageBatch.apply(this, arguments)
35
+ shimmer.wrap(batch.constructor.prototype, 'tryAddMessage', tryAddMessage => function (msg) {
36
+ const functionName = tryAddMessage.name
37
+ const config = this._context.config
38
+ return producerCh.tracePromise(
39
+ tryAddMessage, { config, functionName, batch, msg }, this, ...arguments)
40
+ })
41
+ return batch
42
+ })
43
+
44
+ shimmer.wrap(senderSenderPrototype, 'send', send => function (msg) {
45
+ const functionName = send.name
46
+ const config = this._context.config
47
+ const entityPath = this.entityPath
48
+ return producerCh.tracePromise(
49
+ send, { config, entityPath, functionName, msg }, this, ...arguments
50
+ )
51
+ })
52
+
53
+ shimmer.wrap(senderSenderPrototype, 'sendBatch', sendBatch => function (msg) {
54
+ const functionName = sendBatch.name
55
+ const config = this._context.config
56
+ const entityPath = this.entityPath
57
+ return producerCh.tracePromise(
58
+ sendBatch, { config, entityPath, functionName, msg }, this, ...arguments
59
+ )
33
60
  })
61
+ didItShim = true
62
+ return sender
34
63
  })
35
- return sender
36
- })
37
64
  return obj
38
65
  })
@@ -25,6 +25,8 @@ addHook({
25
25
  name: 'cookie-parser',
26
26
  versions: ['>=1.0.0']
27
27
  }, cookieParser => {
28
+ // This prevents the non default export from entering the wrapping process
29
+ if (cookieParser.default) return cookieParser
28
30
  return shimmer.wrapFunction(cookieParser, cookieParser => function () {
29
31
  const cookieMiddleware = cookieParser.apply(this, arguments)
30
32
 
@@ -25,7 +25,7 @@ const skippableSuitesCh = channel('ci:cucumber:test-suite:skippable')
25
25
  const sessionStartCh = channel('ci:cucumber:session:start')
26
26
  const sessionFinishCh = channel('ci:cucumber:session:finish')
27
27
  const testManagementTestsCh = channel('ci:cucumber:test-management-tests')
28
- const impactedTestsCh = channel('ci:cucumber:modified-tests')
28
+ const modifiedFilesCh = channel('ci:cucumber:modified-files')
29
29
  const isModifiedCh = channel('ci:cucumber:is-modified-test')
30
30
 
31
31
  const workerReportTraceCh = channel('ci:cucumber:worker-report:trace')
@@ -80,7 +80,7 @@ let isTestManagementTestsEnabled = false
80
80
  let isImpactedTestsEnabled = false
81
81
  let testManagementAttemptToFixRetries = 0
82
82
  let testManagementTests = {}
83
- let modifiedTests = {}
83
+ let modifiedFiles = {}
84
84
  let numTestRetries = 0
85
85
  let knownTests = {}
86
86
  let skippedSuites = []
@@ -537,9 +537,9 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
537
537
  }
538
538
 
539
539
  if (isImpactedTestsEnabled) {
540
- const impactedTestsResponse = await getChannelPromise(impactedTestsCh)
540
+ const impactedTestsResponse = await getChannelPromise(modifiedFilesCh)
541
541
  if (!impactedTestsResponse.err) {
542
- modifiedTests = impactedTestsResponse.modifiedTests
542
+ modifiedFiles = impactedTestsResponse.modifiedFiles
543
543
  }
544
544
  }
545
545
 
@@ -655,7 +655,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
655
655
  isModifiedCh.publish({
656
656
  scenarios,
657
657
  testFileAbsolutePath: gherkinDocument.uri,
658
- modifiedTests,
658
+ modifiedFiles,
659
659
  stepIds,
660
660
  stepDefinitions: this.supportCodeLibrary.stepDefinitions,
661
661
  setIsModified
@@ -1000,7 +1000,7 @@ addHook({
1000
1000
 
1001
1001
  if (isImpactedTestsEnabled) {
1002
1002
  this.options.worldParameters._ddImpactedTestsEnabled = isImpactedTestsEnabled
1003
- this.options.worldParameters._ddModifiedTests = modifiedTests
1003
+ this.options.worldParameters._ddModifiedFiles = modifiedFiles
1004
1004
  }
1005
1005
 
1006
1006
  return startWorker.apply(this, arguments)
@@ -1036,7 +1036,7 @@ addHook({
1036
1036
  }
1037
1037
  isImpactedTestsEnabled = !!this.options.worldParameters._ddImpactedTestsEnabled
1038
1038
  if (isImpactedTestsEnabled) {
1039
- modifiedTests = this.options.worldParameters._ddModifiedTests
1039
+ modifiedFiles = this.options.worldParameters._ddModifiedFiles
1040
1040
  }
1041
1041
  }
1042
1042
  )
@@ -6,6 +6,7 @@ module.exports = {
6
6
  '@apollo/gateway': () => require('../apollo'),
7
7
  'apollo-server-core': () => require('../apollo-server-core'),
8
8
  '@aws-sdk/smithy-client': () => require('../aws-sdk'),
9
+ '@azure/event-hubs': () => require('../azure-event-hubs'),
9
10
  '@azure/functions': () => require('../azure-functions'),
10
11
  '@azure/service-bus': () => require('../azure-service-bus'),
11
12
  '@cucumber/cucumber': () => require('../cucumber'),