dd-trace 5.63.1 → 5.63.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "5.63.1",
3
+ "version": "5.63.3",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -174,7 +174,7 @@
174
174
  "jszip": "^3.10.1",
175
175
  "mocha": "^11.6.0",
176
176
  "multer": "^2.0.2",
177
- "nock": "^11.9.1",
177
+ "nock": "^13.5.6",
178
178
  "nyc": "^15.1.0",
179
179
  "octokit": "^5.0.3",
180
180
  "proxyquire": "^1.8.0",
@@ -166,6 +166,9 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
166
166
  this.knownTestsForThisSuite = hasKnownTests
167
167
  ? (knownTests?.jest?.[this.testSuite] || [])
168
168
  : this.getKnownTestsForSuite(this.testEnvironmentOptions._ddKnownTests)
169
+ log.debug(`this.knownTestsForThisSuite is an array: ${Array.isArray(this.knownTestsForThisSuite)}`)
170
+ log.debug(`this.knownTestsForThisSuite is null: ${this.knownTestsForThisSuite === null}`)
171
+ log.debug(`this.knownTestsForThisSuite is undefined: ${this.knownTestsForThisSuite === undefined}`)
169
172
  } catch {
170
173
  // If there has been an error parsing the tests, we'll disable Early Flake Deteciton
171
174
  this.isEarlyFlakeDetectionEnabled = false
@@ -469,7 +472,10 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
469
472
  }
470
473
  }
471
474
  if (this.isKnownTestsEnabled) {
472
- const isNew = !this.knownTestsForThisSuite?.includes(originalTestName)
475
+ // Check if knownTestsForThisSuite is an array, since the worker may not have provided this information.
476
+ // If it's null or undefined, we can't determine if the test is new.
477
+ const isNew = Array.isArray(this.knownTestsForThisSuite) &&
478
+ !this.knownTestsForThisSuite.includes(originalTestName)
473
479
  if (isNew && !isSkipped && !retriedTestsToNumAttempts.has(originalTestName)) {
474
480
  retriedTestsToNumAttempts.set(originalTestName, 0)
475
481
  if (this.isEarlyFlakeDetectionEnabled) {
@@ -53,8 +53,8 @@ class PrismaEngine extends DatabasePlugin {
53
53
  options.resource = originalStatement
54
54
  options.type = type || engineSpan.attributes['db.system']
55
55
  options.meta['db.type'] = dbType || engineSpan.attributes['db.system']
56
- options.meta['db.instance'] = dbConfig?.database
57
- options.meta['db.name'] = dbConfig?.user
56
+ options.meta['db.name'] = dbConfig?.database
57
+ options.meta['db.user'] = dbConfig?.user
58
58
  options.meta['out.host'] = dbConfig?.host
59
59
  options.meta[CLIENT_PORT_KEY] = dbConfig?.port
60
60
  }
@@ -252,6 +252,12 @@ const sourcesOrder = [
252
252
  ]
253
253
 
254
254
  class Config {
255
+ /**
256
+ * parsed DD_TAGS, usable as a standalone tag set across products
257
+ * @type {Record<string, string> | undefined}
258
+ */
259
+ #parsedDdTags = {}
260
+
255
261
  constructor (options = {}) {
256
262
  if (!isInServerlessEnvironment()) {
257
263
  // Bail out early if we're in a serverless environment, stable config isn't supported
@@ -431,6 +437,10 @@ class Config {
431
437
  }
432
438
  }
433
439
 
440
+ get parsedDdTags () {
441
+ return this.#parsedDdTags
442
+ }
443
+
434
444
  // Supports only a subset of options for now.
435
445
  configure (options, remote) {
436
446
  if (remote) {
@@ -823,8 +833,10 @@ class Config {
823
833
  const env = setHiddenProperty(this, '_env', {})
824
834
  setHiddenProperty(this, '_envUnprocessed', {})
825
835
 
836
+ tagger.add(this.#parsedDdTags, parseSpaceSeparatedTags(DD_TAGS))
837
+
826
838
  tagger.add(tags, parseSpaceSeparatedTags(handleOtel(OTEL_RESOURCE_ATTRIBUTES)))
827
- tagger.add(tags, parseSpaceSeparatedTags(DD_TAGS))
839
+ tagger.add(tags, this.#parsedDdTags)
828
840
  tagger.add(tags, DD_TRACE_TAGS)
829
841
  tagger.add(tags, DD_TRACE_GLOBAL_TAGS)
830
842
 
@@ -178,6 +178,7 @@ class LLMObsSpanProcessor {
178
178
 
179
179
  _processTags (span, mlApp, sessionId, error) {
180
180
  let tags = {
181
+ ...this._config.parsedDdTags,
181
182
  version: this._config.version,
182
183
  env: this._config.env,
183
184
  service: this._config.service,
@@ -187,6 +188,7 @@ class LLMObsSpanProcessor {
187
188
  error: Number(!!error) || 0,
188
189
  language: 'javascript'
189
190
  }
191
+
190
192
  const errType = span.context()._tags[ERROR_TYPE] || error?.name
191
193
  if (errType) tags.error_type = errType
192
194
  if (sessionId) tags.session_id = sessionId