dd-trace 6.24.0 → 6.26.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/README.md +3 -0
- package/ci/cypress/support.js +2 -1
- package/ci/init.js +2 -22
- package/ci/vitest-no-worker-init-node-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-runner-setup.mjs +2 -1
- package/ci/vitest-no-worker-init-setup.mjs +729 -724
- package/ci/vitest-no-worker-init-v5-setup.mjs +2 -1
- package/ext/exporters.js +0 -1
- package/index.d.ts +105 -5
- package/initialize.mjs +5 -2
- package/package.json +41 -36
- package/packages/datadog-esbuild/index.js +16 -70
- package/packages/datadog-esbuild/src/log.js +2 -29
- package/packages/datadog-instrumentations/src/ai.js +6 -1
- package/packages/datadog-instrumentations/src/aws-lambda.js +88 -0
- package/packages/datadog-instrumentations/src/cucumber.js +5 -2
- package/packages/datadog-instrumentations/src/cypress-config.js +20 -9
- package/packages/datadog-instrumentations/src/elevenlabs/activity.js +114 -0
- package/packages/datadog-instrumentations/src/elevenlabs/audio.js +104 -0
- package/packages/datadog-instrumentations/src/elevenlabs/index.js +288 -0
- package/packages/datadog-instrumentations/src/elevenlabs/session.js +444 -0
- package/packages/datadog-instrumentations/src/graphql.js +20 -17
- package/packages/datadog-instrumentations/src/helpers/bundler-esm-exports.js +582 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-log.js +38 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-transform.js +576 -0
- package/packages/datadog-instrumentations/src/helpers/bundler-utils.js +104 -0
- package/packages/datadog-instrumentations/src/helpers/fetch.js +51 -6
- package/packages/datadog-instrumentations/src/helpers/hook.js +29 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +3 -7
- package/packages/datadog-instrumentations/src/helpers/lambda-handler.js +189 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +8 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentation-registry.js +26 -1
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js +41 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/elevenlabs.js +25 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +0 -36
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-client.js +30 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-server.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/next.js +61 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/openai-agents-realtime.js +23 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/postgres.js +33 -4
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/trpc.js +148 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/target-patterns.json +80 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/targets.json +23 -3
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms/postgres.js +122 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +59 -2
- package/packages/datadog-instrumentations/src/ioredis.js +101 -3
- package/packages/datadog-instrumentations/src/microgateway-core.js +1 -2
- package/packages/datadog-instrumentations/src/modelcontextprotocol-client.js +21 -0
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +7 -1
- package/packages/datadog-instrumentations/src/modelcontextprotocol-server.js +41 -0
- package/packages/datadog-instrumentations/src/next.js +203 -26
- package/packages/datadog-instrumentations/src/openai-agents-realtime.js +149 -0
- package/packages/datadog-instrumentations/src/openai-realtime/audio-accumulator.js +27 -0
- package/packages/datadog-instrumentations/src/openai-realtime/index.js +17 -6
- package/packages/datadog-instrumentations/src/openai-realtime/server-playback.js +887 -0
- package/packages/datadog-instrumentations/src/openai-realtime/session.js +150 -25
- package/packages/datadog-instrumentations/src/openai-realtime/turns.js +29 -2
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +11 -9
- package/packages/datadog-instrumentations/src/router.js +35 -12
- package/packages/datadog-instrumentations/src/vitest-main.js +10 -2
- package/packages/datadog-instrumentations/src/webdriverio.js +12 -12
- package/packages/datadog-plugin-async-mutex/src/index.js +50 -0
- package/packages/datadog-plugin-aws-lambda/src/arn.js +41 -0
- package/packages/datadog-plugin-aws-lambda/src/event-type-guards.js +170 -0
- package/packages/datadog-plugin-aws-lambda/src/index.js +106 -0
- package/packages/datadog-plugin-aws-lambda/src/trigger.js +339 -0
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +7 -0
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +32 -10
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +10 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +4 -0
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +3 -0
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +50 -13
- package/packages/datadog-plugin-cypress/src/support.mjs +1353 -0
- package/packages/datadog-plugin-elevenlabs/src/index.js +69 -0
- package/packages/datadog-plugin-express/src/code_origin.js +2 -2
- package/packages/datadog-plugin-fastify/src/code_origin.js +2 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +20 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +21 -52
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +11 -2
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-request-context.js +25 -4
- package/packages/datadog-plugin-google-cloud-pubsub/src/resource-names.js +24 -0
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +1 -0
- package/packages/datadog-plugin-http/src/client.js +34 -10
- package/packages/datadog-plugin-http2/src/client.js +40 -14
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +28 -2
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +1 -0
- package/packages/datadog-plugin-mongodb-core/src/query.js +17 -1
- package/packages/datadog-plugin-next/src/index.js +112 -14
- package/packages/datadog-plugin-postgres/src/index.js +118 -41
- package/packages/datadog-plugin-prisma/src/datadog-tracing-helper.js +5 -3
- package/packages/datadog-plugin-supabase/src/supabase-auth-js-gotrueclient-getuser.js +18 -8
- package/packages/datadog-plugin-supabase/src/supabase-functions-js-functionsclient-invoke.js +49 -13
- package/packages/datadog-plugin-supabase/src/supabase-storage-js-handle-request.js +34 -9
- package/packages/datadog-plugin-trpc/src/index.js +15 -0
- package/packages/datadog-plugin-trpc/src/procedure.js +48 -0
- package/packages/datadog-plugin-trpc/src/request.js +81 -0
- package/packages/datadog-plugin-undici/src/index.js +22 -7
- package/packages/datadog-plugin-vitest/src/index.js +3 -2
- package/packages/datadog-plugin-ws/src/close.js +3 -5
- package/packages/datadog-plugin-ws/src/producer.js +1 -4
- package/packages/datadog-plugin-ws/src/receiver.js +3 -5
- package/packages/datadog-plugin-ws/src/server.js +44 -13
- package/packages/datadog-turbopack/index.js +4 -28
- package/packages/datadog-turbopack/src/loader.js +14 -452
- package/packages/datadog-vite/index.js +537 -0
- package/packages/datadog-vite/src/log.js +5 -0
- package/packages/datadog-webpack/index.js +3 -55
- package/packages/datadog-webpack/src/log.js +2 -29
- package/packages/dd-trace/src/aiguard/evaluation.js +62 -1
- package/packages/dd-trace/src/aiguard/index.js +1 -1
- package/packages/dd-trace/src/aiguard/integrations/index.js +6 -5
- package/packages/dd-trace/src/aiguard/sdk.js +8 -2
- package/packages/dd-trace/src/aiguard/tags.js +2 -0
- package/packages/dd-trace/src/appsec/blocking/index.js +21 -1
- package/packages/dd-trace/src/appsec/channels.js +7 -0
- package/packages/dd-trace/src/appsec/downstream_requests.js +105 -0
- package/packages/dd-trace/src/appsec/graphql.js +89 -7
- package/packages/dd-trace/src/appsec/handlers/auth.js +1 -3
- package/packages/dd-trace/src/appsec/handlers/http-request.js +60 -65
- package/packages/dd-trace/src/appsec/handlers/http-response.js +61 -7
- package/packages/dd-trace/src/appsec/handlers/payments.js +23 -27
- package/packages/dd-trace/src/appsec/index.js +6 -0
- package/packages/dd-trace/src/appsec/lambda.js +17 -17
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -4
- package/packages/dd-trace/src/appsec/rasp/index.js +8 -1
- package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -2
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +7 -17
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +80 -16
- package/packages/dd-trace/src/appsec/rasp/utils.js +33 -3
- package/packages/dd-trace/src/appsec/recommended.json +1358 -94
- package/packages/dd-trace/src/appsec/reporter.js +9 -0
- package/packages/dd-trace/src/appsec/sdk/set_user.js +3 -3
- package/packages/dd-trace/src/appsec/sdk/track_event.js +4 -4
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +1 -1
- package/packages/dd-trace/src/appsec/user_tracking.js +6 -8
- package/packages/dd-trace/src/appsec/waf/index.js +65 -6
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +33 -38
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +18 -2
- package/packages/dd-trace/src/before-exit.js +32 -0
- package/packages/dd-trace/src/bootstrap.js +5 -3
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +15 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +12 -34
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +41 -13
- package/packages/dd-trace/src/ci-visibility/exporters/request.js +2 -3
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +1 -2
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +1 -1
- package/packages/dd-trace/src/ci-visibility/telemetry.js +6 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +1 -1
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +9 -134
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +11 -156
- package/packages/dd-trace/src/config/config-types.d.ts +3 -0
- package/packages/dd-trace/src/config/defaults.js +5 -0
- package/packages/dd-trace/src/config/generated-config-types.d.ts +46 -4
- package/packages/dd-trace/src/config/index.js +63 -31
- package/packages/dd-trace/src/config/parsers.js +44 -0
- package/packages/dd-trace/src/config/remote-config-layers.js +38 -0
- package/packages/dd-trace/src/config/remote_config.js +2 -1
- package/packages/dd-trace/src/config/supported-configurations.json +172 -10
- package/packages/dd-trace/src/constants.js +1 -0
- package/packages/dd-trace/src/datastreams/fnv.js +27 -0
- package/packages/dd-trace/src/datastreams/pathway.js +113 -28
- package/packages/dd-trace/src/datastreams/processor.js +5 -4
- package/packages/dd-trace/src/debugger/config.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/request-options.js +7 -9
- package/packages/dd-trace/src/debugger/devtools_client/send.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
- package/packages/dd-trace/src/debugger/devtools_client/tags.js +1 -1
- package/packages/dd-trace/src/debugger/index.js +2 -2
- package/packages/dd-trace/src/debugger/inspect-segment.js +3 -2
- package/packages/dd-trace/src/debugger/pause-duration-histogram.js +6 -2
- package/packages/dd-trace/src/debugger/probe_sampler.js +39 -17
- package/packages/dd-trace/src/debugger/unsupported-runtime.js +2 -0
- package/packages/dd-trace/src/exporter.js +0 -11
- package/packages/dd-trace/src/exporters/common/request.js +81 -48
- package/packages/dd-trace/src/exporters/common/retry.js +12 -7
- package/packages/dd-trace/src/exporters/common/url.js +1 -1
- package/packages/dd-trace/src/git_metadata.js +2 -1
- package/packages/dd-trace/src/id.js +1 -1
- package/packages/dd-trace/src/index.js +6 -3
- package/packages/dd-trace/src/lambda/facade.js +75 -0
- package/packages/dd-trace/src/lambda/handler.js +3 -41
- package/packages/dd-trace/src/lambda/index.js +38 -15
- package/packages/dd-trace/src/lambda/runtime/patch.js +19 -3
- package/packages/dd-trace/src/lambda/wrap.js +44 -0
- package/packages/dd-trace/src/llmobs/constants/tags.js +2 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +10 -5
- package/packages/dd-trace/src/llmobs/plugins/elevenlabs.js +96 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +19 -6
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +54 -3
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +81 -1
- package/packages/dd-trace/src/llmobs/plugins/openai/realtime.js +38 -11
- package/packages/dd-trace/src/llmobs/plugins/vertexai.js +10 -2
- package/packages/dd-trace/src/llmobs/sdk.js +19 -0
- package/packages/dd-trace/src/llmobs/span_processor.js +9 -0
- package/packages/dd-trace/src/llmobs/tagger.js +22 -0
- package/packages/dd-trace/src/log/channels.js +4 -0
- package/packages/dd-trace/src/log/writer.js +6 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +7 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +55 -27
- package/packages/dd-trace/src/openfeature/flag-selection.js +152 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +19 -1
- package/packages/dd-trace/src/openfeature/writers/base.js +1 -3
- package/packages/dd-trace/src/opentelemetry/logs/index.js +11 -0
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +7 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +4 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +19 -1
- package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +5 -1
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +6 -1
- package/packages/dd-trace/src/opentelemetry/span.js +2 -2
- package/packages/dd-trace/src/opentelemetry/startup-config.js +174 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +1 -1
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +7 -1
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +77 -23
- package/packages/dd-trace/src/opentracing/tracer.js +24 -0
- package/packages/dd-trace/src/otel-thread-ctx.js +28 -31
- package/packages/dd-trace/src/plugin_manager.js +34 -7
- package/packages/dd-trace/src/plugins/ci_plugin.js +143 -17
- package/packages/dd-trace/src/plugins/index.js +8 -0
- package/packages/dd-trace/src/plugins/plugin.js +4 -2
- package/packages/dd-trace/src/plugins/tracing.js +1 -1
- package/packages/dd-trace/src/plugins/util/ci.js +52 -1
- package/packages/dd-trace/src/plugins/util/git-cache.js +4 -4
- package/packages/dd-trace/src/plugins/util/git.js +263 -82
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +80 -56
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +12 -4
- package/packages/dd-trace/src/plugins/util/status-validator.js +23 -10
- package/packages/dd-trace/src/plugins/util/tags.js +6 -0
- package/packages/dd-trace/src/plugins/util/test.js +92 -40
- package/packages/dd-trace/src/plugins/util/url.js +18 -7
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +6 -6
- package/packages/dd-trace/src/plugins/util/web.js +65 -10
- package/packages/dd-trace/src/process-tags/index.js +1 -1
- package/packages/dd-trace/src/profiler.js +74 -12
- package/packages/dd-trace/src/profiling/profiler.js +30 -2
- package/packages/dd-trace/src/profiling/profilers/space.js +3 -1
- package/packages/dd-trace/src/profiling/profilers/wall.js +4 -4
- package/packages/dd-trace/src/profiling/remote-config.js +354 -0
- package/packages/dd-trace/src/profiling/runtime-capabilities.js +11 -0
- package/packages/dd-trace/src/profiling/webspan-utils.js +6 -5
- package/packages/dd-trace/src/propagation-hash/index.js +7 -0
- package/packages/dd-trace/src/proxy.js +46 -54
- package/packages/dd-trace/src/span_processor.js +20 -0
- package/packages/dd-trace/src/startup-log.js +8 -6
- package/packages/dd-trace/src/telemetry/metrics.js +2 -1
- package/packages/dd-trace/src/tracer.js +0 -2
- package/packages/dd-trace/src/web-tags-cache.js +8 -9
- package/register.js +2 -1
- package/vendor/dist/@apm-js-collab/code-transformer/LICENSE +489 -0
- package/vendor/dist/@datadog/flagging-core/LICENSE +221 -0
- package/vendor/dist/@datadog/flagging-core/index.js +1 -0
- package/vendor/dist/@datadog/openfeature-node-server/LICENSE +21 -1
- package/vendor/dist/@datadog/openfeature-node-server/rules-based/LICENSE +3 -1
- package/vendor/dist/@datadog/sketches-js/LICENSE +263 -0
- package/vendor/dist/@datadog/source-map/LICENSE +1 -0
- package/vendor/dist/@isaacs/ttlcache/LICENSE +13 -0
- package/vendor/dist/@opentelemetry/core/LICENSE +220 -1
- package/vendor/dist/@opentelemetry/core/index.js +1 -1
- package/vendor/dist/crypto-randomuuid/LICENSE +3 -0
- package/vendor/dist/escape-string-regexp/LICENSE +13 -0
- package/vendor/dist/esquery/LICENSE +2 -0
- package/vendor/dist/https-proxy-agent/LICENSE +80 -1
- package/vendor/dist/istanbul-lib-coverage/LICENSE +2 -0
- package/vendor/dist/jest-docblock/LICENSE +16 -0
- package/vendor/dist/jsonpath-plus/LICENSE +13 -0
- package/vendor/dist/limiter/LICENSE +2 -0
- package/vendor/dist/lodash.sortby/LICENSE +2 -0
- package/vendor/dist/lru-cache/LICENSE +13 -0
- package/vendor/dist/meriyah/LICENSE +13 -0
- package/vendor/dist/module-details-from-path/LICENSE +2 -0
- package/vendor/dist/mutexify/promise/LICENSE +28 -0
- package/vendor/dist/pprof-format/LICENSE +13 -0
- package/vendor/dist/pprof-format/index.js +1 -1
- package/vendor/dist/protobufjs/LICENSE +219 -0
- package/vendor/dist/protobufjs/minimal/LICENSE +219 -0
- package/vendor/dist/proxy-from-env/LICENSE +13 -0
- package/vendor/dist/retry/LICENSE +2 -0
- package/vendor/dist/rfdc/LICENSE +2 -0
- package/vendor/dist/semifies/LICENSE +3 -1
- package/vendor/dist/shell-quote/LICENSE +3 -1
- package/vendor/dist/source-map/LICENSE +1 -0
- package/vendor/dist/source-map/lib/util/LICENSE +1 -0
- package/vendor/dist/tlhunter-sorted-set/LICENSE +2 -0
- package/vendor/dist/ttl-set/LICENSE +28 -0
- package/vite.d.ts +7 -0
- package/vite.js +3 -0
- package/ci/diagnose.js +0 -2215
- package/ci/runbook.md +0 -299
- package/ci/test-optimization-validation/approval-artifacts.js +0 -175
- package/ci/test-optimization-validation/approval.js +0 -386
- package/ci/test-optimization-validation/artifact-id.js +0 -18
- package/ci/test-optimization-validation/blocker-category.js +0 -24
- package/ci/test-optimization-validation/bounded-json.js +0 -120
- package/ci/test-optimization-validation/ci-command-candidate.js +0 -77
- package/ci/test-optimization-validation/ci-discovery.js +0 -192
- package/ci/test-optimization-validation/ci-package-scripts.js +0 -169
- package/ci/test-optimization-validation/ci-remediation.js +0 -283
- package/ci/test-optimization-validation/cli.js +0 -954
- package/ci/test-optimization-validation/command-blocker.js +0 -377
- package/ci/test-optimization-validation/command-output-policy.js +0 -188
- package/ci/test-optimization-validation/command-runner.js +0 -649
- package/ci/test-optimization-validation/environment.js +0 -88
- package/ci/test-optimization-validation/executable-approval.js +0 -47
- package/ci/test-optimization-validation/executable.js +0 -244
- package/ci/test-optimization-validation/execution-lock.js +0 -70
- package/ci/test-optimization-validation/framework-adapters/cucumber-validation.json +0 -3
- package/ci/test-optimization-validation/framework-adapters/cucumber.js +0 -767
- package/ci/test-optimization-validation/framework-adapters/cypress.js +0 -99
- package/ci/test-optimization-validation/framework-adapters/playwright.js +0 -175
- package/ci/test-optimization-validation/framework-adapters/vitest.js +0 -513
- package/ci/test-optimization-validation/generated-file-policy.js +0 -63
- package/ci/test-optimization-validation/generated-files.js +0 -425
- package/ci/test-optimization-validation/generated-test-contract.js +0 -284
- package/ci/test-optimization-validation/generated-verifier.js +0 -235
- package/ci/test-optimization-validation/literal-environment.js +0 -56
- package/ci/test-optimization-validation/literal-glob.js +0 -52
- package/ci/test-optimization-validation/manifest-loader.js +0 -116
- package/ci/test-optimization-validation/manifest-scaffold.js +0 -1276
- package/ci/test-optimization-validation/manifest-schema.js +0 -695
- package/ci/test-optimization-validation/offline-fixtures.js +0 -335
- package/ci/test-optimization-validation/offline-output.js +0 -406
- package/ci/test-optimization-validation/package-check.js +0 -97
- package/ci/test-optimization-validation/payload-normalizer.js +0 -72
- package/ci/test-optimization-validation/plan-writer.js +0 -541
- package/ci/test-optimization-validation/preflight-runner.js +0 -186
- package/ci/test-optimization-validation/project-build-artifact.js +0 -31
- package/ci/test-optimization-validation/redaction.js +0 -319
- package/ci/test-optimization-validation/report-writer.js +0 -666
- package/ci/test-optimization-validation/result-semantics.js +0 -103
- package/ci/test-optimization-validation/runner-command.js +0 -264
- package/ci/test-optimization-validation/runner-contract.js +0 -695
- package/ci/test-optimization-validation/safe-files.js +0 -202
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +0 -171
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +0 -407
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +0 -666
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +0 -142
- package/ci/test-optimization-validation/scenarios/helpers.js +0 -621
- package/ci/test-optimization-validation/scenarios/test-management.js +0 -219
- package/ci/test-optimization-validation/source-text.js +0 -84
- package/ci/test-optimization-validation/static-diagnosis.js +0 -166
- package/ci/test-optimization-validation/test-output.js +0 -120
- package/ci/test-optimization-validation/validation-blocker.js +0 -21
- package/ci/validate-test-optimization.js +0 -3
- package/packages/datadog-esbuild/src/resolver.js +0 -284
- package/packages/datadog-esbuild/src/utils.js +0 -318
- package/packages/datadog-plugin-cypress/src/support.js +0 -1348
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +0 -156
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +0 -287
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +0 -84
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +0 -368
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +0 -59
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
function noop () {}
|
|
4
|
+
|
|
3
5
|
exports.createWrapFetch = function createWrapFetch (Request, ch, onLoad) {
|
|
6
|
+
/**
|
|
7
|
+
* Rejects an aborted request with the abort reason, once the body it would send is cancelled.
|
|
8
|
+
* @param {Request} req request to send.
|
|
9
|
+
* @param {import('undici-types').RequestInit | undefined} init options that fetch applies over `req`.
|
|
10
|
+
* @param {unknown} reason abort reason.
|
|
11
|
+
* @returns {Promise<never>}
|
|
12
|
+
*/
|
|
13
|
+
function rejectAborted (req, init, reason) {
|
|
14
|
+
try {
|
|
15
|
+
// The request is built only to find the body to cancel.
|
|
16
|
+
const request = init === undefined ? req : new Request(req, init)
|
|
17
|
+
request.body?.cancel(reason).catch(noop)
|
|
18
|
+
} catch {
|
|
19
|
+
// The abort takes precedence over argument errors that fetch would raise, as in the other instrumentations
|
|
20
|
+
// that can abort: the request is not attempted.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return Promise.reject(reason)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {Function} fetch fetch implementation to call.
|
|
28
|
+
* @param {unknown} thisArg receiver of the fetch call.
|
|
29
|
+
* @param {Request} req request to send, published to subscribers.
|
|
30
|
+
* @param {import('undici-types').RequestInit | undefined} init options that fetch applies over `req`.
|
|
31
|
+
* @param {import('undici-types').RequestInit | undefined} options second argument of the fetch call.
|
|
32
|
+
*/
|
|
33
|
+
function traceFetch (fetch, thisArg, req, init, options) {
|
|
34
|
+
const abortController = new AbortController()
|
|
35
|
+
|
|
36
|
+
return ch.tracePromise(() => {
|
|
37
|
+
const { signal } = abortController
|
|
38
|
+
if (signal.aborted) return rejectAborted(req, init, signal.reason)
|
|
39
|
+
|
|
40
|
+
return fetch.call(thisArg, req, options)
|
|
41
|
+
}, { req, init, abortController })
|
|
42
|
+
}
|
|
43
|
+
|
|
4
44
|
return function wrapFetch (fetch) {
|
|
5
45
|
if (typeof fetch !== 'function') return fetch
|
|
6
46
|
|
|
@@ -13,18 +53,23 @@ exports.createWrapFetch = function createWrapFetch (Request, ch, onLoad) {
|
|
|
13
53
|
if (!ch.start.hasSubscribers) return fetch.apply(this, arguments)
|
|
14
54
|
|
|
15
55
|
if (input instanceof Request) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
56
|
+
// `init` is left for fetch to read once: it can hold one-shot values such as iterators and streams. It can
|
|
57
|
+
// override the method, headers and body of `input`, but not its URL.
|
|
58
|
+
return traceFetch(fetch, this, input, init, init)
|
|
59
|
+
}
|
|
60
|
+
let req
|
|
61
|
+
try {
|
|
62
|
+
req = new Request(input, init)
|
|
63
|
+
} catch (error) {
|
|
64
|
+
// fetch rejects the arguments it can't build a request from, rather than throwing them synchronously
|
|
65
|
+
return Promise.reject(error)
|
|
19
66
|
}
|
|
20
|
-
const req = new Request(input, init)
|
|
21
|
-
const ctx = { req }
|
|
22
67
|
const signal = init?.signal
|
|
23
68
|
|
|
24
69
|
// The signal of `req` only weakly follows `init.signal` and is collected once `req` is unreachable, which
|
|
25
70
|
// stops aborts from reaching the in-flight request. Passing it again lets `fetch` follow it directly.
|
|
26
71
|
const options = signal ? { signal, referrer: req.referrer, referrerPolicy: req.referrerPolicy } : undefined
|
|
27
|
-
return
|
|
72
|
+
return traceFetch(fetch, this, req, undefined, options)
|
|
28
73
|
}
|
|
29
74
|
}
|
|
30
75
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { setTimeout } = require('node:timers')
|
|
3
4
|
const path = require('path')
|
|
4
5
|
|
|
5
6
|
const iitm = require('../../../dd-trace/src/iitm')
|
|
@@ -8,6 +9,8 @@ const log = require('../../../dd-trace/src/log')
|
|
|
8
9
|
const requirePackageJson = require('../../../dd-trace/src/require-package-json')
|
|
9
10
|
const { isNodeBuiltinModuleName } = require('./shared-utils')
|
|
10
11
|
|
|
12
|
+
const VERSION_CACHE_IDLE_TIMEOUT_MS = 1000
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* @param {string} moduleBaseDir
|
|
13
16
|
* @returns {string|undefined}
|
|
@@ -49,6 +52,10 @@ function Hook (modules, hookOptions, onrequire) {
|
|
|
49
52
|
|
|
50
53
|
this._patched = Object.create(null)
|
|
51
54
|
const patched = new WeakMap()
|
|
55
|
+
/** @type {Map<string|undefined, string|undefined>|undefined} */
|
|
56
|
+
let versions
|
|
57
|
+
/** @type {ReturnType<typeof setTimeout>|undefined} */
|
|
58
|
+
let clearVersionsTimer
|
|
52
59
|
|
|
53
60
|
/**
|
|
54
61
|
* @param {object|Function|undefined} moduleExports
|
|
@@ -80,7 +87,28 @@ function Hook (modules, hookOptions, onrequire) {
|
|
|
80
87
|
}
|
|
81
88
|
|
|
82
89
|
try {
|
|
83
|
-
|
|
90
|
+
if (!moduleVersion) {
|
|
91
|
+
moduleVersion = versions?.get(moduleBaseDir)
|
|
92
|
+
if (!moduleVersion) {
|
|
93
|
+
moduleVersion = getVersion(moduleBaseDir)
|
|
94
|
+
if (moduleBaseDir) {
|
|
95
|
+
versions ??= new Map()
|
|
96
|
+
versions.set(moduleBaseDir, moduleVersion)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (versions) {
|
|
100
|
+
if (clearVersionsTimer) {
|
|
101
|
+
clearVersionsTimer.refresh()
|
|
102
|
+
} else {
|
|
103
|
+
const cache = versions
|
|
104
|
+
clearVersionsTimer = setTimeout(() => {
|
|
105
|
+
cache.clear()
|
|
106
|
+
clearVersionsTimer = undefined
|
|
107
|
+
}, VERSION_CACHE_IDLE_TIMEOUT_MS)
|
|
108
|
+
clearVersionsTimer.unref?.()
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
84
112
|
} catch (error) {
|
|
85
113
|
log.error('Error getting version for "%s": %s', moduleName, error.message, error)
|
|
86
114
|
return moduleExports
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
+
'@elevenlabs/elevenlabs-js': () => require('../elevenlabs'),
|
|
4
5
|
// Only list unprefixed node modules. They will automatically be instrumented as prefixed and unprefixed.
|
|
5
6
|
child_process: () => require('../child_process'),
|
|
6
7
|
crypto: () => require('../crypto'),
|
|
@@ -48,7 +49,7 @@ module.exports = {
|
|
|
48
49
|
'@koa/router': () => require('../koa'),
|
|
49
50
|
'@node-redis/client': () => require('../redis'),
|
|
50
51
|
'@opensearch-project/opensearch': () => require('../opensearch'),
|
|
51
|
-
'@opentelemetry/sdk-trace': () => require('../otel-sdk-trace'),
|
|
52
|
+
'@opentelemetry/sdk-trace': { esmFirst: true, fn: () => require('../otel-sdk-trace') },
|
|
52
53
|
'@opentelemetry/sdk-trace-node': () => require('../otel-sdk-trace'),
|
|
53
54
|
'@prisma/client': { esmFirst: true, fn: () => require('../prisma') },
|
|
54
55
|
'./runtime/library.js': () => require('../prisma'),
|
|
@@ -56,10 +57,6 @@ module.exports = {
|
|
|
56
57
|
'@smithy/core': () => require('../aws-sdk'),
|
|
57
58
|
'@smithy/smithy-client': () => require('../aws-sdk'),
|
|
58
59
|
'@vitest/runner': { esmFirst: true, fn: () => require('../vitest') },
|
|
59
|
-
'@wdio/cli': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
60
|
-
'@wdio/jasmine-framework': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
61
|
-
'@wdio/local-runner': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
62
|
-
'@wdio/utils': { esmFirst: true, fn: () => require('../webdriverio') },
|
|
63
60
|
aerospike: () => require('../aerospike'),
|
|
64
61
|
ai: () => require('../ai'),
|
|
65
62
|
amqp10: () => require('../amqp10'),
|
|
@@ -85,7 +82,7 @@ module.exports = {
|
|
|
85
82
|
fastify: () => require('../fastify'),
|
|
86
83
|
'find-my-way': () => require('../find-my-way'),
|
|
87
84
|
'generic-pool': () => require('../generic-pool'),
|
|
88
|
-
graphql: () => require('../graphql'),
|
|
85
|
+
graphql: { esmFirst: true, fn: () => require('../graphql') },
|
|
89
86
|
'graphql-jit': { esmFirst: true, fn: () => require('../graphql') },
|
|
90
87
|
grpc: () => require('../grpc'),
|
|
91
88
|
handlebars: () => require('../handlebars'),
|
|
@@ -154,7 +151,6 @@ module.exports = {
|
|
|
154
151
|
tinypool: { esmFirst: true, fn: () => require('../vitest') },
|
|
155
152
|
undici: () => require('../undici'),
|
|
156
153
|
vitest: { esmFirst: true, fn: () => require('../vitest') },
|
|
157
|
-
webdriverio: { esmFirst: true, fn: () => require('../webdriverio') },
|
|
158
154
|
when: () => require('../when'),
|
|
159
155
|
winston: () => require('../winston'),
|
|
160
156
|
workerpool: () => require('../mocha'),
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const { EventEmitter } = require('node:events')
|
|
4
|
+
const { types: { isProxy } } = require('node:util')
|
|
5
|
+
|
|
6
|
+
const HANDLER_STREAMING = Symbol.for('aws.lambda.runtime.handler.streaming')
|
|
7
|
+
const HANDLER_HIGHWATERMARK = Symbol.for('aws.lambda.runtime.handler.streaming.highWaterMark')
|
|
8
|
+
const STREAM_RESPONSE = 'response'
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* MIGRATION SCOPE (#10488): move the existing datadog-lambda-js completion policy as-is.
|
|
12
|
+
* Source: https://github.com/DataDog/datadog-lambda-js/blob/bb5266a00e72eba0edcfe8d73256fe70461547c4/src/utils/handler.ts
|
|
13
|
+
* Only TypeScript types, module syntax and repository formatting are changed in promisifiedHandler below.
|
|
14
|
+
*
|
|
15
|
+
* Known legacy corner cases intentionally left for separate behavior changes:
|
|
16
|
+
* - Callback intent is inferred from handler.length and the returned value. Rest/default parameters can
|
|
17
|
+
* hide callback intent; undefined and server/socket/emitter-like returns can leave completion pending.
|
|
18
|
+
* - Promise.race selects the adapter result, not AWS's native response timing. Callback/context methods
|
|
19
|
+
* are not forwarded to their originals or restored, and outer wrappers can observe that shared mutation.
|
|
20
|
+
* - A handler or then getter can throw synchronously, including after calling a completion method.
|
|
21
|
+
* A callback Promise abandoned by a synchronous return/throw can later reject without an observer.
|
|
22
|
+
* - Metadata, then and artifact detection read properties directly, so getters/Proxy traps can run.
|
|
23
|
+
* A null return can throw during these checks. These are the upstream checks, not a new type policy.
|
|
24
|
+
* - The adapter installs methods on the supplied context. Frozen/read-only contexts, replacement methods
|
|
25
|
+
* and freezing after installation retain the shim's existing behavior; there is no defensive context view.
|
|
26
|
+
* - Buffered calls use (event, context, syntheticCallback); streaming calls use (event, stream, context).
|
|
27
|
+
* Custom receivers, additional arguments and alternative buffered argument positions are not preserved.
|
|
28
|
+
*
|
|
29
|
+
* Record newly identified legacy completion concerns here rather than expanding this migration's policy.
|
|
30
|
+
* Fixes to those behaviors belong in a separate change. A difference introduced by this port is still a bug.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {Function} handler Customer Lambda handler.
|
|
35
|
+
* @returns {Function} Existing shim completion adapter.
|
|
36
|
+
*/
|
|
37
|
+
// Keep the upstream completion policy recognizable for this as-is migration.
|
|
38
|
+
/* eslint-disable unicorn/consistent-function-scoping, no-useless-assignment, unicorn/no-duplicate-if-branches */
|
|
39
|
+
/* eslint-disable sonarjs/prefer-immediate-return, unicorn/no-negated-condition */
|
|
40
|
+
function promisifiedHandler (handler) {
|
|
41
|
+
// Response Stream Lambda function.
|
|
42
|
+
if (handler[HANDLER_STREAMING] !== undefined && handler[HANDLER_STREAMING] === STREAM_RESPONSE) {
|
|
43
|
+
return (event, responseStream, context) => {
|
|
44
|
+
// This handler will always be a promise.
|
|
45
|
+
const promise = handler(event, responseStream, context)
|
|
46
|
+
return promise
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Buffered Lambda function.
|
|
50
|
+
return (event, context) => {
|
|
51
|
+
// Lambda functions in node complete in one of two possible ways.
|
|
52
|
+
// 1. By calling the "callback" function with a result.
|
|
53
|
+
// 2. Returning a value directly from the function using a promise.
|
|
54
|
+
let modifiedCallback = () => {}
|
|
55
|
+
let modifiedLegacyDoneCallback = () => {}
|
|
56
|
+
let modifiedLegacySucceedCallback = () => {}
|
|
57
|
+
let modifiedLegacyFailCallback = () => {}
|
|
58
|
+
const callbackProm = new Promise((resolve, reject) => {
|
|
59
|
+
modifiedCallback = (err, result) => {
|
|
60
|
+
if (err !== undefined && err !== null) {
|
|
61
|
+
reject(err)
|
|
62
|
+
} else {
|
|
63
|
+
resolve(result)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Legacy done callback finished immediately, and doesn't wait for pending
|
|
67
|
+
// event loop
|
|
68
|
+
modifiedLegacyDoneCallback = (err, result) => {
|
|
69
|
+
context.callbackWaitsForEmptyEventLoop = false
|
|
70
|
+
if (err !== undefined && err !== null) {
|
|
71
|
+
reject(err)
|
|
72
|
+
} else {
|
|
73
|
+
resolve(result)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
modifiedLegacySucceedCallback = (result) => {
|
|
77
|
+
context.callbackWaitsForEmptyEventLoop = false
|
|
78
|
+
resolve(result)
|
|
79
|
+
}
|
|
80
|
+
modifiedLegacyFailCallback = (err) => {
|
|
81
|
+
context.callbackWaitsForEmptyEventLoop = false
|
|
82
|
+
reject(err)
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
context.done = modifiedLegacyDoneCallback
|
|
86
|
+
context.succeed = modifiedLegacySucceedCallback
|
|
87
|
+
context.fail = modifiedLegacyFailCallback
|
|
88
|
+
const asyncProm = handler(event, context, modifiedCallback)
|
|
89
|
+
let promise = callbackProm
|
|
90
|
+
if (asyncProm !== undefined && typeof asyncProm.then === 'function') {
|
|
91
|
+
// Mimics behaviour of lambda runtime, the first method of returning a result always wins.
|
|
92
|
+
promise = Promise.race([callbackProm, asyncProm])
|
|
93
|
+
} else if (handler.length >= 3) {
|
|
94
|
+
// Handler takes a callback, wait for the callback to be called
|
|
95
|
+
promise = callbackProm
|
|
96
|
+
} else if (asyncProm === undefined) {
|
|
97
|
+
// Handler returned nothing (implicit `undefined`) and doesn't take a callback parameter.
|
|
98
|
+
// It must be relying on `context.succeed` / `context.done` / `context.fail` to signal
|
|
99
|
+
// completion (e.g. `aws-serverless-express`'s `proxy()` with the default
|
|
100
|
+
// `CONTEXT_SUCCEED` resolution mode, or any other fire-and-forget pattern that finishes
|
|
101
|
+
// asynchronously). Wait for callbackProm rather than resolving immediately, otherwise
|
|
102
|
+
// the wrapper would shortcut the function before its work finishes, which causes the
|
|
103
|
+
// Lambda runtime to return an empty response and freeze the worker before any pending
|
|
104
|
+
// stdout writes are flushed to CloudWatch.
|
|
105
|
+
promise = callbackProm
|
|
106
|
+
} else {
|
|
107
|
+
// Handler returned a value directly
|
|
108
|
+
// Distinguish between:
|
|
109
|
+
// - ordinary sync return value -> resolve immediately
|
|
110
|
+
// - side-effect artifact (e.g. aws-serverless-express server) -> wait for context.done
|
|
111
|
+
// Heuristic: trying to detect common types of side-effect artifacts
|
|
112
|
+
const looksLikeArtifact = asyncProm !== undefined &&
|
|
113
|
+
typeof asyncProm === 'object' &&
|
|
114
|
+
// 1. Node.js http.Server or similar
|
|
115
|
+
((typeof asyncProm.listen === 'function' && typeof asyncProm.close === 'function') ||
|
|
116
|
+
// 2. EventEmitter-like (has .on and .emit)
|
|
117
|
+
(typeof asyncProm.on === 'function' && typeof asyncProm.emit === 'function') ||
|
|
118
|
+
// 3. Instance of EventEmitter (covers Server, Socket, etc.)
|
|
119
|
+
asyncProm instanceof EventEmitter ||
|
|
120
|
+
// 4. Constructor name hint
|
|
121
|
+
(asyncProm.constructor && /Server|Socket|Emitter/i.test(asyncProm.constructor.name)))
|
|
122
|
+
if (looksLikeArtifact) {
|
|
123
|
+
// Wait for callbackProm instead (the context.done/succeed/fail will resolve it)
|
|
124
|
+
promise = callbackProm
|
|
125
|
+
} else {
|
|
126
|
+
// Return the value directly
|
|
127
|
+
promise = Promise.resolve(asyncProm)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return promise
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* eslint-enable unicorn/consistent-function-scoping, no-useless-assignment, unicorn/no-duplicate-if-branches */
|
|
135
|
+
/* eslint-enable sonarjs/prefer-immediate-return, unicorn/no-negated-condition */
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Reads metadata without executing application getters or Proxy traps.
|
|
139
|
+
*
|
|
140
|
+
* @param {unknown} target
|
|
141
|
+
* @param {string | symbol} name
|
|
142
|
+
*/
|
|
143
|
+
function getDataProperty (target, name) {
|
|
144
|
+
if (target === null || (typeof target !== 'object' && typeof target !== 'function')) return
|
|
145
|
+
while (target !== null && !isProxy(target)) {
|
|
146
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, name)
|
|
147
|
+
if (descriptor) return descriptor.value
|
|
148
|
+
target = Object.getPrototypeOf(target)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Copies data properties without running customer metadata getters or Proxy traps.
|
|
154
|
+
*
|
|
155
|
+
* @param {Function} handler Original handler.
|
|
156
|
+
* @param {Function} wrapped Wrapper to receive safe metadata.
|
|
157
|
+
*/
|
|
158
|
+
function copyHandlerMetadata (handler, wrapped) {
|
|
159
|
+
// datadog-lambda-js uses arity and the runtime's streaming metadata to choose how to invoke the handler.
|
|
160
|
+
Object.defineProperty(wrapped, 'length', { value: getDataProperty(handler, 'length') ?? 0 })
|
|
161
|
+
for (const name of [HANDLER_STREAMING, HANDLER_HIGHWATERMARK, '_ddWrapped']) {
|
|
162
|
+
const value = getDataProperty(handler, name)
|
|
163
|
+
if (value !== undefined) wrapped[name] = value
|
|
164
|
+
}
|
|
165
|
+
if (!isProxy(handler)) {
|
|
166
|
+
for (const name of Reflect.ownKeys(handler)) {
|
|
167
|
+
if (name === 'arguments' || name === 'caller') continue
|
|
168
|
+
const descriptor = Object.getOwnPropertyDescriptor(handler, name)
|
|
169
|
+
if (!Object.hasOwn(descriptor, 'value')) continue
|
|
170
|
+
const existing = Object.getOwnPropertyDescriptor(wrapped, name)
|
|
171
|
+
if (existing?.configurable === false) {
|
|
172
|
+
// Intrinsic function slots such as prototype cannot change their descriptor shape.
|
|
173
|
+
if (existing.writable) {
|
|
174
|
+
Object.defineProperty(wrapped, name, { value: descriptor.value, writable: descriptor.writable })
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
Object.defineProperty(wrapped, name, descriptor)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
module.exports = {
|
|
184
|
+
HANDLER_STREAMING,
|
|
185
|
+
copyHandlerMetadata,
|
|
186
|
+
getDataProperty,
|
|
187
|
+
STREAM_RESPONSE,
|
|
188
|
+
promisifiedHandler,
|
|
189
|
+
}
|
|
@@ -195,9 +195,13 @@ function createMatcher (dcModule) {
|
|
|
195
195
|
configureGraphqlJitRuntime,
|
|
196
196
|
configureMercuriusRequest,
|
|
197
197
|
publishDurableOrchestrationFailure,
|
|
198
|
+
publishTrpcRequestInfo,
|
|
198
199
|
waitForAsyncEnd,
|
|
199
200
|
} = require('./transforms')
|
|
200
201
|
const {
|
|
202
|
+
postgresNativeCopy,
|
|
203
|
+
postgresNativePreparation,
|
|
204
|
+
postgresNativeTransactionEnd,
|
|
201
205
|
postgresQueryAcquire,
|
|
202
206
|
postgresQueryHandlers,
|
|
203
207
|
postgresQueryLifecycle,
|
|
@@ -215,7 +219,11 @@ function createMatcher (dcModule) {
|
|
|
215
219
|
matcher.addTransform('configureGraphqlJitRuntime', configureGraphqlJitRuntime)
|
|
216
220
|
matcher.addTransform('configureMercuriusRequest', configureMercuriusRequest)
|
|
217
221
|
matcher.addTransform('publishDurableOrchestrationFailure', publishDurableOrchestrationFailure)
|
|
222
|
+
matcher.addTransform('postgresNativeCopy', postgresNativeCopy)
|
|
223
|
+
matcher.addTransform('postgresNativePreparation', postgresNativePreparation)
|
|
224
|
+
matcher.addTransform('postgresNativeTransactionEnd', postgresNativeTransactionEnd)
|
|
218
225
|
matcher.addTransform('postgresQueryAcquire', postgresQueryAcquire)
|
|
226
|
+
matcher.addTransform('publishTrpcRequestInfo', publishTrpcRequestInfo)
|
|
219
227
|
matcher.addTransform('postgresQueryHandlers', postgresQueryHandlers)
|
|
220
228
|
matcher.addTransform('postgresQueryLifecycle', postgresQueryLifecycle)
|
|
221
229
|
matcher.addTransform('postgresQueryPreparation', postgresQueryPreparation)
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
/** @satisfies {InstrumentationRegistryEntry[]} */
|
|
24
24
|
const registry = [
|
|
25
25
|
{ instrumentations: require('./instrumentations/ai') },
|
|
26
|
+
{ activate: true, instrumentations: require('./instrumentations/async-mutex') },
|
|
26
27
|
{ activate: true, instrumentations: require('./instrumentations/azure-cosmos') },
|
|
27
28
|
{ instrumentations: require('./instrumentations/azure-durable-functions') },
|
|
28
29
|
{ activate: true, instrumentations: require('./instrumentations/bullmq') },
|
|
@@ -30,6 +31,10 @@ const registry = [
|
|
|
30
31
|
activate: { setup: () => require('../../claude-agent-sdk') },
|
|
31
32
|
instrumentations: require('./instrumentations/claude-agent-sdk'),
|
|
32
33
|
},
|
|
34
|
+
{
|
|
35
|
+
activate: { setup: () => require('../../elevenlabs') },
|
|
36
|
+
instrumentations: require('./instrumentations/elevenlabs'),
|
|
37
|
+
},
|
|
33
38
|
{ instrumentations: require('./instrumentations/graphql') },
|
|
34
39
|
{ instrumentations: require('./instrumentations/graphql-jit') },
|
|
35
40
|
{ instrumentations: require('./instrumentations/jest') },
|
|
@@ -37,7 +42,20 @@ const registry = [
|
|
|
37
42
|
{ activate: true, instrumentations: require('./instrumentations/langgraph') },
|
|
38
43
|
{ activate: true, instrumentations: require('./instrumentations/mercurius') },
|
|
39
44
|
{ instrumentations: require('./instrumentations/modelcontextprotocol-sdk') },
|
|
45
|
+
{
|
|
46
|
+
activate: { setup: () => require('../../modelcontextprotocol-client') },
|
|
47
|
+
instrumentations: require('./instrumentations/modelcontextprotocol-client'),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
activate: { setup: () => require('../../modelcontextprotocol-server') },
|
|
51
|
+
instrumentations: require('./instrumentations/modelcontextprotocol-server'),
|
|
52
|
+
},
|
|
53
|
+
{ instrumentations: require('./instrumentations/next') },
|
|
40
54
|
{ instrumentations: require('./instrumentations/openai-agents') },
|
|
55
|
+
{
|
|
56
|
+
activate: { setup: () => require('../../openai-agents-realtime') },
|
|
57
|
+
instrumentations: require('./instrumentations/openai-agents-realtime'),
|
|
58
|
+
},
|
|
41
59
|
{ instrumentations: require('./instrumentations/playwright') },
|
|
42
60
|
{ activate: true, instrumentations: require('./instrumentations/postgres') },
|
|
43
61
|
{
|
|
@@ -45,7 +63,13 @@ const registry = [
|
|
|
45
63
|
instrumentations: require('./instrumentations/react-router'),
|
|
46
64
|
},
|
|
47
65
|
{ instrumentations: require('./instrumentations/vitest') },
|
|
48
|
-
{
|
|
66
|
+
{
|
|
67
|
+
activate: {
|
|
68
|
+
modules: ['@wdio/cli', '@wdio/jasmine-framework', '@wdio/local-runner', '@wdio/utils', 'webdriverio'],
|
|
69
|
+
setup: activation => require('../../webdriverio').recordLocalRunnerVersion(activation),
|
|
70
|
+
},
|
|
71
|
+
instrumentations: require('./instrumentations/webdriverio'),
|
|
72
|
+
},
|
|
49
73
|
{
|
|
50
74
|
activate: { setup: () => require('../../aws-durable-execution-sdk-js') },
|
|
51
75
|
instrumentations: require('./instrumentations/aws-durable-execution-sdk-js'),
|
|
@@ -55,6 +79,7 @@ const registry = [
|
|
|
55
79
|
activate: { setup: () => require('../../typesafe') },
|
|
56
80
|
instrumentations: require('./instrumentations/typesafe'),
|
|
57
81
|
},
|
|
82
|
+
{ activate: true, instrumentations: require('./instrumentations/trpc') },
|
|
58
83
|
]
|
|
59
84
|
|
|
60
85
|
const activatedModules = new Set()
|
package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/async-mutex.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
module: {
|
|
6
|
+
name: 'async-mutex',
|
|
7
|
+
versionRange: '>=0.5.0',
|
|
8
|
+
filePath: 'lib/Semaphore.js',
|
|
9
|
+
},
|
|
10
|
+
functionQuery: {
|
|
11
|
+
expressionName: 'acquire',
|
|
12
|
+
kind: 'Async',
|
|
13
|
+
},
|
|
14
|
+
channelName: 'Semaphore_acquire',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
module: {
|
|
18
|
+
name: 'async-mutex',
|
|
19
|
+
versionRange: '>=0.5.0',
|
|
20
|
+
filePath: 'es6/Semaphore.js',
|
|
21
|
+
},
|
|
22
|
+
functionQuery: {
|
|
23
|
+
expressionName: 'acquire',
|
|
24
|
+
kind: 'Async',
|
|
25
|
+
},
|
|
26
|
+
channelName: 'Semaphore_acquire',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
module: {
|
|
30
|
+
name: 'async-mutex',
|
|
31
|
+
versionRange: '>=0.5.0',
|
|
32
|
+
filePath: 'index.mjs',
|
|
33
|
+
},
|
|
34
|
+
functionQuery: {
|
|
35
|
+
className: 'Semaphore',
|
|
36
|
+
methodName: 'acquire',
|
|
37
|
+
kind: 'Async',
|
|
38
|
+
},
|
|
39
|
+
channelName: 'Semaphore_acquire',
|
|
40
|
+
},
|
|
41
|
+
]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// The published Node SDK is CommonJS; ESM imports resolve to these same files.
|
|
4
|
+
// Public message callbacks run after tool dispatch, and startSession resolves after audio startup.
|
|
5
|
+
// These version-gated funnels preserve those earlier observation points; real-SDK CJS/ESM tests cover them.
|
|
6
|
+
module.exports = [
|
|
7
|
+
...['startSession', '_onWebSocketOpen', '_handleMessage', '_onWebSocketClose', 'endSession'].map(methodName => ({
|
|
8
|
+
module: {
|
|
9
|
+
name: '@elevenlabs/elevenlabs-js',
|
|
10
|
+
versionRange: '>=2.75.0 <3',
|
|
11
|
+
filePath: 'api/resources/conversationalAi/conversation/Conversation.js',
|
|
12
|
+
},
|
|
13
|
+
functionQuery: { className: 'Conversation', methodName, kind: methodName === 'startSession' ? 'Async' : 'Sync' },
|
|
14
|
+
channelName: methodName,
|
|
15
|
+
})),
|
|
16
|
+
...['register', 'executeToolAsync'].map(methodName => ({
|
|
17
|
+
module: {
|
|
18
|
+
name: '@elevenlabs/elevenlabs-js',
|
|
19
|
+
versionRange: '>=2.75.0 <3',
|
|
20
|
+
filePath: 'api/resources/conversationalAi/conversation/ClientTools.js',
|
|
21
|
+
},
|
|
22
|
+
functionQuery: { className: 'ClientTools', methodName },
|
|
23
|
+
channelName: methodName,
|
|
24
|
+
})),
|
|
25
|
+
]
|
|
@@ -210,18 +210,6 @@ const instrumentations = [
|
|
|
210
210
|
},
|
|
211
211
|
channelName: 'dd:graphql:printer:load',
|
|
212
212
|
},
|
|
213
|
-
{
|
|
214
|
-
module: {
|
|
215
|
-
name: 'graphql',
|
|
216
|
-
versionRange: '>=0.10',
|
|
217
|
-
filePath: 'language/printer.mjs',
|
|
218
|
-
},
|
|
219
|
-
functionQuery: {
|
|
220
|
-
functionName: '__module_export__',
|
|
221
|
-
kind: 'Sync',
|
|
222
|
-
},
|
|
223
|
-
channelName: 'dd:graphql:printer:load',
|
|
224
|
-
},
|
|
225
213
|
{
|
|
226
214
|
module: {
|
|
227
215
|
name: 'graphql',
|
|
@@ -234,18 +222,6 @@ const instrumentations = [
|
|
|
234
222
|
},
|
|
235
223
|
channelName: 'dd:graphql:visitor:load',
|
|
236
224
|
},
|
|
237
|
-
{
|
|
238
|
-
module: {
|
|
239
|
-
name: 'graphql',
|
|
240
|
-
versionRange: '>=0.10',
|
|
241
|
-
filePath: 'language/visitor.mjs',
|
|
242
|
-
},
|
|
243
|
-
functionQuery: {
|
|
244
|
-
functionName: '__module_export__',
|
|
245
|
-
kind: 'Sync',
|
|
246
|
-
},
|
|
247
|
-
channelName: 'dd:graphql:visitor:load',
|
|
248
|
-
},
|
|
249
225
|
{
|
|
250
226
|
module: {
|
|
251
227
|
name: 'graphql',
|
|
@@ -258,18 +234,6 @@ const instrumentations = [
|
|
|
258
234
|
},
|
|
259
235
|
channelName: 'dd:graphql:utilities:load',
|
|
260
236
|
},
|
|
261
|
-
{
|
|
262
|
-
module: {
|
|
263
|
-
name: 'graphql',
|
|
264
|
-
versionRange: '>=0.10',
|
|
265
|
-
filePath: 'utilities/index.mjs',
|
|
266
|
-
},
|
|
267
|
-
functionQuery: {
|
|
268
|
-
functionName: '__module_export__',
|
|
269
|
-
kind: 'Sync',
|
|
270
|
-
},
|
|
271
|
-
channelName: 'dd:graphql:utilities:load',
|
|
272
|
-
},
|
|
273
237
|
]
|
|
274
238
|
|
|
275
239
|
const fastPathInstrumentations = []
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// SDK 2.x bundles Client into `dist/index` up to 2.3, and into a `public-<hash>` chunk from 2.4.
|
|
4
|
+
const CLIENT_FILES = [
|
|
5
|
+
{ versionRange: '>=2 <2.4.0', filePath: /^dist\/index\.[cm]js$/ },
|
|
6
|
+
{ versionRange: '>=2.4.0', filePath: /^dist\/public-[\w-]+\.[cm]js$/ },
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
const CLIENT_METHODS = [
|
|
10
|
+
'callTool',
|
|
11
|
+
'listTools',
|
|
12
|
+
'listResources',
|
|
13
|
+
'readResource',
|
|
14
|
+
'listPrompts',
|
|
15
|
+
'getPrompt',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
module.exports = [
|
|
19
|
+
...CLIENT_FILES.flatMap(({ versionRange, filePath }) => CLIENT_METHODS.map(methodName => ({
|
|
20
|
+
module: { name: '@modelcontextprotocol/client', versionRange, filePath },
|
|
21
|
+
functionQuery: { methodName, className: 'Client', kind: 'Async' },
|
|
22
|
+
channelName: `Client_${methodName}`,
|
|
23
|
+
}))),
|
|
24
|
+
// Every 2.x release bundles Protocol into a `src-<hash>` chunk.
|
|
25
|
+
{
|
|
26
|
+
module: { name: '@modelcontextprotocol/client', versionRange: '>=2', filePath: /^dist\/src-[\w-]+\.[cm]js$/ },
|
|
27
|
+
functionQuery: { methodName: 'request', className: 'Protocol', kind: 'Sync' },
|
|
28
|
+
channelName: 'Protocol_request',
|
|
29
|
+
},
|
|
30
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
// SDK 2.x bundles Server and McpServer into an `mcp-<hash>` chunk whose hash changes between releases.
|
|
4
|
+
const filePath = /^dist\/mcp-[\w-]+\.[cm]js$/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} className
|
|
8
|
+
* @param {string} methodName
|
|
9
|
+
* @param {'Sync'|'Async'} kind
|
|
10
|
+
*/
|
|
11
|
+
function entry (className, methodName, kind) {
|
|
12
|
+
return {
|
|
13
|
+
module: { name: '@modelcontextprotocol/server', versionRange: '>=2', filePath },
|
|
14
|
+
functionQuery: { methodName, className, kind },
|
|
15
|
+
channelName: `${className}_${methodName}`,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = [
|
|
20
|
+
entry('Server', '_wrapHandler', 'Sync'),
|
|
21
|
+
entry('McpServer', 'registerTool', 'Sync'),
|
|
22
|
+
entry('McpServer', 'executeToolHandler', 'Async'),
|
|
23
|
+
]
|