dd-trace 6.20.1 → 6.22.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.
- package/ci/diagnose.js +9 -14
- package/ci/init.js +1 -2
- package/ci/test-optimization-validation/ci-discovery.js +9 -4
- package/ci/test-optimization-validation/executable.js +1 -5
- package/ci/test-optimization-validation/framework-adapters/cypress.js +1 -4
- package/ci/test-optimization-validation/framework-adapters/vitest.js +1 -1
- package/ci/test-optimization-validation/generated-files.js +6 -4
- package/ci/test-optimization-validation/generated-test-contract.js +7 -3
- package/ci/test-optimization-validation/manifest-scaffold.js +7 -2
- package/ci/test-optimization-validation/manifest-schema.js +6 -7
- package/ci/test-optimization-validation/report-writer.js +6 -2
- package/ci/test-optimization-validation/runner-command.js +2 -4
- package/ci/test-optimization-validation/runner-contract.js +1 -2
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +1 -15
- package/ci/vitest-no-worker-init-setup.mjs +10 -7
- package/index.d.ts +116 -17
- package/initialize.mjs +1 -3
- package/openfeature/rules-based.d.ts +11 -0
- package/openfeature/rules-based.js +7 -0
- package/package.json +13 -11
- package/packages/datadog-core/src/storage.js +16 -0
- package/packages/datadog-esbuild/index.js +18 -12
- package/packages/datadog-instrumentations/src/aerospike.js +3 -3
- package/packages/datadog-instrumentations/src/ai.js +3 -3
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +0 -6
- package/packages/datadog-instrumentations/src/aws-sdk.js +21 -13
- package/packages/datadog-instrumentations/src/cassandra-driver.js +25 -20
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +9 -23
- package/packages/datadog-instrumentations/src/cucumber.js +48 -33
- package/packages/datadog-instrumentations/src/elasticsearch.js +1 -5
- package/packages/datadog-instrumentations/src/electron.js +6 -6
- package/packages/datadog-instrumentations/src/fastify.js +13 -4
- package/packages/datadog-instrumentations/src/fs.js +2 -2
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +9 -5
- package/packages/datadog-instrumentations/src/grpc/client.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-register.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +1 -2
- package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/register.js +36 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +2 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +87 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql-jit.js +5 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +48 -31
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/webdriverio.js +64 -11
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +1 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +42 -4
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +7 -10
- package/packages/datadog-instrumentations/src/ioredis.js +7 -5
- package/packages/datadog-instrumentations/src/iovalkey.js +7 -5
- package/packages/datadog-instrumentations/src/jest.js +122 -11
- package/packages/datadog-instrumentations/src/knex.js +9 -5
- package/packages/datadog-instrumentations/src/mariadb-bundle.js +3 -3
- package/packages/datadog-instrumentations/src/mocha/common.js +20 -8
- package/packages/datadog-instrumentations/src/mocha/main.js +140 -43
- package/packages/datadog-instrumentations/src/mocha/utils.js +127 -38
- package/packages/datadog-instrumentations/src/mocha/webdriverio-protocol.js +61 -34
- package/packages/datadog-instrumentations/src/mocha/worker.js +7 -5
- package/packages/datadog-instrumentations/src/mongodb-core.js +3 -3
- package/packages/datadog-instrumentations/src/mongoose.js +3 -3
- package/packages/datadog-instrumentations/src/nova-sonic/audio.js +173 -0
- package/packages/datadog-instrumentations/src/nova-sonic/index.js +209 -0
- package/packages/datadog-instrumentations/src/nova-sonic/session.js +483 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +18 -6
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +1 -1
- package/packages/datadog-instrumentations/src/openai.js +7 -0
- package/packages/datadog-instrumentations/src/pino.js +5 -6
- package/packages/datadog-instrumentations/src/playwright.js +3 -0
- package/packages/datadog-instrumentations/src/redis.js +27 -13
- package/packages/datadog-instrumentations/src/router.js +30 -0
- package/packages/datadog-instrumentations/src/rum-browser-scripts.js +2 -6
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +7 -5
- package/packages/datadog-instrumentations/src/vitest-main.js +9 -17
- package/packages/datadog-instrumentations/src/vitest-util.js +2 -2
- package/packages/datadog-instrumentations/src/vitest-worker.js +1 -2
- package/packages/datadog-instrumentations/src/vitest.js +2 -2
- package/packages/datadog-instrumentations/src/webdriverio.js +118 -21
- package/packages/datadog-instrumentations/src/ws.js +1 -4
- package/packages/datadog-plugin-amqplib/src/client.js +1 -2
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +1 -5
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/handler.js +1 -2
- package/packages/datadog-plugin-aws-sdk/src/base.js +5 -8
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/index.js +18 -0
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/sonic.js +45 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +9 -3
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +2 -5
- package/packages/datadog-plugin-azure-durable-functions/src/index.js +5 -4
- package/packages/datadog-plugin-azure-functions/src/index.js +5 -3
- package/packages/datadog-plugin-claude-agent-sdk/src/index.js +0 -2
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +18 -5
- package/packages/datadog-plugin-cypress/src/index.js +6 -6
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +1 -2
- package/packages/datadog-plugin-cypress/src/support.js +1 -4
- package/packages/datadog-plugin-express/src/code_origin.js +1 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +1 -2
- package/packages/datadog-plugin-graphql/src/execute.js +5 -5
- package/packages/datadog-plugin-grpc/src/util.js +1 -2
- package/packages/datadog-plugin-kafkajs/src/producer.js +1 -2
- package/packages/datadog-plugin-mocha/src/index.js +223 -39
- package/packages/datadog-plugin-mocha/src/webdriverio-video.js +453 -0
- package/packages/datadog-plugin-mongodb-core/src/query.js +8 -5
- package/packages/datadog-plugin-next/src/index.js +1 -2
- package/packages/datadog-plugin-openai/src/tracing.js +5 -2
- package/packages/datadog-plugin-openai-agents/src/integration.js +6 -2
- package/packages/datadog-plugin-openai-agents/src/processor.js +2 -4
- package/packages/datadog-plugin-postgres/src/index.js +24 -0
- package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +1 -5
- package/packages/datadog-plugin-rhea/src/consumer.js +1 -4
- package/packages/datadog-plugin-vitest/src/index.js +5 -2
- package/packages/datadog-shimmer/src/shimmer.js +5 -4
- package/packages/datadog-webpack/index.js +55 -43
- package/packages/datadog-webpack/src/loader.js +56 -8
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +2 -4
- package/packages/dd-trace/src/aiguard/messages/utils.js +1 -2
- package/packages/dd-trace/src/aiguard/redaction.js +8 -2
- package/packages/dd-trace/src/appsec/api_security/normalized-route.js +3 -2
- package/packages/dd-trace/src/appsec/api_security/sampler.js +2 -6
- package/packages/dd-trace/src/appsec/downstream_requests.js +1 -9
- package/packages/dd-trace/src/appsec/handlers/http-request.js +3 -9
- package/packages/dd-trace/src/appsec/handlers/http-response.js +7 -2
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +4 -3
- package/packages/dd-trace/src/appsec/iast/analyzers/set-cookies-header-interceptor.js +1 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +7 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +1 -3
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +1 -3
- package/packages/dd-trace/src/appsec/iast/telemetry/iast-metric.js +1 -6
- package/packages/dd-trace/src/appsec/lambda.js +1 -3
- package/packages/dd-trace/src/appsec/rasp/fs-plugin.js +37 -27
- package/packages/dd-trace/src/appsec/rasp/lfi.js +9 -5
- package/packages/dd-trace/src/appsec/reporter.js +21 -1
- package/packages/dd-trace/src/appsec/stack_trace.js +1 -2
- package/packages/dd-trace/src/ci-visibility/dynamic-atr-retries.js +3 -6
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +1 -1
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +13 -7
- package/packages/dd-trace/src/ci-visibility/exporters/settings-cache-key.js +1 -2
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +2 -8
- package/packages/dd-trace/src/ci-visibility/resolve-runfile-path.js +54 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +5 -8
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +2 -53
- package/packages/dd-trace/src/config/config-types.d.ts +2 -2
- package/packages/dd-trace/src/config/defaults.js +5 -5
- package/packages/dd-trace/src/config/generated-config-types.d.ts +8 -0
- package/packages/dd-trace/src/config/helper.js +34 -3
- package/packages/dd-trace/src/config/index.js +10 -9
- package/packages/dd-trace/src/config/normalize-service.js +1 -1
- package/packages/dd-trace/src/config/parsers.js +2 -2
- package/packages/dd-trace/src/config/supported-configurations.json +35 -0
- package/packages/dd-trace/src/datastreams/processor.js +3 -2
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +1 -4
- package/packages/dd-trace/src/debugger/constants.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/index.js +5 -3
- package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +17 -12
- package/packages/dd-trace/src/debugger/devtools_client/send.js +7 -2
- package/packages/dd-trace/src/debugger/devtools_client/status.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/worker-error.js +21 -0
- package/packages/dd-trace/src/debugger/guardrail-metrics.js +2 -2
- package/packages/dd-trace/src/debugger/index.js +24 -2
- package/packages/dd-trace/src/debugger/probe_sampler.js +108 -11
- package/packages/dd-trace/src/dogstatsd.js +1 -1
- package/packages/dd-trace/src/encode/tags-processors.js +2 -2
- package/packages/dd-trace/src/exporters/common/request.js +2 -5
- package/packages/dd-trace/src/exporters/common/url.js +1 -1
- package/packages/dd-trace/src/id.js +15 -5
- package/packages/dd-trace/src/lambda/handler.js +179 -19
- package/packages/dd-trace/src/lambda/index.js +15 -1
- package/packages/dd-trace/src/lambda/runtime/patch.js +34 -7
- package/packages/dd-trace/src/llmobs/agent-manifest.js +296 -0
- package/packages/dd-trace/src/llmobs/audio-utils.js +3 -2
- package/packages/dd-trace/src/llmobs/constants/tags.js +13 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/anthropic/index.js +15 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +1 -2
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +1 -3
- package/packages/dd-trace/src/llmobs/plugins/langgraph/index.js +1 -1
- package/packages/dd-trace/src/llmobs/plugins/nova-sonic.js +92 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +56 -2
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +38 -0
- package/packages/dd-trace/src/llmobs/prompts/manager.js +5 -7
- package/packages/dd-trace/src/llmobs/prompts/prompt.js +1 -1
- package/packages/dd-trace/src/llmobs/sdk.js +23 -6
- package/packages/dd-trace/src/llmobs/span_processor.js +18 -8
- package/packages/dd-trace/src/llmobs/tagger.js +56 -3
- package/packages/dd-trace/src/llmobs/util.js +1 -2
- package/packages/dd-trace/src/llmobs/writers/base.js +7 -6
- package/packages/dd-trace/src/llmobs/writers/util.js +3 -1
- package/packages/dd-trace/src/log/log.js +1 -5
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +30 -1
- package/packages/dd-trace/src/openfeature/configuration_source.js +17 -2
- package/packages/dd-trace/src/openfeature/debug-logging-hook.js +25 -0
- package/packages/dd-trace/src/openfeature/evaluation-telemetry-opt-out-hook.js +51 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +59 -3
- package/packages/dd-trace/src/openfeature/remote_config.js +9 -0
- package/packages/dd-trace/src/openfeature/writers/util.js +43 -4
- package/packages/dd-trace/src/opentelemetry/logs/otlp_transformer.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_transformer.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +1 -2
- package/packages/dd-trace/src/opentelemetry/otlp/common.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/resource-attributes.js +1 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +6 -23
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +53 -13
- package/packages/dd-trace/src/otel-sampling.js +4 -5
- package/packages/dd-trace/src/otel-thread-ctx.js +81 -15
- package/packages/dd-trace/src/plugins/database.js +7 -16
- package/packages/dd-trace/src/plugins/util/git.js +9 -25
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +1 -5
- package/packages/dd-trace/src/plugins/util/test.js +48 -4
- package/packages/dd-trace/src/priority_sampler.js +1 -2
- package/packages/dd-trace/src/profiling/profiler.js +4 -6
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -10
- package/packages/dd-trace/src/proxy.js +3 -2
- package/packages/dd-trace/src/ritm.js +4 -2
- package/packages/dd-trace/src/serverless.js +10 -0
- package/packages/dd-trace/src/span_processor.js +13 -17
- package/packages/dd-trace/src/storage-channels.js +112 -46
- package/packages/dd-trace/src/telemetry/endpoints.js +1 -3
- package/packages/dd-trace/src/util.js +29 -0
- package/packages/dd-trace/src/web-tags-cache.js +6 -2
- package/vendor/dist/@datadog/openfeature-node-server/index.js +1 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +201 -0
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.d.ts +925 -0
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/index.js +1 -0
- package/vendor/dist/@datadog/sketches-js/index.js +1 -1
- package/vendor/dist/protobufjs/index.js +1 -1
- package/vendor/dist/protobufjs/minimal/index.js +1 -1
- package/vendor/dist/shell-quote/index.js +1 -1
|
@@ -154,12 +154,8 @@ class SchemaExtractor {
|
|
|
154
154
|
span.setTag(SCHEMA_NAME, descriptor.name)
|
|
155
155
|
span.setTag(SCHEMA_OPERATION, operation)
|
|
156
156
|
|
|
157
|
-
if (!tracer._dataStreamsProcessor.canSampleSchema(operation)) {
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
|
|
161
157
|
// if the span is unsampled, do not sample the schema
|
|
162
|
-
if (!tracer._prioritySampler.isSampled(span)) {
|
|
158
|
+
if (!tracer._dataStreamsProcessor.canSampleSchema(operation) || !tracer._prioritySampler.isSampled(span)) {
|
|
163
159
|
return
|
|
164
160
|
}
|
|
165
161
|
|
|
@@ -90,8 +90,7 @@ function finishOpenChildSpans (executeSpan) {
|
|
|
90
90
|
if (!trace?.started) return
|
|
91
91
|
|
|
92
92
|
for (const span of trace.started) {
|
|
93
|
-
if (span === executeSpan) continue
|
|
94
|
-
if (span._integrationName !== AwsDurableExecutionSdkJsHandlerPlugin.id) continue
|
|
93
|
+
if (span === executeSpan || span._integrationName !== AwsDurableExecutionSdkJsHandlerPlugin.id) continue
|
|
95
94
|
if (span._duration === undefined) {
|
|
96
95
|
span.finish()
|
|
97
96
|
}
|
|
@@ -125,7 +125,7 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
125
125
|
})
|
|
126
126
|
|
|
127
127
|
this.addSub(`apm:aws:request:start:${this.serviceIdentifier}`, (ctx) => {
|
|
128
|
-
if (!IS_SERVERLESS) return
|
|
128
|
+
if (!IS_SERVERLESS || !ctx.currentStore?.span) return
|
|
129
129
|
|
|
130
130
|
const { awsRegion, awsService, currentStore, request } = ctx
|
|
131
131
|
const peerServerlessStorage = storage('peerServerless')
|
|
@@ -145,10 +145,8 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
145
145
|
}
|
|
146
146
|
})
|
|
147
147
|
|
|
148
|
-
this.addSub(`apm:aws:request:region:${this.serviceIdentifier}`, ({ region }) => {
|
|
149
|
-
const
|
|
150
|
-
if (!store) return
|
|
151
|
-
const { span } = store
|
|
148
|
+
this.addSub(`apm:aws:request:region:${this.serviceIdentifier}`, ({ region, currentStore }) => {
|
|
149
|
+
const span = currentStore?.span
|
|
152
150
|
if (!span) return
|
|
153
151
|
span.setTag('aws.region', region)
|
|
154
152
|
span.setTag('region', region)
|
|
@@ -160,7 +158,7 @@ class BaseAwsSdkPlugin extends ClientPlugin {
|
|
|
160
158
|
|
|
161
159
|
if (!IS_SERVERLESS) return
|
|
162
160
|
|
|
163
|
-
const hostname = getHostname(
|
|
161
|
+
const hostname = getHostname(currentStore, region)
|
|
164
162
|
if (!hostname) return
|
|
165
163
|
|
|
166
164
|
span.setTag('peer.service', hostname)
|
|
@@ -338,8 +336,7 @@ function getHooks (config) {
|
|
|
338
336
|
}
|
|
339
337
|
|
|
340
338
|
function getHostname (store, region) {
|
|
341
|
-
if (!store) return
|
|
342
|
-
if (!region) return
|
|
339
|
+
if (!store || !region) return
|
|
343
340
|
const { awsParams, awsService } = store
|
|
344
341
|
switch (awsService) {
|
|
345
342
|
case 'CloudWatchEvents':
|
|
@@ -2,15 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
const CompositePlugin = require('../../../../dd-trace/src/plugins/composite')
|
|
4
4
|
const BedrockRuntimeLLMObsPlugin = require('../../../../dd-trace/src/llmobs/plugins/bedrockruntime')
|
|
5
|
+
const SonicLLMObsPlugin = require('../../../../dd-trace/src/llmobs/plugins/nova-sonic')
|
|
5
6
|
const BedrockRuntimeTracing = require('./tracing')
|
|
7
|
+
const SonicTracingPlugin = require('./sonic')
|
|
6
8
|
class BedrockRuntimePlugin extends CompositePlugin {
|
|
7
9
|
static id = 'bedrockruntime'
|
|
8
10
|
|
|
9
11
|
static get plugins () {
|
|
10
12
|
return {
|
|
11
13
|
llmobs: BedrockRuntimeLLMObsPlugin,
|
|
14
|
+
sonicLlmobs: SonicLLMObsPlugin,
|
|
12
15
|
tracing: BedrockRuntimeTracing,
|
|
16
|
+
sonicTracing: SonicTracingPlugin,
|
|
13
17
|
}
|
|
14
18
|
}
|
|
19
|
+
|
|
20
|
+
/** @param {import('../../../../../').plugins.aws_sdk | boolean} config */
|
|
21
|
+
configure (config) {
|
|
22
|
+
if (typeof config === 'boolean') config = { enabled: config }
|
|
23
|
+
const bedrock = config.bedrockruntime
|
|
24
|
+
if (config.enabled === false || bedrock === false || bedrock?.enabled === false ||
|
|
25
|
+
this._tracerConfig.DD_TRACE_AWS_SDK_BEDROCKRUNTIME_ENABLED === false) {
|
|
26
|
+
// Disable the whole service before any child can subscribe and enable conversation capture.
|
|
27
|
+
return super.configure(false)
|
|
28
|
+
}
|
|
29
|
+
const normalized = { ...config, ...bedrock }
|
|
30
|
+
if (config.llmobs === false) normalized.llmobs = false
|
|
31
|
+
super.configure(normalized)
|
|
32
|
+
}
|
|
15
33
|
}
|
|
16
34
|
module.exports = BedrockRuntimePlugin
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { storage } = require('../../../../datadog-core')
|
|
4
|
+
const TracingPlugin = require('../../../../dd-trace/src/plugins/tracing')
|
|
5
|
+
|
|
6
|
+
const legacyStorage = storage('legacy')
|
|
7
|
+
|
|
8
|
+
class SonicTracingPlugin extends TracingPlugin {
|
|
9
|
+
static id = 'bedrockruntime_sonic'
|
|
10
|
+
static component = 'aws-sdk'
|
|
11
|
+
static operation = 'sonic'
|
|
12
|
+
static prefix = 'tracing:apm:aws:bedrockruntime:sonic:span'
|
|
13
|
+
|
|
14
|
+
constructor (...args) {
|
|
15
|
+
super(...args)
|
|
16
|
+
this.addSub('dd-trace:aws:bedrockruntime:sonic:capture-context', context => {
|
|
17
|
+
const store = legacyStorage.getStore()
|
|
18
|
+
const previous = context.runInContext ?? (fn => fn())
|
|
19
|
+
context.runInContext = fn => previous(() => legacyStorage.run(store, fn))
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** @param {object} ctx */
|
|
24
|
+
bindStart (ctx) {
|
|
25
|
+
this.startSpan('aws.bedrockruntime.sonic', {
|
|
26
|
+
service: this.config.service,
|
|
27
|
+
resource: ctx.name,
|
|
28
|
+
type: 'bedrockruntime',
|
|
29
|
+
kind: 'client',
|
|
30
|
+
startTime: ctx.startTime,
|
|
31
|
+
meta: { 'aws.bedrock.request.model': ctx.model },
|
|
32
|
+
}, ctx)
|
|
33
|
+
return ctx.currentStore
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @param {object} ctx */
|
|
37
|
+
end (ctx) {
|
|
38
|
+
const span = ctx.currentStore?.span
|
|
39
|
+
if (!span) return
|
|
40
|
+
if (ctx.descriptor.error) span.setTag('error', ctx.descriptor.error)
|
|
41
|
+
span.finish(ctx.finishTime)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = SonicTracingPlugin
|
|
@@ -174,9 +174,15 @@ class Kinesis extends BaseAwsSdkPlugin {
|
|
|
174
174
|
|
|
175
175
|
responseExtractDSMContext (operation, params, response, span, kwargs = {}) {
|
|
176
176
|
const { streamName } = kwargs
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
if (
|
|
178
|
+
!this.config.dsmEnabled ||
|
|
179
|
+
operation !== 'getRecords' ||
|
|
180
|
+
!response ||
|
|
181
|
+
!response.Records ||
|
|
182
|
+
!response.Records[0]
|
|
183
|
+
) {
|
|
184
|
+
return
|
|
185
|
+
}
|
|
180
186
|
|
|
181
187
|
// Only attribute payloadSize to the span when there is a single record.
|
|
182
188
|
span = response.Records.length > 1 ? null : span
|
|
@@ -202,8 +202,7 @@ class Sqs extends BaseAwsSdkPlugin {
|
|
|
202
202
|
* @returns {Array<Record<string, string> | undefined> | undefined}
|
|
203
203
|
*/
|
|
204
204
|
responseExtract (params, operation, response) {
|
|
205
|
-
if (operation !== 'receiveMessage') return
|
|
206
|
-
if (!response?.Messages?.length) return
|
|
205
|
+
if (operation !== 'receiveMessage' || !response?.Messages?.length) return
|
|
207
206
|
|
|
208
207
|
return response.Messages.map(message => this.parseMessageCarrier(message))
|
|
209
208
|
}
|
|
@@ -261,9 +260,7 @@ class Sqs extends BaseAwsSdkPlugin {
|
|
|
261
260
|
* carriers are parsed here.
|
|
262
261
|
*/
|
|
263
262
|
responseExtractDSMContext (operation, params, response, span, carriers) {
|
|
264
|
-
if (!this.config.dsmEnabled) return
|
|
265
|
-
if (operation !== 'receiveMessage') return
|
|
266
|
-
if (!response?.Messages?.length) return
|
|
263
|
+
if (!this.config.dsmEnabled || operation !== 'receiveMessage' || !response?.Messages?.length) return
|
|
267
264
|
|
|
268
265
|
const messages = response.Messages
|
|
269
266
|
// Only attribute payloadSize to the span when there is a single message.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
4
4
|
const { AUTO_KEEP } = require('../../../ext/priority')
|
|
5
|
+
const { getIsAzureContainerApp } = require('../../dd-trace/src/serverless')
|
|
5
6
|
const { writeTraceparent, writeTracestate } = require('../../dd-trace/src/carrier')
|
|
6
7
|
|
|
7
8
|
const ORCHESTRATION_FAILURE_END_CHANNEL =
|
|
@@ -39,7 +40,7 @@ class AzureDurableFunctionsPlugin extends TracingPlugin {
|
|
|
39
40
|
childOf = this.tracer.extract('text_map', carrier) ?? undefined
|
|
40
41
|
}
|
|
41
42
|
const extractedAsDrop = childOf?._sampling.priority < AUTO_KEEP
|
|
42
|
-
|
|
43
|
+
const prefix = getIsAzureContainerApp() ? 'aca' : 'aas'
|
|
43
44
|
const span = this.startSpan(this.operationName(), {
|
|
44
45
|
startTime: ctx.startTime,
|
|
45
46
|
childOf,
|
|
@@ -48,15 +49,15 @@ class AzureDurableFunctionsPlugin extends TracingPlugin {
|
|
|
48
49
|
|
|
49
50
|
meta: {
|
|
50
51
|
component: 'azure-functions',
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
[`${prefix}.function.name`]: ctx.functionName,
|
|
53
|
+
[`${prefix}.function.trigger`]: ctx.trigger,
|
|
53
54
|
'resource.name': `${ctx.trigger} ${ctx.functionName}`,
|
|
54
55
|
},
|
|
55
56
|
}, ctx)
|
|
56
57
|
|
|
57
58
|
// in the case of entity functions, operationName should be available
|
|
58
59
|
if (ctx.operationName) {
|
|
59
|
-
span.setTag(
|
|
60
|
+
span.setTag(`${prefix}.function.operation`, ctx.operationName)
|
|
60
61
|
span.setTag('resource.name', `${ctx.trigger} ${ctx.functionName} ${ctx.operationName}`
|
|
61
62
|
)
|
|
62
63
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const TracingPlugin = require('../../dd-trace/src/plugins/tracing')
|
|
4
4
|
const web = require('../../dd-trace/src/plugins/util/web')
|
|
5
|
+
const { getIsAzureContainerApp } = require('../../dd-trace/src/serverless')
|
|
5
6
|
|
|
6
7
|
const triggerMap = {
|
|
7
8
|
deleteRequest: 'Http',
|
|
@@ -52,7 +53,6 @@ class AzureFunctionsPlugin extends TracingPlugin {
|
|
|
52
53
|
req,
|
|
53
54
|
ctx
|
|
54
55
|
)
|
|
55
|
-
|
|
56
56
|
span._integrationName = 'azure-functions'
|
|
57
57
|
span.context().setTag('component', 'azure-functions')
|
|
58
58
|
span.addTags(meta)
|
|
@@ -102,9 +102,11 @@ class AzureFunctionsPlugin extends TracingPlugin {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
function getMetaForTrigger ({ functionName, methodName, invocationContext }) {
|
|
105
|
+
const prefix = getIsAzureContainerApp() ? 'aca' : 'aas'
|
|
106
|
+
|
|
105
107
|
let meta = {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
[`${prefix}.function.name`]: functionName,
|
|
109
|
+
[`${prefix}.function.trigger`]: mapTriggerTag(methodName),
|
|
108
110
|
'span.type': 'serverless',
|
|
109
111
|
}
|
|
110
112
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
require('../../datadog-instrumentations/src/claude-agent-sdk')
|
|
4
|
-
|
|
5
3
|
const CompositePlugin = require('../../dd-trace/src/plugins/composite')
|
|
6
4
|
const ClaudeAgentSdkLLMObsPlugins = require('../../dd-trace/src/llmobs/plugins/claude-agent-sdk')
|
|
7
5
|
const ClaudeAgentSdkTracingPlugins = require('./tracing')
|
|
@@ -51,6 +51,8 @@ const {
|
|
|
51
51
|
TEST_ITR_UNSKIPPABLE,
|
|
52
52
|
TEST_ITR_FORCED_RUN,
|
|
53
53
|
TEST_ITR_SKIPPING_ENABLED,
|
|
54
|
+
TEST_ITR_SKIPPING_COUNT,
|
|
55
|
+
TEST_ITR_TESTS_SKIPPED,
|
|
54
56
|
ITR_CORRELATION_ID,
|
|
55
57
|
TEST_SOURCE_FILE,
|
|
56
58
|
TEST_IS_NEW,
|
|
@@ -1045,6 +1047,11 @@ class CypressPlugin {
|
|
|
1045
1047
|
...this.getSessionItrSkippingEnabledTags(),
|
|
1046
1048
|
}
|
|
1047
1049
|
|
|
1050
|
+
if (this.isItrEnabled) {
|
|
1051
|
+
testSuiteSpanMetadata[TEST_ITR_SKIPPING_COUNT] = 0
|
|
1052
|
+
testSuiteSpanMetadata[TEST_ITR_TESTS_SKIPPED] = 'false'
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1048
1055
|
this.ciVisEvent(TELEMETRY_EVENT_CREATED, 'suite')
|
|
1049
1056
|
|
|
1050
1057
|
if (testSuiteAbsolutePath) {
|
|
@@ -1519,11 +1526,7 @@ class CypressPlugin {
|
|
|
1519
1526
|
: undefined
|
|
1520
1527
|
const testSpan = this.activeTestSpan || lastFailedTestSpan
|
|
1521
1528
|
|
|
1522
|
-
if (!testSpan) {
|
|
1523
|
-
return
|
|
1524
|
-
}
|
|
1525
|
-
|
|
1526
|
-
if (!isFailureScreenshotForUpload(details)) {
|
|
1529
|
+
if (!testSpan || !isFailureScreenshotForUpload(details)) {
|
|
1527
1530
|
return
|
|
1528
1531
|
}
|
|
1529
1532
|
|
|
@@ -2092,6 +2095,16 @@ class CypressPlugin {
|
|
|
2092
2095
|
if (!this.skippedTestIds.has(skippedTestId)) {
|
|
2093
2096
|
this.skippedTestIds.add(skippedTestId)
|
|
2094
2097
|
this.skippedTests.push(test)
|
|
2098
|
+
const testSuiteSpan = this.#pendingTestSuiteSpans.get(testSuite)
|
|
2099
|
+
if (this.isItrEnabled && testSuiteSpan) {
|
|
2100
|
+
try {
|
|
2101
|
+
const count = testSuiteSpan.context().getTag(TEST_ITR_SKIPPING_COUNT) || 0
|
|
2102
|
+
testSuiteSpan.setTag(TEST_ITR_SKIPPING_COUNT, count + 1)
|
|
2103
|
+
testSuiteSpan.setTag(TEST_ITR_TESTS_SKIPPED, 'true')
|
|
2104
|
+
} catch (error) {
|
|
2105
|
+
log.error('Could not report Test Impact Analysis skips for suite %s: %s', testSuite, error)
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2095
2108
|
}
|
|
2096
2109
|
this.isTestsSkipped = true
|
|
2097
2110
|
return { shouldSkip: true }
|
|
@@ -53,12 +53,12 @@ class CypressPlugin extends Plugin {
|
|
|
53
53
|
// downstream steps — then run the plugin's afterScreenshot on those
|
|
54
54
|
// details and propagate the value back to Cypress. The user handler runs
|
|
55
55
|
// regardless of whether screenshot upload is enabled.
|
|
56
|
-
const registerAfterScreenshot = (
|
|
56
|
+
const registerAfterScreenshot = () => {
|
|
57
57
|
const filteredUserAfterScreenshotHandlers = userAfterScreenshotHandlers.filter(
|
|
58
|
-
handler => handler !==
|
|
58
|
+
handler => handler !== datadogAfterScreenshotHandler
|
|
59
59
|
)
|
|
60
60
|
if (filteredUserAfterScreenshotHandlers.length === 0) {
|
|
61
|
-
if (
|
|
61
|
+
if (datadogAfterScreenshotHandler) on('after:screenshot', datadogAfterScreenshotHandler)
|
|
62
62
|
return
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -73,7 +73,7 @@ class CypressPlugin extends Plugin {
|
|
|
73
73
|
Promise.resolve(details)
|
|
74
74
|
)
|
|
75
75
|
return chain.then((finalDetails) => {
|
|
76
|
-
if (
|
|
76
|
+
if (datadogAfterScreenshotHandler) datadogAfterScreenshotHandler(finalDetails)
|
|
77
77
|
return finalDetails
|
|
78
78
|
})
|
|
79
79
|
})
|
|
@@ -90,14 +90,14 @@ class CypressPlugin extends Plugin {
|
|
|
90
90
|
Promise.resolve()
|
|
91
91
|
))
|
|
92
92
|
}
|
|
93
|
-
registerAfterScreenshot(
|
|
93
|
+
registerAfterScreenshot()
|
|
94
94
|
registerAfterRunWithCleanup()
|
|
95
95
|
payload.registered = true
|
|
96
96
|
return
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
registerBeforeRun(cypressPlugin.beforeRun.bind(cypressPlugin))
|
|
100
|
-
registerAfterScreenshot(
|
|
100
|
+
registerAfterScreenshot()
|
|
101
101
|
|
|
102
102
|
on('after:spec', (spec, results) => {
|
|
103
103
|
const chain = userAfterSpecHandlers.reduce(
|
|
@@ -26,8 +26,7 @@ function isJavaScriptFile (absoluteFilePath) {
|
|
|
26
26
|
* @param {number} testSourceLine
|
|
27
27
|
*/
|
|
28
28
|
function shouldTrustInvocationDetailsLine (absoluteFilePath, testSourceLine) {
|
|
29
|
-
if (!Number.isInteger(testSourceLine) || testSourceLine < 1) return false
|
|
30
|
-
if (!isJavaScriptFile(absoluteFilePath)) return false
|
|
29
|
+
if (!Number.isInteger(testSourceLine) || testSourceLine < 1 || !isJavaScriptFile(absoluteFilePath)) return false
|
|
31
30
|
|
|
32
31
|
return getCachedSourceMap(absoluteFilePath) === null
|
|
33
32
|
}
|
|
@@ -52,10 +52,7 @@ Cypress.on('command:end', (command) => {
|
|
|
52
52
|
if (name === 'task' && args && typeof args[0] === 'string' && args[0].startsWith('dd:')) {
|
|
53
53
|
return
|
|
54
54
|
}
|
|
55
|
-
if (INTERNAL_CYPRESS_COMMANDS.has(name)) {
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
if (entry == null) {
|
|
55
|
+
if (INTERNAL_CYPRESS_COMMANDS.has(name) || entry == null) {
|
|
59
56
|
return
|
|
60
57
|
}
|
|
61
58
|
const err = command.get('err')
|
|
@@ -26,8 +26,7 @@ class ExpressCodeOriginForSpansPlugin extends Plugin {
|
|
|
26
26
|
|
|
27
27
|
// Route added handling: compute and cache tags
|
|
28
28
|
const handleRouteAdded = ({ topOfStackFunc, layer }) => {
|
|
29
|
-
if (!layer) return
|
|
30
|
-
if (layerTags.has(layer)) return
|
|
29
|
+
if (!layer || layerTags.has(layer)) return
|
|
31
30
|
layerTags.set(layer, entryTags(topOfStackFunc))
|
|
32
31
|
}
|
|
33
32
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { getHeadersSize, getSizeOrZero } = require('../../dd-trace/src/datastreams')
|
|
4
4
|
const ConsumerPlugin = require('../../dd-trace/src/plugins/consumer')
|
|
5
5
|
const { storage } = require('../../datadog-core')
|
|
6
6
|
const reconstructPubSubRequestContext = require('./pubsub-request-context')
|
|
@@ -82,7 +82,7 @@ class GoogleCloudPubsubConsumerPlugin extends ConsumerPlugin {
|
|
|
82
82
|
const { span } = ctx.currentStore
|
|
83
83
|
const subscription = message._subscriber._subscription
|
|
84
84
|
const topic = subscription?.metadata?.topic || message.attributes?.['pubsub.topic']
|
|
85
|
-
const payloadSize =
|
|
85
|
+
const payloadSize = getSizeOrZero(message.data) + getHeadersSize(message.attributes)
|
|
86
86
|
this.tracer.decodeDataStreamsContext(message.attributes)
|
|
87
87
|
this.tracer
|
|
88
88
|
.setCheckpoint(['direction:in', `topic:${topic}`, 'type:google-pubsub'], span, payloadSize)
|
|
@@ -46,8 +46,7 @@ class GoogleCloudPubsubProducerPlugin extends ProducerPlugin {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
start (ctx) {
|
|
49
|
-
if (!this.config.dsmEnabled) return
|
|
50
|
-
if (ctx.api !== 'publish' || !ctx.currentStore) return
|
|
49
|
+
if (!this.config.dsmEnabled || ctx.api !== 'publish' || !ctx.currentStore) return
|
|
51
50
|
const { request } = ctx
|
|
52
51
|
const messages = request.messages || []
|
|
53
52
|
const topic = request.topic
|
|
@@ -78,8 +78,8 @@ if (asyncDisposeSymbol === undefined) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
class AbortError extends Error {
|
|
81
|
-
constructor (
|
|
82
|
-
super(
|
|
81
|
+
constructor () {
|
|
82
|
+
super('Aborted')
|
|
83
83
|
this.name = 'AbortError'
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -599,7 +599,7 @@ function wrapResolve (resolve, isJit = false) {
|
|
|
599
599
|
}
|
|
600
600
|
|
|
601
601
|
if (rootCtx.abortController?.signal.aborted) {
|
|
602
|
-
throw new AbortError(
|
|
602
|
+
throw new AbortError()
|
|
603
603
|
}
|
|
604
604
|
|
|
605
605
|
if (!traceResolver) {
|
|
@@ -736,7 +736,7 @@ function resolveCompiledJitField (rootCtx, descriptorId, resolve, self, source,
|
|
|
736
736
|
}
|
|
737
737
|
|
|
738
738
|
if (rootCtx.abortController?.signal.aborted) {
|
|
739
|
-
throw new AbortError(
|
|
739
|
+
throw new AbortError()
|
|
740
740
|
}
|
|
741
741
|
|
|
742
742
|
const depth = config.countListIndices ? descriptor.pathDepth : descriptor.selectionDepth
|
|
@@ -930,7 +930,7 @@ function resolveJitDefaultInvocation (rootCtx, descriptorId, source, path, argum
|
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
if (rootCtx.abortController?.signal.aborted) {
|
|
933
|
-
throw new AbortError(
|
|
933
|
+
throw new AbortError()
|
|
934
934
|
}
|
|
935
935
|
|
|
936
936
|
const depth = rootCtx.config.countListIndices ? descriptor.pathDepth : descriptor.selectionDepth
|
|
@@ -71,9 +71,8 @@ module.exports = {
|
|
|
71
71
|
},
|
|
72
72
|
|
|
73
73
|
addMetadataTags (span, metadata, filter, type) {
|
|
74
|
-
if (!metadata || typeof metadata.getMap !== 'function') return
|
|
75
74
|
// Default no-op filter: skip the full metadata clone via `getMap()`.
|
|
76
|
-
if (filter === getEmptyObject) return
|
|
75
|
+
if (!metadata || typeof metadata.getMap !== 'function' || filter === getEmptyObject) return
|
|
77
76
|
|
|
78
77
|
const values = filter(metadata.getMap())
|
|
79
78
|
|
|
@@ -63,8 +63,7 @@ class KafkajsProducerPlugin extends ProducerPlugin {
|
|
|
63
63
|
const commitList = ctx.result
|
|
64
64
|
const clusterId = ctx.clusterId
|
|
65
65
|
|
|
66
|
-
if (!this.config.dsmEnabled) return
|
|
67
|
-
if (!commitList || !Array.isArray(commitList)) return
|
|
66
|
+
if (!this.config.dsmEnabled || !commitList || !Array.isArray(commitList)) return
|
|
68
67
|
for (const rawCommit of commitList) {
|
|
69
68
|
const commit = this.transformProduceResponse(rawCommit, clusterId)
|
|
70
69
|
this.tracer.setOffset(commit)
|