dd-trace 5.99.0 → 5.100.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 (74) hide show
  1. package/LICENSE-3rdparty.csv +0 -1
  2. package/package.json +24 -5
  3. package/packages/datadog-instrumentations/src/cucumber.js +69 -5
  4. package/packages/datadog-instrumentations/src/express.js +3 -2
  5. package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -0
  6. package/packages/datadog-instrumentations/src/hono.js +15 -4
  7. package/packages/datadog-instrumentations/src/jest.js +89 -63
  8. package/packages/datadog-instrumentations/src/mocha/main.js +18 -22
  9. package/packages/datadog-instrumentations/src/mocha/utils.js +114 -96
  10. package/packages/datadog-instrumentations/src/mocha/worker.js +2 -2
  11. package/packages/datadog-instrumentations/src/path-to-regexp.js +44 -0
  12. package/packages/datadog-instrumentations/src/playwright.js +108 -18
  13. package/packages/datadog-instrumentations/src/router.js +53 -33
  14. package/packages/datadog-instrumentations/src/vitest.js +76 -30
  15. package/packages/datadog-plugin-aws-sdk/src/base.js +1 -1
  16. package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +1 -1
  17. package/packages/datadog-plugin-bullmq/src/consumer.js +3 -2
  18. package/packages/datadog-plugin-bullmq/src/producer.js +25 -11
  19. package/packages/datadog-plugin-cypress/src/cypress-plugin.js +32 -9
  20. package/packages/datadog-plugin-cypress/src/support.js +22 -21
  21. package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -1
  22. package/packages/datadog-plugin-graphql/src/utils.js +2 -2
  23. package/packages/datadog-plugin-grpc/src/client.js +1 -1
  24. package/packages/datadog-plugin-grpc/src/server.js +1 -1
  25. package/packages/datadog-plugin-memcached/src/index.js +1 -1
  26. package/packages/datadog-plugin-mongodb-core/src/index.js +2 -3
  27. package/packages/datadog-plugin-playwright/src/index.js +6 -0
  28. package/packages/datadog-plugin-router/src/index.js +13 -0
  29. package/packages/dd-trace/index.js +4 -3
  30. package/packages/dd-trace/src/aiguard/sdk.js +2 -2
  31. package/packages/dd-trace/src/appsec/blocking.js +18 -6
  32. package/packages/dd-trace/src/appsec/graphql.js +1 -1
  33. package/packages/dd-trace/src/baggage.js +26 -13
  34. package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +1 -1
  35. package/packages/dd-trace/src/config/generated-config-types.d.ts +45 -69
  36. package/packages/dd-trace/src/config/index.js +13 -12
  37. package/packages/dd-trace/src/config/normalize-service.js +31 -0
  38. package/packages/dd-trace/src/config/supported-configurations.json +31 -76
  39. package/packages/dd-trace/src/debugger/config.js +1 -1
  40. package/packages/dd-trace/src/dogstatsd.js +5 -8
  41. package/packages/dd-trace/src/encode/0.4.js +1 -1
  42. package/packages/dd-trace/src/encode/tags-processors.js +3 -3
  43. package/packages/dd-trace/src/exporter.js +1 -1
  44. package/packages/dd-trace/src/git_metadata_tagger.js +1 -1
  45. package/packages/dd-trace/src/heap_snapshots.js +4 -4
  46. package/packages/dd-trace/src/llmobs/constants/tags.js +3 -0
  47. package/packages/dd-trace/src/llmobs/sdk.js +21 -1
  48. package/packages/dd-trace/src/llmobs/span_processor.js +14 -1
  49. package/packages/dd-trace/src/llmobs/writers/base.js +7 -1
  50. package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
  51. package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +2 -2
  52. package/packages/dd-trace/src/opentelemetry/context_manager.js +11 -8
  53. package/packages/dd-trace/src/opentelemetry/logs/index.js +5 -5
  54. package/packages/dd-trace/src/opentelemetry/metrics/index.js +6 -6
  55. package/packages/dd-trace/src/opentelemetry/span-helpers.js +170 -0
  56. package/packages/dd-trace/src/opentelemetry/span.js +14 -42
  57. package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
  58. package/packages/dd-trace/src/opentelemetry/tracer.js +11 -36
  59. package/packages/dd-trace/src/opentracing/propagation/text_map.js +44 -23
  60. package/packages/dd-trace/src/opentracing/propagation/tracestate.js +42 -12
  61. package/packages/dd-trace/src/opentracing/span.js +4 -3
  62. package/packages/dd-trace/src/plugin_manager.js +6 -6
  63. package/packages/dd-trace/src/plugins/log_plugin.js +1 -1
  64. package/packages/dd-trace/src/plugins/util/ci.js +119 -32
  65. package/packages/dd-trace/src/plugins/util/test.js +295 -29
  66. package/packages/dd-trace/src/profiling/ssi-heuristics.js +2 -2
  67. package/packages/dd-trace/src/propagation-hash/index.js +1 -1
  68. package/packages/dd-trace/src/proxy.js +9 -9
  69. package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +1 -1
  70. package/packages/dd-trace/src/span_processor.js +1 -1
  71. package/packages/dd-trace/src/telemetry/telemetry.js +7 -5
  72. package/packages/dd-trace/src/tracer_metadata.js +1 -1
  73. package/vendor/dist/path-to-regexp/LICENSE +0 -21
  74. package/vendor/dist/path-to-regexp/index.js +0 -1
@@ -12,8 +12,7 @@
12
12
  {
13
13
  "implementation": "A",
14
14
  "type": "boolean",
15
- "default": "false",
16
- "internalPropertyName": "ciVisAgentlessLogSubmissionEnabled"
15
+ "default": "false"
17
16
  }
18
17
  ],
19
18
  "DD_AGENTLESS_LOG_SUBMISSION_URL": [
@@ -422,8 +421,7 @@
422
421
  {
423
422
  "implementation": "A",
424
423
  "type": "string",
425
- "default": null,
426
- "internalPropertyName": "appKey"
424
+ "default": null
427
425
  }
428
426
  ],
429
427
  "DD_AZURE_RESOURCE_GROUP": [
@@ -541,8 +539,7 @@
541
539
  {
542
540
  "implementation": "A",
543
541
  "type": "boolean",
544
- "default": "true",
545
- "internalPropertyName": "isManualApiEnabled"
542
+ "default": "true"
546
543
  }
547
544
  ],
548
545
  "DD_CIVISIBILITY_RUM_FLUSH_WAIT_MILLIS": [
@@ -597,8 +594,7 @@
597
594
  {
598
595
  "implementation": "A",
599
596
  "type": "boolean",
600
- "default": "true",
601
- "internalPropertyName": "crashtracking.enabled"
597
+ "default": "true"
602
598
  }
603
599
  ],
604
600
  "DD_CUSTOM_TRACE_ID": [
@@ -772,8 +768,7 @@
772
768
  {
773
769
  "implementation": "B",
774
770
  "type": "boolean",
775
- "default": "true",
776
- "internalPropertyName": "propagateProcessTags.enabled"
771
+ "default": "true"
777
772
  }
778
773
  ],
779
774
  "DD_EXPERIMENTAL_TEST_OPT_SETTINGS_CACHE": [
@@ -928,7 +923,6 @@
928
923
  "implementation": "C",
929
924
  "type": "string",
930
925
  "default": "1-16",
931
- "internalPropertyName": "grpc.client.error.statuses",
932
926
  "transform": "setGRPCRange"
933
927
  }
934
928
  ],
@@ -937,7 +931,6 @@
937
931
  "implementation": "C",
938
932
  "type": "string",
939
933
  "default": "2-16",
940
- "internalPropertyName": "grpc.server.error.statuses",
941
934
  "transform": "setGRPCRange"
942
935
  }
943
936
  ],
@@ -945,24 +938,21 @@
945
938
  {
946
939
  "implementation": "A",
947
940
  "type": "int",
948
- "default": "0",
949
- "internalPropertyName": "heapSnapshot.count"
941
+ "default": "0"
950
942
  }
951
943
  ],
952
944
  "DD_HEAP_SNAPSHOT_DESTINATION": [
953
945
  {
954
946
  "implementation": "A",
955
947
  "type": "string",
956
- "default": "",
957
- "internalPropertyName": "heapSnapshot.destination"
948
+ "default": ""
958
949
  }
959
950
  ],
960
951
  "DD_HEAP_SNAPSHOT_INTERVAL": [
961
952
  {
962
953
  "implementation": "A",
963
954
  "type": "int",
964
- "default": "3600",
965
- "internalPropertyName": "heapSnapshot.interval"
955
+ "default": "3600"
966
956
  }
967
957
  ],
968
958
  "DD_IAST_DB_ROWS_TO_TAINT": [
@@ -1105,48 +1095,42 @@
1105
1095
  {
1106
1096
  "implementation": "C",
1107
1097
  "type": "string",
1108
- "default": null,
1109
- "internalPropertyName": "injectionEnabled"
1098
+ "default": null
1110
1099
  }
1111
1100
  ],
1112
1101
  "DD_INJECT_FORCE": [
1113
1102
  {
1114
1103
  "implementation": "A",
1115
1104
  "type": "boolean",
1116
- "default": "false",
1117
- "internalPropertyName": "injectForce"
1105
+ "default": "false"
1118
1106
  }
1119
1107
  ],
1120
1108
  "DD_INSTRUMENTATION_CONFIG_ID": [
1121
1109
  {
1122
1110
  "implementation": "A",
1123
1111
  "type": "string",
1124
- "default": null,
1125
- "internalPropertyName": "instrumentation_config_id"
1112
+ "default": null
1126
1113
  }
1127
1114
  ],
1128
1115
  "DD_INSTRUMENTATION_INSTALL_ID": [
1129
1116
  {
1130
1117
  "implementation": "A",
1131
1118
  "type": "string",
1132
- "default": null,
1133
- "internalPropertyName": "installSignature.id"
1119
+ "default": null
1134
1120
  }
1135
1121
  ],
1136
1122
  "DD_INSTRUMENTATION_INSTALL_TIME": [
1137
1123
  {
1138
1124
  "implementation": "A",
1139
1125
  "type": "string",
1140
- "default": null,
1141
- "internalPropertyName": "installSignature.time"
1126
+ "default": null
1142
1127
  }
1143
1128
  ],
1144
1129
  "DD_INSTRUMENTATION_INSTALL_TYPE": [
1145
1130
  {
1146
1131
  "implementation": "A",
1147
1132
  "type": "string",
1148
- "default": null,
1149
- "internalPropertyName": "installSignature.type"
1133
+ "default": null
1150
1134
  }
1151
1135
  ],
1152
1136
  "DD_INSTRUMENTATION_TELEMETRY_ENABLED": [
@@ -1164,8 +1148,7 @@
1164
1148
  {
1165
1149
  "implementation": "A",
1166
1150
  "type": "int",
1167
- "default": "30000",
1168
- "internalPropertyName": "profiling.longLivedThreshold"
1151
+ "default": "30000"
1169
1152
  }
1170
1153
  ],
1171
1154
  "DD_INTERNAL_PROFILING_TIMELINE_SAMPLING_ENABLED": [
@@ -1240,8 +1223,7 @@
1240
1223
  {
1241
1224
  "implementation": "A",
1242
1225
  "type": "boolean",
1243
- "default": "false",
1244
- "internalPropertyName": "otelLogsEnabled"
1226
+ "default": "false"
1245
1227
  }
1246
1228
  ],
1247
1229
  "DD_TRACE_LOG_LEVEL": [
@@ -1263,8 +1245,7 @@
1263
1245
  {
1264
1246
  "implementation": "A",
1265
1247
  "type": "boolean",
1266
- "default": "false",
1267
- "internalPropertyName": "otelMetricsEnabled"
1248
+ "default": "false"
1268
1249
  }
1269
1250
  ],
1270
1251
  "DD_MINI_AGENT_PATH": [
@@ -1790,16 +1771,14 @@
1790
1771
  {
1791
1772
  "implementation": "A",
1792
1773
  "type": "boolean",
1793
- "default": "false",
1794
- "internalPropertyName": "isKeepingCoverageConfiguration"
1774
+ "default": "false"
1795
1775
  }
1796
1776
  ],
1797
1777
  "DD_TEST_SESSION_NAME": [
1798
1778
  {
1799
1779
  "implementation": "A",
1800
1780
  "type": "string",
1801
- "default": null,
1802
- "internalPropertyName": "ciVisibilityTestSessionName"
1781
+ "default": null
1803
1782
  }
1804
1783
  ],
1805
1784
  "DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED": [
@@ -1950,8 +1929,7 @@
1950
1929
  {
1951
1930
  "implementation": "A",
1952
1931
  "type": "boolean",
1953
- "default": "true",
1954
- "internalPropertyName": "trace.aws.addSpanPointers"
1932
+ "default": "true"
1955
1933
  }
1956
1934
  ],
1957
1935
  "DD_TRACE_AWS_SDK_AWS_BATCH_PROPAGATION_ENABLED": [
@@ -2483,8 +2461,7 @@
2483
2461
  {
2484
2462
  "implementation": "A",
2485
2463
  "type": "string",
2486
- "default": null,
2487
- "internalPropertyName": "trace.dynamoDb.tablePrimaryKeys"
2464
+ "default": null
2488
2465
  }
2489
2466
  ],
2490
2467
  "DD_TRACE_ELASTICSEARCH_ENABLED": [
@@ -2644,8 +2621,7 @@
2644
2621
  {
2645
2622
  "implementation": "A",
2646
2623
  "type": "boolean",
2647
- "default": "true",
2648
- "internalPropertyName": "gitMetadataEnabled"
2624
+ "default": "true"
2649
2625
  }
2650
2626
  ],
2651
2627
  "DD_TRACE_GOOGLE_CLOUD_PUBSUB_ENABLED": [
@@ -2687,8 +2663,7 @@
2687
2663
  {
2688
2664
  "implementation": "A",
2689
2665
  "type": "array",
2690
- "default": "",
2691
- "internalPropertyName": "graphqlErrorExtensions"
2666
+ "default": ""
2692
2667
  }
2693
2668
  ],
2694
2669
  "DD_TRACE_GRAPHQL_TAG_ENABLED": [
@@ -3062,8 +3037,7 @@
3062
3037
  {
3063
3038
  "implementation": "A",
3064
3039
  "type": "boolean",
3065
- "default": "false",
3066
- "internalPropertyName": "memcachedCommandEnabled"
3040
+ "default": "false"
3067
3041
  }
3068
3042
  ],
3069
3043
  "DD_TRACE_MEMCACHED_ENABLED": [
@@ -3185,8 +3159,7 @@
3185
3159
  {
3186
3160
  "implementation": "A",
3187
3161
  "type": "boolean",
3188
- "default": "false",
3189
- "internalPropertyName": "trace.nativeSpanEvents"
3162
+ "default": "false"
3190
3163
  }
3191
3164
  ],
3192
3165
  "DD_TRACE_NET_ENABLED": [
@@ -3429,16 +3402,14 @@
3429
3402
  "type": "string",
3430
3403
  "allowed": "continue|restart|ignore",
3431
3404
  "transform": "toLowerCase",
3432
- "default": "continue",
3433
- "internalPropertyName": "tracePropagationBehaviorExtract"
3405
+ "default": "continue"
3434
3406
  }
3435
3407
  ],
3436
3408
  "DD_TRACE_PROPAGATION_EXTRACT_FIRST": [
3437
3409
  {
3438
3410
  "implementation": "A",
3439
3411
  "type": "boolean",
3440
- "default": "false",
3441
- "internalPropertyName": "tracePropagationExtractFirst"
3412
+ "default": "false"
3442
3413
  }
3443
3414
  ],
3444
3415
  "DD_TRACE_PROPAGATION_STYLE": [
@@ -3678,7 +3649,6 @@
3678
3649
  {
3679
3650
  "implementation": "A",
3680
3651
  "type": "int",
3681
- "internalPropertyName": "spanLeakDebug",
3682
3652
  "default": "0"
3683
3653
  }
3684
3654
  ],
@@ -3831,8 +3801,7 @@
3831
3801
  {
3832
3802
  "implementation": "A",
3833
3803
  "type": "int",
3834
- "default": "512",
3835
- "internalPropertyName": "tagsHeaderMaxLength"
3804
+ "default": "512"
3836
3805
  }
3837
3806
  ],
3838
3807
  "DD_VERSION": [
@@ -3872,7 +3841,6 @@
3872
3841
  {
3873
3842
  "implementation": "A",
3874
3843
  "type": "int",
3875
- "internalPropertyName": "otelMaxExportBatchSize",
3876
3844
  "default": "512",
3877
3845
  "allowed": "[1-9]\\d*"
3878
3846
  }
@@ -3881,7 +3849,6 @@
3881
3849
  {
3882
3850
  "implementation": "A",
3883
3851
  "type": "int",
3884
- "internalPropertyName": "otelMaxQueueSize",
3885
3852
  "default": "2048",
3886
3853
  "allowed": "[1-9]\\d*"
3887
3854
  }
@@ -3890,7 +3857,6 @@
3890
3857
  {
3891
3858
  "implementation": "A",
3892
3859
  "type": "int",
3893
- "internalPropertyName": "otelBatchTimeout",
3894
3860
  "default": "5000",
3895
3861
  "allowed": "[1-9]\\d*"
3896
3862
  }
@@ -3951,8 +3917,7 @@
3951
3917
  {
3952
3918
  "implementation": "A",
3953
3919
  "type": "string",
3954
- "default": null,
3955
- "internalPropertyName": "otelLogsUrl"
3920
+ "default": null
3956
3921
  }
3957
3922
  ],
3958
3923
  "OTEL_EXPORTER_OTLP_LOGS_HEADERS": [
@@ -3970,7 +3935,6 @@
3970
3935
  "implementation": "D",
3971
3936
  "type": "string",
3972
3937
  "default": "http/protobuf",
3973
- "internalPropertyName": "otelLogsProtocol",
3974
3938
  "aliases": [
3975
3939
  "OTEL_EXPORTER_OTLP_PROTOCOL"
3976
3940
  ]
@@ -3980,7 +3944,6 @@
3980
3944
  {
3981
3945
  "implementation": "A",
3982
3946
  "type": "int",
3983
- "internalPropertyName": "otelLogsTimeout",
3984
3947
  "default": "10000",
3985
3948
  "allowed": "[1-9]\\d*",
3986
3949
  "aliases": [
@@ -3992,8 +3955,7 @@
3992
3955
  {
3993
3956
  "implementation": "A",
3994
3957
  "type": "string",
3995
- "default": null,
3996
- "internalPropertyName": "otelMetricsUrl"
3958
+ "default": null
3997
3959
  }
3998
3960
  ],
3999
3961
  "OTEL_EXPORTER_OTLP_METRICS_HEADERS": [
@@ -4011,7 +3973,6 @@
4011
3973
  "implementation": "B",
4012
3974
  "type": "string",
4013
3975
  "default": "http/protobuf",
4014
- "internalPropertyName": "otelMetricsProtocol",
4015
3976
  "aliases": [
4016
3977
  "OTEL_EXPORTER_OTLP_PROTOCOL"
4017
3978
  ]
@@ -4023,7 +3984,6 @@
4023
3984
  "type": "string",
4024
3985
  "allowed": "Delta|Cumulative|LowMemory",
4025
3986
  "transform": "toUpperCase",
4026
- "internalPropertyName": "otelMetricsTemporalityPreference",
4027
3987
  "default": "delta"
4028
3988
  }
4029
3989
  ],
@@ -4032,7 +3992,6 @@
4032
3992
  "implementation": "B",
4033
3993
  "type": "int",
4034
3994
  "allowed": "[1-9]\\d*",
4035
- "internalPropertyName": "otelMetricsTimeout",
4036
3995
  "default": "10000",
4037
3996
  "aliases": [
4038
3997
  "OTEL_EXPORTER_OTLP_TIMEOUT"
@@ -4043,8 +4002,7 @@
4043
4002
  {
4044
4003
  "implementation": "A",
4045
4004
  "type": "string",
4046
- "default": "http/protobuf",
4047
- "internalPropertyName": "otelProtocol"
4005
+ "default": "http/protobuf"
4048
4006
  }
4049
4007
  ],
4050
4008
  "OTEL_EXPORTER_OTLP_TIMEOUT": [
@@ -4052,7 +4010,6 @@
4052
4010
  "implementation": "A",
4053
4011
  "type": "int",
4054
4012
  "allowed": "[1-9]\\d*",
4055
- "internalPropertyName": "otelTimeout",
4056
4013
  "default": "10000"
4057
4014
  }
4058
4015
  ],
@@ -4079,7 +4036,6 @@
4079
4036
  "implementation": "A",
4080
4037
  "type": "int",
4081
4038
  "allowed": "[1-9]\\d*",
4082
- "internalPropertyName": "otelMetricsExportInterval",
4083
4039
  "default": "10000"
4084
4040
  }
4085
4041
  ],
@@ -4088,7 +4044,6 @@
4088
4044
  "implementation": "A",
4089
4045
  "type": "int",
4090
4046
  "allowed": "[1-9]\\d*",
4091
- "internalPropertyName": "otelMetricsExportTimeout",
4092
4047
  "default": "7500"
4093
4048
  }
4094
4049
  ],
@@ -9,7 +9,7 @@ module.exports = function getDebuggerConfig (config, inputPath) {
9
9
  hostname: config.hostname,
10
10
  logLevel: config.logLevel,
11
11
  port: config.port,
12
- propagateProcessTags: config.propagateProcessTags,
12
+ propagateProcessTags: { enabled: config.DD_EXPERIMENTAL_PROPAGATE_PROCESS_TAGS_ENABLED },
13
13
  repositoryUrl: config.repositoryUrl,
14
14
  runtimeId: config.tags['runtime-id'],
15
15
  service: config.service,
@@ -266,6 +266,8 @@ class MetricsAggregationClient {
266
266
  this._captureTree(this._gauges, (node, name, tags) => {
267
267
  this._client.gauge(name, node.value, tags)
268
268
  })
269
+
270
+ this._gauges.clear()
269
271
  }
270
272
 
271
273
  _captureCounters () {
@@ -278,12 +280,7 @@ class MetricsAggregationClient {
278
280
 
279
281
  _captureHistograms () {
280
282
  this._captureTree(this._histograms, (node, name, tags) => {
281
- let stats = node.value
282
-
283
- // Stats can contain garbage data when a value was never recorded.
284
- if (stats.count === 0) {
285
- stats = { max: 0, min: 0, sum: 0, avg: 0, median: 0, p95: 0, count: 0 }
286
- }
283
+ const stats = node.value
287
284
 
288
285
  this._client.gauge(`${name}.min`, stats.min, tags)
289
286
  this._client.gauge(`${name}.max`, stats.max, tags)
@@ -293,9 +290,9 @@ class MetricsAggregationClient {
293
290
  this._client.increment(`${name}.count`, stats.count, tags)
294
291
  this._client.gauge(`${name}.median`, stats.median, tags)
295
292
  this._client.gauge(`${name}.95percentile`, stats.p95, tags)
296
-
297
- node.value.reset()
298
293
  })
294
+
295
+ this._histograms.clear()
299
296
  }
300
297
 
301
298
  _captureTree (tree, fn) {
@@ -11,7 +11,7 @@ function formatSpan (span, config) {
11
11
  span = normalizeSpan(truncateSpan(span, false))
12
12
  if (span.span_events) {
13
13
  // ensure span events are encoded as tags if agent doesn't support native top level span events
14
- if (config.trace.nativeSpanEvents) {
14
+ if (config.DD_TRACE_NATIVE_SPAN_EVENTS) {
15
15
  formatSpanEvents(span)
16
16
  } else {
17
17
  span.meta.events = JSON.stringify(span.span_events)
@@ -34,18 +34,18 @@ function truncateSpan (span, shouldTruncateResourceName = true) {
34
34
  if (shouldTruncateResourceName && span.resource && span.resource.length > MAX_RESOURCE_NAME_LENGTH) {
35
35
  span.resource = `${span.resource.slice(0, MAX_RESOURCE_NAME_LENGTH)}...`
36
36
  }
37
- for (let metaKey in span.meta) {
37
+ for (let metaKey of Object.keys(span.meta)) {
38
38
  const val = span.meta[metaKey]
39
39
  if (metaKey.length > MAX_META_KEY_LENGTH) {
40
40
  delete span.meta[metaKey]
41
41
  metaKey = `${metaKey.slice(0, MAX_META_KEY_LENGTH)}...`
42
- span.metrics[metaKey] = val
42
+ span.meta[metaKey] = val
43
43
  }
44
44
  if (val && val.length > MAX_META_VALUE_LENGTH) {
45
45
  span.meta[metaKey] = `${val.slice(0, MAX_META_VALUE_LENGTH)}...`
46
46
  }
47
47
  }
48
- for (let metricsKey in span.metrics) {
48
+ for (let metricsKey of Object.keys(span.metrics)) {
49
49
  const val = span.metrics[metricsKey]
50
50
  if (metricsKey.length > MAX_METRIC_KEY_LENGTH) {
51
51
  delete span.metrics[metricsKey]
@@ -29,7 +29,7 @@ module.exports = function getExporter (name) {
29
29
  fs.existsSync(constants.DATADOG_LAMBDA_EXTENSION_PATH) ||
30
30
  fs.existsSync(constants.DATADOG_MINI_AGENT_PATH)
31
31
  )
32
- return require(inAWSLambda && !usingAgent ? './exporters/log' : './exporters/agent')
32
+ return inAWSLambda && !usingAgent ? require('./exporters/log') : require('./exporters/agent')
33
33
  }
34
34
  }
35
35
  }
@@ -8,7 +8,7 @@ class GitMetadataTagger {
8
8
  }
9
9
 
10
10
  tagGitMetadata (spanContext) {
11
- if (this._config.gitMetadataEnabled) {
11
+ if (this._config.DD_TRACE_GIT_METADATA_ENABLED) {
12
12
  // These tags are added only to the local root span
13
13
  spanContext._trace.tags[SCI_COMMIT_SHA] = this._config.commitSHA
14
14
  spanContext._trace.tags[SCI_REPOSITORY_URL] = this._config.repositoryUrl
@@ -8,11 +8,11 @@ const { threadId } = require('worker_threads')
8
8
  const log = require('./log')
9
9
 
10
10
  async function scheduleSnapshot (config, total) {
11
- if (total > config.heapSnapshot.count) return
11
+ if (total > config.DD_HEAP_SNAPSHOT_COUNT) return
12
12
 
13
- await setTimeout(config.heapSnapshot.interval * 1000, null, { ref: false })
13
+ await setTimeout(config.DD_HEAP_SNAPSHOT_INTERVAL * 1000, null, { ref: false })
14
14
  await clearMemory()
15
- writeHeapSnapshot(getName(config.heapSnapshot.destination))
15
+ writeHeapSnapshot(getName(config.DD_HEAP_SNAPSHOT_DESTINATION))
16
16
  await scheduleSnapshot(config, total + 1)
17
17
  }
18
18
 
@@ -49,7 +49,7 @@ module.exports = {
49
49
  * @param {import('./config/config-base')} config - Tracer configuration
50
50
  */
51
51
  async start (config) {
52
- const destination = config.heapSnapshot.destination
52
+ const destination = config.DD_HEAP_SNAPSHOT_DESTINATION
53
53
 
54
54
  try {
55
55
  await scheduleSnapshot(config, 1)
@@ -16,6 +16,9 @@ module.exports = {
16
16
  NAME: '_ml_obs.name',
17
17
  TRACE_ID: '_ml_obs.trace_id',
18
18
  PROPAGATED_TRACE_ID_KEY: '_dd.p.llmobs_trace_id',
19
+ LLMOBS_TRACE_ID_BRIDGE_KEY: 'llmobs_trace_id',
20
+ LLMOBS_PARENT_ID_BRIDGE_KEY: 'llmobs_parent_id',
21
+ LLMOBS_SUBMITTED_TAG_KEY: '_dd.llmobs.submitted',
19
22
  ROOT_PARENT_ID: 'undefined',
20
23
  DEFAULT_PROMPT_NAME: 'unnamed-prompt',
21
24
  INTERNAL_CONTEXT_VARIABLE_KEYS: '_dd_context_variable_keys',
@@ -7,7 +7,13 @@ const tracerVersion = require('../../../../package.json').version
7
7
  const logger = require('../log')
8
8
  const { getValueFromEnvSources } = require('../config/helper')
9
9
  const Span = require('../opentracing/span')
10
- const { SPAN_KIND, OUTPUT_VALUE, INPUT_VALUE } = require('./constants/tags')
10
+ const {
11
+ SPAN_KIND,
12
+ OUTPUT_VALUE,
13
+ INPUT_VALUE,
14
+ LLMOBS_TRACE_ID_BRIDGE_KEY,
15
+ LLMOBS_PARENT_ID_BRIDGE_KEY,
16
+ } = require('./constants/tags')
11
17
  const {
12
18
  getFunctionArguments,
13
19
  validateKind,
@@ -533,6 +539,20 @@ class LLMObs extends NoopLLMObs {
533
539
  ...options,
534
540
  parent: parentStore?.span,
535
541
  })
542
+
543
+ // Bridge tags read by the dd-go LLMObs trace-indexer to correlate OTel
544
+ // gen_ai.* spans with SDK LLMObs spans. Written once per local trace,
545
+ // on the first successful SDK LLMObs span registration. The shared
546
+ // _trace.tags bag is serialized to the first span in every flushed
547
+ // chunk's meta, so partial flush is covered automatically without a
548
+ // separate flush-time processor. Writing only after registerLLMObsSpan
549
+ // succeeds avoids poisoning _trace.tags with bridge tags pointing at a
550
+ // span that will never produce an LLMObs event.
551
+ const traceTags = span?.context?.()._trace?.tags
552
+ if (this.enabled && traceTags && !traceTags[LLMOBS_TRACE_ID_BRIDGE_KEY]) {
553
+ traceTags[LLMOBS_TRACE_ID_BRIDGE_KEY] = span.context().toTraceId(true)
554
+ traceTags[LLMOBS_PARENT_ID_BRIDGE_KEY] = span.context().toSpanId()
555
+ }
536
556
  }
537
557
 
538
558
  try {
@@ -30,6 +30,7 @@ const {
30
30
  INPUT_PROMPT,
31
31
  ROUTING_API_KEY,
32
32
  ROUTING_SITE,
33
+ LLMOBS_SUBMITTED_TAG_KEY,
33
34
  } = require('./constants/tags')
34
35
  const { UNSERIALIZABLE_VALUE_TEXT } = require('./constants/text')
35
36
  const telemetry = require('./telemetry')
@@ -87,7 +88,19 @@ class LLMObsSpanProcessor {
87
88
  site: mlObsTags[ROUTING_SITE],
88
89
  }
89
90
 
90
- this.#writer.append(formattedEvent, routing)
91
+ const enqueued = this.#writer.append(formattedEvent, routing)
92
+
93
+ // Marker read by the dd-go LLMObs trace-indexer: when reparenting OTel
94
+ // gen_ai.* spans, the parent-chain walk stops at any span carrying this
95
+ // tag, preserving this span as the immediate LLMObs parent. Set only
96
+ // when the writer actually buffered the event — format may have dropped
97
+ // it (user processor returned null), thrown, or the writer may have
98
+ // dropped it silently when its buffer is full. Leaving this tag off in
99
+ // those cases avoids dd-go reparenting OTel children under a span that
100
+ // has no corresponding LLMObs event.
101
+ if (enqueued) {
102
+ span.context()._tags[LLMOBS_SUBMITTED_TAG_KEY] = '1'
103
+ }
91
104
  } catch (e) {
92
105
  // this should be a rare case
93
106
  // we protect against unserializable properties in the format function, and in
@@ -87,19 +87,25 @@ class BaseLLMObsWriter {
87
87
  return buffer
88
88
  }
89
89
 
90
+ /**
91
+ * @returns {boolean} `true` if the event was buffered, `false` if it was dropped
92
+ * (e.g. the per-routing buffer was full). Callers that depend on the event
93
+ * actually being submitted should check this value.
94
+ */
90
95
  append (event, routing, byteLength) {
91
96
  const buffer = this._getBuffer(routing)
92
97
 
93
98
  if (buffer.events.length >= buffer.limit) {
94
99
  logger.warn(`${this.constructor.name} event buffer full (limit is ${buffer.limit}), dropping event`)
95
100
  telemetry.recordDroppedPayload(1, this._eventType, 'buffer_full')
96
- return
101
+ return false
97
102
  }
98
103
 
99
104
  const eventSize = byteLength || Buffer.byteLength(JSON.stringify(event))
100
105
 
101
106
  buffer.size += eventSize
102
107
  buffer.events.push(event)
108
+ return true
103
109
  }
104
110
 
105
111
  flush () {
@@ -45,7 +45,7 @@ class LLMObsSpanWriter extends BaseWriter {
45
45
  this.flush()
46
46
  }
47
47
 
48
- super.append(event, routing, processedEventSizeBytes)
48
+ return super.append(event, routing, processedEventSizeBytes)
49
49
  }
50
50
 
51
51
  makePayload (events) {
@@ -30,7 +30,7 @@ const COUNTER_UNIT = '{evaluation}'
30
30
  * If counter creation fails (e.g. the OTel API is not yet available), the call
31
31
  * is silently skipped and retried on the next `finally()` invocation.
32
32
  *
33
- * When `config.otelMetricsEnabled` is false, `finally()` is always a no-op.
33
+ * When `config.DD_METRICS_OTEL_ENABLED` is false, `finally()` is always a no-op.
34
34
  */
35
35
  class EvalMetricsHook {
36
36
  #enabled = false
@@ -40,7 +40,7 @@ class EvalMetricsHook {
40
40
  * @param {import('../config')} config - Tracer configuration object
41
41
  */
42
42
  constructor (config) {
43
- this.#enabled = config.otelMetricsEnabled === true
43
+ this.#enabled = config.DD_METRICS_OTEL_ENABLED === true
44
44
  }
45
45
 
46
46
  /**