@depup/dd-trace 5.97.0-depup.0 → 6.5.0-depup.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/LICENSE-3rdparty.csv +89 -104
- package/README.electron.md +7 -0
- package/README.md +2 -2
- package/changes.json +1 -1
- package/ci/diagnose.js +2100 -0
- package/ci/init.js +46 -5
- package/ci/runbook.md +198 -0
- package/ci/test-optimization-validation/approval-artifacts.js +143 -0
- package/ci/test-optimization-validation/approval.js +299 -0
- package/ci/test-optimization-validation/artifact-id.js +20 -0
- package/ci/test-optimization-validation/bounded-json.js +121 -0
- package/ci/test-optimization-validation/ci-command-candidate.js +83 -0
- package/ci/test-optimization-validation/ci-discovery.js +181 -0
- package/ci/test-optimization-validation/ci-remediation.js +210 -0
- package/ci/test-optimization-validation/cli.js +903 -0
- package/ci/test-optimization-validation/command-blocker.js +81 -0
- package/ci/test-optimization-validation/command-output-policy.js +206 -0
- package/ci/test-optimization-validation/command-runner.js +707 -0
- package/ci/test-optimization-validation/command-suitability.js +471 -0
- package/ci/test-optimization-validation/executable-approval.js +48 -0
- package/ci/test-optimization-validation/executable.js +480 -0
- package/ci/test-optimization-validation/generated-file-policy.js +63 -0
- package/ci/test-optimization-validation/generated-files.js +351 -0
- package/ci/test-optimization-validation/generated-verifier.js +196 -0
- package/ci/test-optimization-validation/init-probe-preload.js +163 -0
- package/ci/test-optimization-validation/init-probe.js +246 -0
- package/ci/test-optimization-validation/late-initialization.js +63 -0
- package/ci/test-optimization-validation/local-command.js +163 -0
- package/ci/test-optimization-validation/manifest-loader.js +133 -0
- package/ci/test-optimization-validation/manifest-scaffold.js +738 -0
- package/ci/test-optimization-validation/manifest-schema.js +862 -0
- package/ci/test-optimization-validation/offline-fixtures.js +327 -0
- package/ci/test-optimization-validation/offline-output.js +406 -0
- package/ci/test-optimization-validation/payload-normalizer.js +72 -0
- package/ci/test-optimization-validation/plan-writer.js +1120 -0
- package/ci/test-optimization-validation/preflight-runner.js +114 -0
- package/ci/test-optimization-validation/redaction.js +331 -0
- package/ci/test-optimization-validation/report-writer.js +1508 -0
- package/ci/test-optimization-validation/safe-files.js +203 -0
- package/ci/test-optimization-validation/scenarios/auto-test-retries.js +159 -0
- package/ci/test-optimization-validation/scenarios/basic-reporting.js +657 -0
- package/ci/test-optimization-validation/scenarios/ci-wiring.js +780 -0
- package/ci/test-optimization-validation/scenarios/early-flake-detection.js +141 -0
- package/ci/test-optimization-validation/scenarios/helpers.js +539 -0
- package/ci/test-optimization-validation/scenarios/test-management.js +218 -0
- package/ci/test-optimization-validation/setup-runner.js +97 -0
- package/ci/test-optimization-validation/static-diagnosis.js +159 -0
- package/ci/test-optimization-validation/test-output.js +129 -0
- package/ci/test-optimization-validation-manifest.schema.json +1 -0
- package/ci/validate-test-optimization.js +3 -0
- package/ci/vitest-no-worker-init-setup.mjs +430 -0
- package/ext/exporters.js +2 -0
- package/ext/tags.js +3 -0
- package/index.d.ts +436 -252
- package/index.electron.js +3 -0
- package/init.js +18 -0
- package/initialize.mjs +10 -9
- package/loader-hook.mjs +170 -53
- package/openfeature.d.ts +1 -0
- package/openfeature.js +4 -0
- package/package.json +118 -80
- package/packages/datadog-core/src/storage.js +47 -48
- package/packages/datadog-esbuild/index.js +32 -1
- package/packages/datadog-esbuild/src/utils.js +46 -3
- package/packages/datadog-instrumentations/src/aerospike.js +3 -3
- package/packages/datadog-instrumentations/src/ai.js +137 -76
- package/packages/datadog-instrumentations/src/amqplib.js +6 -7
- package/packages/datadog-instrumentations/src/anthropic.js +10 -10
- package/packages/datadog-instrumentations/src/apollo-server-core.js +3 -3
- package/packages/datadog-instrumentations/src/apollo-server.js +10 -18
- package/packages/datadog-instrumentations/src/avsc.js +6 -6
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js-context-methods.js +18 -0
- package/packages/datadog-instrumentations/src/aws-durable-execution-sdk-js.js +111 -0
- package/packages/datadog-instrumentations/src/aws-sdk.js +172 -72
- package/packages/datadog-instrumentations/src/azure-cosmos.js +7 -0
- package/packages/datadog-instrumentations/src/azure-durable-functions.js +8 -8
- package/packages/datadog-instrumentations/src/azure-functions.js +3 -0
- package/packages/datadog-instrumentations/src/bluebird.js +2 -2
- package/packages/datadog-instrumentations/src/body-parser.js +5 -2
- package/packages/datadog-instrumentations/src/cassandra-driver.js +12 -9
- package/packages/datadog-instrumentations/src/child_process.js +16 -16
- package/packages/datadog-instrumentations/src/claude-agent-sdk.js +587 -0
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +41 -24
- package/packages/datadog-instrumentations/src/connect.js +14 -12
- package/packages/datadog-instrumentations/src/cookie-parser.js +5 -4
- package/packages/datadog-instrumentations/src/cookie.js +9 -3
- package/packages/datadog-instrumentations/src/couchbase.js +73 -238
- package/packages/datadog-instrumentations/src/crypto.js +49 -4
- package/packages/datadog-instrumentations/src/cucumber-worker-threads.js +25 -0
- package/packages/datadog-instrumentations/src/cucumber.js +762 -189
- package/packages/datadog-instrumentations/src/cypress-config.js +547 -93
- package/packages/datadog-instrumentations/src/cypress.js +5 -3
- package/packages/datadog-instrumentations/src/dns.js +60 -59
- package/packages/datadog-instrumentations/src/elasticsearch.js +9 -12
- package/packages/datadog-instrumentations/src/electron/preload.js +42 -0
- package/packages/datadog-instrumentations/src/electron.js +240 -0
- package/packages/datadog-instrumentations/src/express-mongo-sanitize.js +11 -9
- package/packages/datadog-instrumentations/src/express-session.js +14 -13
- package/packages/datadog-instrumentations/src/express.js +52 -30
- package/packages/datadog-instrumentations/src/fastify.js +166 -87
- package/packages/datadog-instrumentations/src/fetch.js +5 -5
- package/packages/datadog-instrumentations/src/fs.js +22 -20
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +5 -7
- package/packages/datadog-instrumentations/src/google-genai.js +4 -4
- package/packages/datadog-instrumentations/src/graphql.js +26 -362
- package/packages/datadog-instrumentations/src/grpc/client.js +48 -32
- package/packages/datadog-instrumentations/src/grpc/server.js +20 -2
- package/packages/datadog-instrumentations/src/hapi.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/callback-instrumentor.js +74 -0
- package/packages/datadog-instrumentations/src/helpers/check-require-cache.js +85 -9
- package/packages/datadog-instrumentations/src/helpers/hook.js +31 -7
- package/packages/datadog-instrumentations/src/helpers/hooks.js +12 -0
- package/packages/datadog-instrumentations/src/helpers/instrument.js +36 -3
- package/packages/datadog-instrumentations/src/helpers/kafka.js +58 -0
- package/packages/datadog-instrumentations/src/helpers/optional-peer-bundler.js +65 -0
- package/packages/datadog-instrumentations/src/helpers/promise-instrumentor.js +42 -0
- package/packages/datadog-instrumentations/src/helpers/promise.js +2 -2
- package/packages/datadog-instrumentations/src/helpers/register.js +7 -5
- package/packages/datadog-instrumentations/src/helpers/rewriter/compiler.js +13 -5
- package/packages/datadog-instrumentations/src/helpers/rewriter/index.js +24 -7
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/ai.js +6 -6
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/aws-durable-execution-sdk-js.js +31 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/azure-cosmos.js +50 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/claude-agent-sdk.js +17 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/graphql.js +201 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/index.js +7 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/langgraph.js +4 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/mercurius.js +31 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/modelcontextprotocol-sdk.js +35 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/instrumentations/playwright.js +111 -0
- package/packages/datadog-instrumentations/src/helpers/rewriter/loader.mjs +18 -2
- package/packages/datadog-instrumentations/src/helpers/rewriter/transforms.js +49 -224
- package/packages/datadog-instrumentations/src/helpers/router-helper.js +8 -8
- package/packages/datadog-instrumentations/src/hono.js +71 -9
- package/packages/datadog-instrumentations/src/http/client.js +48 -24
- package/packages/datadog-instrumentations/src/http/server.js +75 -29
- package/packages/datadog-instrumentations/src/http2/client.js +15 -12
- package/packages/datadog-instrumentations/src/http2/server.js +156 -23
- package/packages/datadog-instrumentations/src/ioredis.js +17 -14
- package/packages/datadog-instrumentations/src/iovalkey.js +1 -2
- package/packages/datadog-instrumentations/src/jest/bail-reporter.js +42 -0
- package/packages/datadog-instrumentations/src/jest/coverage-backfill.js +163 -0
- package/packages/datadog-instrumentations/src/jest.js +1809 -401
- package/packages/datadog-instrumentations/src/kafkajs.js +284 -170
- package/packages/datadog-instrumentations/src/knex.js +17 -17
- package/packages/datadog-instrumentations/src/koa.js +15 -14
- package/packages/datadog-instrumentations/src/ldapjs.js +5 -5
- package/packages/datadog-instrumentations/src/light-my-request.js +2 -2
- package/packages/datadog-instrumentations/src/limitd-client.js +4 -4
- package/packages/datadog-instrumentations/src/lodash.js +4 -4
- package/packages/datadog-instrumentations/src/mariadb.js +18 -16
- package/packages/datadog-instrumentations/src/memcached.js +4 -3
- package/packages/datadog-instrumentations/src/mercurius.js +11 -0
- package/packages/datadog-instrumentations/src/microgateway-core.js +2 -2
- package/packages/datadog-instrumentations/src/mocha/common.js +7 -4
- package/packages/datadog-instrumentations/src/mocha/main.js +557 -120
- package/packages/datadog-instrumentations/src/mocha/utils.js +531 -135
- package/packages/datadog-instrumentations/src/mocha/worker.js +27 -9
- package/packages/datadog-instrumentations/src/modelcontextprotocol-sdk.js +254 -0
- package/packages/datadog-instrumentations/src/mongodb-core.js +43 -31
- package/packages/datadog-instrumentations/src/mongodb.js +82 -8
- package/packages/datadog-instrumentations/src/mongoose.js +46 -37
- package/packages/datadog-instrumentations/src/mquery.js +7 -7
- package/packages/datadog-instrumentations/src/multer.js +5 -4
- package/packages/datadog-instrumentations/src/mysql.js +17 -17
- package/packages/datadog-instrumentations/src/mysql2.js +39 -5
- package/packages/datadog-instrumentations/src/nats.js +182 -0
- package/packages/datadog-instrumentations/src/net.js +19 -11
- package/packages/datadog-instrumentations/src/next.js +68 -10
- package/packages/datadog-instrumentations/src/nyc.js +43 -8
- package/packages/datadog-instrumentations/src/openai.js +124 -38
- package/packages/datadog-instrumentations/src/oracledb.js +12 -7
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +27 -6
- package/packages/datadog-instrumentations/src/passport-utils.js +5 -5
- package/packages/datadog-instrumentations/src/path-to-regexp.js +44 -0
- package/packages/datadog-instrumentations/src/pg.js +58 -25
- package/packages/datadog-instrumentations/src/pino.js +25 -41
- package/packages/datadog-instrumentations/src/playwright-browser-scripts.js +27 -0
- package/packages/datadog-instrumentations/src/playwright.js +1229 -356
- package/packages/datadog-instrumentations/src/process.js +3 -0
- package/packages/datadog-instrumentations/src/protobufjs.js +16 -16
- package/packages/datadog-instrumentations/src/redis.js +28 -15
- package/packages/datadog-instrumentations/src/restify.js +6 -5
- package/packages/datadog-instrumentations/src/router.js +253 -87
- package/packages/datadog-instrumentations/src/selenium.js +53 -28
- package/packages/datadog-instrumentations/src/stripe.js +47 -33
- package/packages/datadog-instrumentations/src/tedious.js +28 -0
- package/packages/datadog-instrumentations/src/vitest-main-no-worker-init.js +1297 -0
- package/packages/datadog-instrumentations/src/vitest-main.js +1590 -0
- package/packages/datadog-instrumentations/src/vitest-util.js +251 -0
- package/packages/datadog-instrumentations/src/vitest-worker.js +822 -0
- package/packages/datadog-instrumentations/src/vitest.js +11 -1262
- package/packages/datadog-instrumentations/src/winston.js +4 -4
- package/packages/datadog-instrumentations/src/ws.js +9 -8
- package/packages/datadog-instrumentations/src/zlib.js +29 -0
- package/packages/datadog-plugin-ai/src/index.js +1 -1
- package/packages/datadog-plugin-ai/src/tracing.js +66 -3
- package/packages/datadog-plugin-ai/src/utils.js +17 -4
- package/packages/datadog-plugin-apollo/src/gateway/request.js +1 -21
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +3 -3
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/checkpoint.js +31 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/client.js +55 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/context.js +123 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/handler.js +129 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/index.js +19 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/trace-checkpoint.js +224 -0
- package/packages/datadog-plugin-aws-durable-execution-sdk-js/src/util.js +80 -0
- package/packages/datadog-plugin-aws-sdk/src/base.js +86 -50
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +218 -4
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +59 -14
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +174 -75
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +34 -23
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +2 -1
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +26 -26
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +187 -101
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +20 -18
- package/packages/datadog-plugin-aws-sdk/src/util.js +2 -2
- package/packages/datadog-plugin-azure-cosmos/src/index.js +144 -0
- package/packages/datadog-plugin-azure-event-hubs/src/producer.js +8 -15
- package/packages/datadog-plugin-azure-functions/src/index.js +7 -3
- package/packages/datadog-plugin-azure-service-bus/src/producer.js +5 -10
- package/packages/datadog-plugin-bullmq/src/consumer.js +5 -4
- package/packages/datadog-plugin-bullmq/src/filter.js +35 -0
- package/packages/datadog-plugin-bullmq/src/producer.js +121 -33
- package/packages/datadog-plugin-bunyan/src/index.js +28 -0
- package/packages/datadog-plugin-child_process/src/index.js +13 -2
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +6 -6
- package/packages/datadog-plugin-claude-agent-sdk/src/index.js +31 -0
- package/packages/datadog-plugin-claude-agent-sdk/src/tracing.js +107 -0
- package/packages/datadog-plugin-claude-agent-sdk/src/util.js +15 -0
- package/packages/datadog-plugin-couchbase/src/index.js +58 -52
- package/packages/datadog-plugin-cucumber/src/index.js +47 -29
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +929 -98
- package/packages/datadog-plugin-cypress/src/index.js +109 -2
- package/packages/datadog-plugin-cypress/src/plugin.js +6 -14
- package/packages/datadog-plugin-cypress/src/source-map-utils.js +48 -1
- package/packages/datadog-plugin-cypress/src/support.js +272 -51
- package/packages/datadog-plugin-dd-trace-api/src/index.js +1 -1
- package/packages/datadog-plugin-dns/src/lookup.js +8 -6
- package/packages/datadog-plugin-elasticsearch/src/index.js +28 -8
- package/packages/datadog-plugin-electron/src/index.js +17 -0
- package/packages/datadog-plugin-electron/src/ipc.js +143 -0
- package/packages/datadog-plugin-electron/src/net.js +82 -0
- package/packages/datadog-plugin-express/src/code_origin.js +1 -1
- package/packages/datadog-plugin-fastify/src/code_origin.js +1 -1
- package/packages/datadog-plugin-fs/src/index.js +2 -1
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +2 -5
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +27 -18
- package/packages/datadog-plugin-google-cloud-pubsub/src/pubsub-push-subscription.js +5 -8
- package/packages/datadog-plugin-graphql/src/execute.js +748 -34
- package/packages/datadog-plugin-graphql/src/index.js +43 -9
- package/packages/datadog-plugin-graphql/src/parse.js +45 -4
- package/packages/datadog-plugin-graphql/src/request.js +135 -0
- package/packages/datadog-plugin-graphql/src/tools/signature.js +32 -7
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +118 -100
- package/packages/datadog-plugin-graphql/src/utils.js +261 -3
- package/packages/datadog-plugin-graphql/src/validate.js +54 -8
- package/packages/datadog-plugin-grpc/src/client.js +7 -8
- package/packages/datadog-plugin-grpc/src/server.js +1 -1
- package/packages/datadog-plugin-grpc/src/util.js +57 -22
- package/packages/datadog-plugin-http/src/client.js +12 -14
- package/packages/datadog-plugin-http/src/index.js +6 -8
- package/packages/datadog-plugin-http/src/server.js +63 -20
- package/packages/datadog-plugin-http2/src/client.js +7 -4
- package/packages/datadog-plugin-http2/src/server.js +48 -8
- package/packages/datadog-plugin-jest/src/index.js +133 -67
- package/packages/datadog-plugin-jest/src/util.js +37 -16
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +1 -1
- package/packages/datadog-plugin-kafkajs/src/consumer.js +2 -9
- package/packages/datadog-plugin-kafkajs/src/producer.js +37 -8
- package/packages/datadog-plugin-langchain/src/handlers/embedding.js +2 -1
- package/packages/datadog-plugin-langchain/src/handlers/language_models.js +2 -1
- package/packages/datadog-plugin-langchain/src/tokens.js +2 -2
- package/packages/datadog-plugin-langgraph/src/stream.js +1 -1
- package/packages/datadog-plugin-memcached/src/index.js +1 -1
- package/packages/datadog-plugin-mocha/src/index.js +66 -20
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/index.js +24 -0
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/tracing.js +173 -0
- package/packages/datadog-plugin-modelcontextprotocol-sdk/src/utils.js +30 -0
- package/packages/datadog-plugin-mongodb-core/src/bulk-write.js +43 -0
- package/packages/datadog-plugin-mongodb-core/src/index.js +8 -206
- package/packages/datadog-plugin-mongodb-core/src/query.js +452 -0
- package/packages/datadog-plugin-mysql/src/index.js +9 -4
- package/packages/datadog-plugin-nats/src/consumer.js +43 -0
- package/packages/datadog-plugin-nats/src/index.js +20 -0
- package/packages/datadog-plugin-nats/src/producer.js +62 -0
- package/packages/datadog-plugin-nats/src/util.js +33 -0
- package/packages/datadog-plugin-next/src/index.js +12 -4
- package/packages/datadog-plugin-openai/src/services.js +4 -3
- package/packages/datadog-plugin-openai/src/tracing.js +27 -25
- package/packages/datadog-plugin-oracledb/src/index.js +13 -2
- package/packages/datadog-plugin-pg/src/index.js +13 -3
- package/packages/datadog-plugin-pino/src/index.js +42 -0
- package/packages/datadog-plugin-playwright/src/index.js +195 -72
- package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +3 -3
- package/packages/datadog-plugin-redis/src/index.js +54 -25
- package/packages/datadog-plugin-rhea/src/producer.js +1 -1
- package/packages/datadog-plugin-router/src/index.js +55 -44
- package/packages/datadog-plugin-selenium/src/index.js +5 -36
- package/packages/datadog-plugin-tedious/src/index.js +1 -1
- package/packages/datadog-plugin-undici/src/index.js +24 -2
- package/packages/datadog-plugin-vitest/src/index.js +160 -90
- package/packages/datadog-plugin-winston/src/index.js +30 -0
- package/packages/datadog-plugin-ws/src/close.js +5 -2
- package/packages/datadog-plugin-ws/src/producer.js +4 -1
- package/packages/datadog-plugin-ws/src/receiver.js +4 -2
- package/packages/datadog-plugin-ws/src/server.js +2 -1
- package/packages/datadog-shimmer/src/shimmer.js +101 -39
- package/packages/datadog-webpack/index.js +17 -1
- package/packages/datadog-webpack/src/optional-peer-loader.js +17 -0
- package/packages/dd-trace/index.electron.js +3 -0
- package/packages/dd-trace/index.js +2 -36
- package/packages/dd-trace/src/aiguard/channels.js +7 -0
- package/packages/dd-trace/src/aiguard/index.js +16 -34
- package/packages/dd-trace/src/aiguard/integrations/evaluate.js +46 -0
- package/packages/dd-trace/src/aiguard/integrations/index.js +34 -0
- package/packages/dd-trace/src/aiguard/integrations/openai.js +80 -0
- package/packages/dd-trace/src/aiguard/integrations/vercel-ai.js +92 -0
- package/packages/dd-trace/src/aiguard/messages/openai.js +382 -0
- package/packages/{datadog-instrumentations/src/helpers/ai-messages.js → dd-trace/src/aiguard/messages/vercel-ai.js} +30 -27
- package/packages/dd-trace/src/aiguard/sdk.js +148 -55
- package/packages/dd-trace/src/aiguard/tags.js +26 -10
- package/packages/dd-trace/src/appsec/api_security/index.js +55 -0
- package/packages/dd-trace/src/appsec/api_security/sampler.js +147 -0
- package/packages/dd-trace/src/appsec/blocked_templates.js +4 -3
- package/packages/dd-trace/src/appsec/blocking.js +82 -42
- package/packages/dd-trace/src/appsec/channels.js +5 -1
- package/packages/dd-trace/src/appsec/downstream_requests.js +116 -62
- package/packages/dd-trace/src/appsec/graphql.js +20 -17
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +81 -81
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +23 -23
- package/packages/dd-trace/src/appsec/iast/index.js +3 -2
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +4 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +4 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -2
- package/packages/dd-trace/src/appsec/iast/telemetry/index.js +2 -1
- package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +3 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +54 -12
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/url-sensitive-analyzer.js +5 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +31 -4
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +1 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +83 -48
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +1 -1
- package/packages/dd-trace/src/appsec/index.js +65 -47
- package/packages/dd-trace/src/appsec/lambda.js +135 -0
- package/packages/dd-trace/src/appsec/rasp/command_injection.js +4 -5
- package/packages/dd-trace/src/appsec/rasp/lfi.js +8 -4
- package/packages/dd-trace/src/appsec/rasp/sql_injection.js +5 -10
- package/packages/dd-trace/src/appsec/rasp/ssrf.js +26 -18
- package/packages/dd-trace/src/appsec/recommended.json +2438 -13
- package/packages/dd-trace/src/appsec/reporter.js +87 -28
- package/packages/dd-trace/src/appsec/rule_manager.js +4 -2
- package/packages/dd-trace/src/appsec/sdk/set_user.js +1 -1
- package/packages/dd-trace/src/appsec/sdk/track_event.js +5 -5
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +7 -11
- package/packages/dd-trace/src/appsec/sdk/utils.js +5 -3
- package/packages/dd-trace/src/appsec/store.js +50 -0
- package/packages/dd-trace/src/appsec/telemetry/api_security.js +34 -0
- package/packages/dd-trace/src/appsec/telemetry/index.js +27 -1
- package/packages/dd-trace/src/appsec/user_tracking.js +5 -4
- package/packages/dd-trace/src/appsec/waf/index.js +19 -9
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +35 -20
- package/packages/dd-trace/src/appsec/waf/waf_manager.js +1 -1
- package/packages/dd-trace/src/azure_metadata.js +19 -7
- package/packages/dd-trace/src/baggage.js +32 -13
- package/packages/dd-trace/src/bootstrap.js +39 -0
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +123 -33
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +122 -24
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +22 -7
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +5 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/index.js +6 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +2 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/index.js +160 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/msgpack-to-json.js +288 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/payload-projection.js +84 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/sink.js +369 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-validation/writer.js +60 -0
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +188 -27
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +3 -4
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +28 -10
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +22 -0
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +110 -22
- package/packages/dd-trace/src/ci-visibility/lage.js +2 -1
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +4 -5
- package/packages/dd-trace/src/ci-visibility/requests/fs-cache.js +4 -5
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +73 -55
- package/packages/dd-trace/src/ci-visibility/requests/request.js +14 -50
- package/packages/dd-trace/src/ci-visibility/requests/upload-coverage-report.js +10 -6
- package/packages/dd-trace/src/ci-visibility/requests/upload-test-screenshot.js +156 -0
- package/packages/dd-trace/src/ci-visibility/rum.js +7 -0
- package/packages/dd-trace/src/ci-visibility/test-api-manual/test-api-manual-plugin.js +9 -3
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +24 -6
- package/packages/dd-trace/src/ci-visibility/test-optimization-cache.js +70 -6
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache-schema.js +256 -0
- package/packages/dd-trace/src/ci-visibility/test-optimization-http-cache.js +451 -0
- package/packages/dd-trace/src/ci-visibility/test-screenshot.js +90 -0
- package/packages/dd-trace/src/config/config-types.d.ts +8 -6
- package/packages/dd-trace/src/config/defaults.js +71 -44
- package/packages/dd-trace/src/config/generated-config-types.d.ts +692 -131
- package/packages/dd-trace/src/config/git_properties.js +2 -2
- package/packages/dd-trace/src/config/helper.js +140 -33
- package/packages/dd-trace/src/config/index.js +127 -131
- package/packages/dd-trace/src/config/major-overrides.js +100 -0
- package/packages/dd-trace/src/config/normalize-service.js +31 -0
- package/packages/dd-trace/src/config/parsers.js +138 -10
- package/packages/dd-trace/src/config/remote_config.js +1 -1
- package/packages/dd-trace/src/config/supported-configurations.json +460 -203
- package/packages/dd-trace/src/constants.js +15 -0
- package/packages/dd-trace/src/crashtracking/crashtracker.js +18 -6
- package/packages/dd-trace/src/datastreams/checkpointer.js +6 -12
- package/packages/dd-trace/src/datastreams/context.js +4 -2
- package/packages/dd-trace/src/datastreams/encoding.js +39 -28
- package/packages/dd-trace/src/datastreams/index.js +2 -1
- package/packages/dd-trace/src/datastreams/manager.js +1 -1
- package/packages/dd-trace/src/datastreams/pathway.js +35 -30
- package/packages/dd-trace/src/datastreams/processor.js +31 -22
- package/packages/dd-trace/src/datastreams/size.js +6 -2
- package/packages/dd-trace/src/datastreams/writer.js +15 -6
- package/packages/dd-trace/src/debugger/config.js +9 -4
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +49 -35
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +5 -8
- package/packages/dd-trace/src/debugger/devtools_client/config.js +3 -2
- package/packages/dd-trace/src/debugger/devtools_client/index.js +33 -71
- package/packages/dd-trace/src/debugger/devtools_client/probe_sampler.js +83 -0
- package/packages/dd-trace/src/debugger/devtools_client/send.js +27 -6
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +2 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +5 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot-pruner.js +1 -0
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/state.js +3 -1
- package/packages/dd-trace/src/debugger/index.js +13 -9
- package/packages/dd-trace/src/debugger/probe_sampler.js +112 -0
- package/packages/dd-trace/src/debugger/probe_sampler_constants.js +19 -0
- package/packages/dd-trace/src/dogstatsd.js +34 -28
- package/packages/dd-trace/src/encode/0.4.js +829 -268
- package/packages/dd-trace/src/encode/0.5.js +158 -22
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +141 -65
- package/packages/dd-trace/src/encode/agentless-json.js +12 -6
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +52 -15
- package/packages/dd-trace/src/encode/span-stats.js +19 -16
- package/packages/dd-trace/src/encode/tags-processors.js +30 -25
- package/packages/dd-trace/src/exporter.js +5 -1
- package/packages/dd-trace/src/exporters/agent/index.js +4 -5
- package/packages/dd-trace/src/exporters/agent/writer.js +1 -2
- package/packages/dd-trace/src/exporters/agentless/index.js +12 -13
- package/packages/dd-trace/src/exporters/agentless/intake.js +43 -0
- package/packages/dd-trace/src/exporters/agentless/writer.js +12 -11
- package/packages/dd-trace/src/exporters/common/agents.js +3 -1
- package/packages/dd-trace/src/exporters/common/buffering-exporter.js +3 -3
- package/packages/dd-trace/src/exporters/common/client-library-headers.js +21 -0
- package/packages/dd-trace/src/exporters/common/request.js +93 -44
- package/packages/dd-trace/src/exporters/common/retry.js +104 -0
- package/packages/dd-trace/src/exporters/common/url.js +48 -0
- package/packages/dd-trace/src/exporters/common/util.js +2 -2
- package/packages/dd-trace/src/exporters/common/writer.js +17 -1
- package/packages/dd-trace/src/exporters/electron/index.js +49 -0
- package/packages/dd-trace/src/exporters/span-stats/index.js +1 -2
- package/packages/dd-trace/src/exporters/span-stats/writer.js +1 -3
- package/packages/dd-trace/src/external-logger/src/index.js +2 -1
- package/packages/dd-trace/src/feature-registry.js +29 -0
- package/packages/dd-trace/src/git_metadata.js +68 -0
- package/packages/dd-trace/src/git_metadata_tagger.js +13 -5
- package/packages/dd-trace/src/guardrails/index.js +11 -6
- package/packages/dd-trace/src/guardrails/telemetry.js +40 -3
- package/packages/dd-trace/src/heap_snapshots.js +4 -4
- package/packages/dd-trace/src/id.js +46 -27
- package/packages/dd-trace/src/index.js +7 -8
- package/packages/dd-trace/src/lambda/handler-paths.js +52 -0
- package/packages/dd-trace/src/lambda/handler.js +2 -6
- package/packages/dd-trace/src/lambda/index.js +62 -14
- package/packages/dd-trace/src/lambda/runtime/patch.js +21 -46
- package/packages/dd-trace/src/llmobs/constants/tags.js +13 -0
- package/packages/dd-trace/src/llmobs/experiments/client.js +113 -0
- package/packages/dd-trace/src/llmobs/experiments/dataset.js +154 -0
- package/packages/dd-trace/src/llmobs/experiments/experiment.js +283 -0
- package/packages/dd-trace/src/llmobs/experiments/index.js +152 -0
- package/packages/dd-trace/src/llmobs/experiments/noop.js +30 -0
- package/packages/dd-trace/src/llmobs/experiments/result.js +34 -0
- package/packages/dd-trace/src/llmobs/index.js +37 -7
- package/packages/dd-trace/src/llmobs/noop.js +6 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/ddTelemetry.js +403 -0
- package/packages/dd-trace/src/llmobs/plugins/ai/index.js +8 -395
- package/packages/dd-trace/src/llmobs/plugins/ai/util.js +119 -7
- package/packages/dd-trace/src/llmobs/plugins/ai/vercelTelemetry.js +380 -0
- package/packages/dd-trace/src/llmobs/plugins/{anthropic.js → anthropic/index.js} +32 -79
- package/packages/dd-trace/src/llmobs/plugins/anthropic/util.js +109 -0
- package/packages/dd-trace/src/llmobs/plugins/base.js +4 -4
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +89 -37
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/index.js +270 -0
- package/packages/dd-trace/src/llmobs/plugins/claude-agent-sdk/utils.js +10 -0
- package/packages/dd-trace/src/llmobs/plugins/genai/index.js +5 -1
- package/packages/dd-trace/src/llmobs/plugins/genai/util.js +81 -16
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +3 -2
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +3 -2
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/embedding.js +2 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +1 -50
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/vectorstore.js +2 -1
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +14 -8
- package/packages/dd-trace/src/llmobs/plugins/langchain/messages.js +76 -0
- package/packages/dd-trace/src/llmobs/plugins/langgraph/index.js +4 -29
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/index.js +68 -0
- package/packages/dd-trace/src/llmobs/plugins/modelcontextprotocol-sdk/utils.js +57 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/constants.js +8 -0
- package/packages/dd-trace/src/llmobs/plugins/openai/index.js +68 -64
- package/packages/dd-trace/src/llmobs/plugins/openai/utils.js +43 -0
- package/packages/dd-trace/src/llmobs/sdk.js +73 -35
- package/packages/dd-trace/src/llmobs/span_processor.js +90 -11
- package/packages/dd-trace/src/llmobs/tagger.js +197 -4
- package/packages/dd-trace/src/llmobs/telemetry.js +33 -2
- package/packages/dd-trace/src/llmobs/util.js +234 -9
- package/packages/dd-trace/src/llmobs/writers/base.js +11 -5
- package/packages/dd-trace/src/llmobs/writers/spans.js +1 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -2
- package/packages/dd-trace/src/log/index.js +19 -31
- package/packages/dd-trace/src/log/writer.js +3 -1
- package/packages/dd-trace/src/msgpack/chunk.js +430 -11
- package/packages/dd-trace/src/msgpack/index.js +101 -2
- package/packages/dd-trace/src/noop/proxy.js +5 -4
- package/packages/dd-trace/src/noop/span.js +3 -1
- package/packages/dd-trace/src/openfeature/agentless_configuration_source.js +322 -0
- package/packages/dd-trace/src/openfeature/configuration_source.js +90 -0
- package/packages/dd-trace/src/openfeature/encoding.js +70 -0
- package/packages/dd-trace/src/openfeature/eval-metrics-hook.js +103 -0
- package/packages/dd-trace/src/openfeature/flagging_provider.js +32 -16
- package/packages/dd-trace/src/openfeature/index.js +0 -2
- package/packages/dd-trace/src/openfeature/noop.js +41 -64
- package/packages/dd-trace/src/openfeature/register.js +35 -0
- package/packages/dd-trace/src/openfeature/remote_config.js +16 -14
- package/packages/dd-trace/src/openfeature/require-provider.js +18 -0
- package/packages/dd-trace/src/openfeature/span-enrichment-hook.js +143 -0
- package/packages/dd-trace/src/openfeature/span-enrichment.js +149 -0
- package/packages/dd-trace/src/openfeature/writers/base.js +3 -11
- package/packages/dd-trace/src/openfeature/writers/exposures.js +82 -70
- package/packages/dd-trace/src/openfeature/writers/util.js +1 -2
- package/packages/dd-trace/src/opentelemetry/active-span-proxy.js +42 -0
- package/packages/dd-trace/src/opentelemetry/bridge-span-base.js +107 -0
- package/packages/dd-trace/src/opentelemetry/context_manager.js +27 -13
- package/packages/dd-trace/src/opentelemetry/logs/index.js +6 -6
- package/packages/dd-trace/src/opentelemetry/logs/otlp_http_log_exporter.js +3 -2
- package/packages/dd-trace/src/opentelemetry/metrics/index.js +61 -12
- package/packages/dd-trace/src/opentelemetry/metrics/instruments.js +28 -14
- package/packages/dd-trace/src/opentelemetry/metrics/meter.js +7 -10
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_http_metric_exporter.js +3 -2
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_exporter.js +40 -0
- package/packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js +169 -0
- package/packages/dd-trace/src/opentelemetry/metrics/periodic_metric_reader.js +99 -5
- package/packages/dd-trace/src/opentelemetry/metrics/time.js +19 -0
- package/packages/dd-trace/src/opentelemetry/otlp/common.proto +2 -2
- package/packages/dd-trace/src/opentelemetry/otlp/logs.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/logs_service.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/metrics.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/metrics_service.proto +1 -1
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_http_exporter_base.js +56 -82
- package/packages/dd-trace/src/opentelemetry/otlp/otlp_transformer_base.js +1 -2
- package/packages/dd-trace/src/opentelemetry/otlp/protobuf_loader.js +14 -2
- package/packages/dd-trace/src/opentelemetry/otlp/trace.proto +358 -0
- package/packages/dd-trace/src/opentelemetry/otlp/trace_service.proto +78 -0
- package/packages/dd-trace/src/opentelemetry/span-ending-hook.js +10 -0
- package/packages/dd-trace/src/opentelemetry/span-helpers.js +325 -0
- package/packages/dd-trace/src/opentelemetry/span.js +64 -109
- package/packages/dd-trace/src/opentelemetry/span_context.js +1 -0
- package/packages/dd-trace/src/opentelemetry/span_processor.js +7 -5
- package/packages/dd-trace/src/opentelemetry/trace/index.js +75 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_http_trace_exporter.js +75 -0
- package/packages/dd-trace/src/opentelemetry/trace/otlp_transformer.js +375 -0
- package/packages/dd-trace/src/opentelemetry/tracer.js +20 -69
- package/packages/dd-trace/src/opentelemetry/tracer_provider.js +33 -17
- package/packages/dd-trace/src/opentracing/propagation/log.js +28 -8
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +278 -148
- package/packages/dd-trace/src/opentracing/propagation/text_map_dsm.js +11 -11
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +98 -32
- package/packages/dd-trace/src/opentracing/span.js +127 -73
- package/packages/dd-trace/src/opentracing/span_context.js +68 -3
- package/packages/dd-trace/src/opentracing/tracer.js +46 -19
- package/packages/dd-trace/src/payload-tagging/config/index.js +2 -2
- package/packages/dd-trace/src/plugin_manager.js +36 -14
- package/packages/dd-trace/src/plugins/apollo.js +3 -1
- package/packages/dd-trace/src/plugins/ci_plugin.js +407 -91
- package/packages/dd-trace/src/plugins/database.js +61 -18
- package/packages/dd-trace/src/plugins/index.js +14 -0
- package/packages/dd-trace/src/plugins/log_injection.js +56 -0
- package/packages/dd-trace/src/plugins/log_plugin.js +4 -44
- package/packages/dd-trace/src/plugins/outbound.js +1 -1
- package/packages/dd-trace/src/plugins/plugin.js +19 -28
- package/packages/dd-trace/src/plugins/storage.js +2 -2
- package/packages/dd-trace/src/plugins/tracing.js +70 -13
- package/packages/dd-trace/src/plugins/util/ci.js +127 -40
- package/packages/dd-trace/src/plugins/util/git-cache.js +23 -23
- package/packages/dd-trace/src/plugins/util/git.js +6 -3
- package/packages/dd-trace/src/plugins/util/http-otel-semantics.js +276 -0
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +29 -5
- package/packages/dd-trace/src/plugins/util/llm.js +6 -1
- package/packages/dd-trace/src/plugins/util/stacktrace.js +2 -2
- package/packages/dd-trace/src/plugins/util/test.js +950 -69
- package/packages/dd-trace/src/plugins/util/url.js +71 -5
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +18 -16
- package/packages/dd-trace/src/plugins/util/web.js +116 -180
- package/packages/dd-trace/src/priority_sampler.js +12 -21
- package/packages/dd-trace/src/profiling/config.js +132 -212
- package/packages/dd-trace/src/profiling/constants.js +4 -7
- package/packages/dd-trace/src/profiling/exporter_cli.js +10 -10
- package/packages/dd-trace/src/profiling/exporters/agent.js +61 -28
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +45 -14
- package/packages/dd-trace/src/profiling/exporters/file.js +16 -5
- package/packages/dd-trace/src/profiling/oom.js +71 -0
- package/packages/dd-trace/src/profiling/profiler.js +84 -105
- package/packages/dd-trace/src/profiling/profilers/event_plugins/crypto.js +32 -0
- package/packages/dd-trace/src/profiling/profilers/event_plugins/zlib.js +19 -0
- package/packages/dd-trace/src/profiling/profilers/events.js +57 -13
- package/packages/dd-trace/src/profiling/profilers/space.js +27 -16
- package/packages/dd-trace/src/profiling/profilers/wall.js +49 -35
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +3 -3
- package/packages/dd-trace/src/propagation-hash/index.js +1 -1
- package/packages/dd-trace/src/proxy.js +128 -37
- package/packages/dd-trace/src/rate_limiter.js +1 -1
- package/packages/dd-trace/src/remote_config/index.js +6 -5
- package/packages/dd-trace/src/remote_config/scheduler.js +1 -1
- package/packages/dd-trace/src/ritm.js +6 -3
- package/packages/dd-trace/src/runtime_metrics/client.js +30 -0
- package/packages/dd-trace/src/runtime_metrics/index.js +14 -4
- package/packages/dd-trace/src/runtime_metrics/otlp_runtime_metrics.js +284 -0
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +42 -41
- package/packages/dd-trace/src/sampling_rule.js +7 -7
- package/packages/dd-trace/src/scope.js +10 -15
- package/packages/dd-trace/src/serverless.js +6 -7
- package/packages/dd-trace/src/service-naming/extra-services.js +14 -0
- package/packages/dd-trace/src/service-naming/index.js +1 -1
- package/packages/dd-trace/src/service-naming/schemas/definition.js +4 -1
- package/packages/dd-trace/src/service-naming/schemas/util.js +48 -3
- package/packages/dd-trace/src/service-naming/schemas/v0/graphql.js +6 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/messaging.js +61 -2
- package/packages/dd-trace/src/service-naming/schemas/v0/serverless.js +12 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +60 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +25 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/websocket.js +5 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/graphql.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/messaging.js +32 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/serverless.js +12 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +17 -0
- package/packages/dd-trace/src/service-naming/schemas/v1/web.js +23 -3
- package/packages/dd-trace/src/service-naming/schemas/v1/websocket.js +6 -0
- package/packages/dd-trace/src/service-naming/source-resolver.js +50 -0
- package/packages/dd-trace/src/span_format.js +269 -81
- package/packages/dd-trace/src/span_processor.js +18 -13
- package/packages/dd-trace/src/span_stats.js +101 -79
- package/packages/dd-trace/src/spanleak.js +1 -2
- package/packages/dd-trace/src/standalone/index.js +0 -36
- package/packages/dd-trace/src/startup-log.js +3 -3
- package/packages/dd-trace/src/tagger.js +2 -4
- package/packages/dd-trace/src/telemetry/dependencies.js +2 -2
- package/packages/dd-trace/src/telemetry/endpoints.js +7 -5
- package/packages/dd-trace/src/telemetry/index.js +2 -2
- package/packages/dd-trace/src/telemetry/logs/index.js +1 -1
- package/packages/dd-trace/src/telemetry/send-data.js +22 -22
- package/packages/dd-trace/src/telemetry/session-propagation.js +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +16 -14
- package/packages/dd-trace/src/tracer.js +23 -9
- package/packages/dd-trace/src/tracer_metadata.js +1 -1
- package/packages/dd-trace/src/util.js +57 -0
- package/register.js +58 -1
- package/vendor/dist/@apm-js-collab/code-transformer/index.js +94 -42
- package/vendor/dist/@datadog/sketches-js/LICENSE +10 -36
- package/vendor/dist/@datadog/sketches-js/index.js +1 -1
- package/vendor/dist/pprof-format/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
- package/packages/datadog-plugin-graphql/src/resolve.js +0 -178
- package/packages/dd-trace/src/agent/url.js +0 -28
- package/packages/dd-trace/src/appsec/api_security_sampler.js +0 -117
- package/packages/dd-trace/src/lambda/runtime/ritm.js +0 -133
- package/packages/dd-trace/src/log/utils.js +0 -16
- package/packages/dd-trace/src/msgpack/encoder.js +0 -308
- package/packages/dd-trace/src/plugins/structured_log_plugin.js +0 -9
- package/scripts/preinstall.js +0 -34
- package/vendor/dist/ignore/LICENSE +0 -21
- package/vendor/dist/ignore/index.js +0 -1
- package/vendor/dist/opentracing/LICENSE +0 -201
- package/vendor/dist/opentracing/binary_carrier.d.ts +0 -11
- package/vendor/dist/opentracing/constants.d.ts +0 -61
- package/vendor/dist/opentracing/examples/demo/demo.d.ts +0 -2
- package/vendor/dist/opentracing/ext/tags.d.ts +0 -90
- package/vendor/dist/opentracing/functions.d.ts +0 -20
- package/vendor/dist/opentracing/global_tracer.d.ts +0 -14
- package/vendor/dist/opentracing/index.d.ts +0 -12
- package/vendor/dist/opentracing/index.js +0 -1
- package/vendor/dist/opentracing/mock_tracer/index.d.ts +0 -5
- package/vendor/dist/opentracing/mock_tracer/mock_context.d.ts +0 -13
- package/vendor/dist/opentracing/mock_tracer/mock_report.d.ts +0 -16
- package/vendor/dist/opentracing/mock_tracer/mock_span.d.ts +0 -50
- package/vendor/dist/opentracing/mock_tracer/mock_tracer.d.ts +0 -26
- package/vendor/dist/opentracing/noop.d.ts +0 -8
- package/vendor/dist/opentracing/reference.d.ts +0 -33
- package/vendor/dist/opentracing/span.d.ts +0 -147
- package/vendor/dist/opentracing/span_context.d.ts +0 -26
- package/vendor/dist/opentracing/test/api_compatibility.d.ts +0 -16
- package/vendor/dist/opentracing/test/mocktracer_implemenation.d.ts +0 -3
- package/vendor/dist/opentracing/test/noop_implementation.d.ts +0 -4
- package/vendor/dist/opentracing/test/opentracing_api.d.ts +0 -3
- package/vendor/dist/opentracing/test/unittest.d.ts +0 -2
- package/vendor/dist/opentracing/tracer.d.ts +0 -127
- package/vendor/dist/path-to-regexp/LICENSE +0 -21
- package/vendor/dist/path-to-regexp/index.js +0 -1
|
@@ -2,57 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
const ServerPlugin = require('../../dd-trace/src/plugins/server')
|
|
4
4
|
const { storage } = require('../../datadog-core')
|
|
5
|
+
const { withRequest } = require('../../dd-trace/src/appsec/store')
|
|
5
6
|
const web = require('../../dd-trace/src/plugins/util/web')
|
|
6
7
|
const { incomingHttpRequestStart, incomingHttpRequestEnd } = require('../../dd-trace/src/appsec/channels')
|
|
7
|
-
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
8
|
+
const { COMPONENT, SVC_SRC_KEY } = require('../../dd-trace/src/constants')
|
|
9
|
+
|
|
10
|
+
const legacyStorage = storage('legacy')
|
|
8
11
|
|
|
9
12
|
class HttpServerPlugin extends ServerPlugin {
|
|
10
13
|
static id = 'http'
|
|
11
14
|
|
|
12
15
|
static prefix = 'apm:http:server:request'
|
|
13
16
|
|
|
17
|
+
/** @type {string | undefined} */
|
|
18
|
+
#operationName
|
|
19
|
+
|
|
20
|
+
/** @type {object | undefined} */
|
|
21
|
+
#startConfig
|
|
22
|
+
|
|
23
|
+
/** @type {string | undefined} */
|
|
24
|
+
#serviceSource
|
|
25
|
+
|
|
14
26
|
constructor (...args) {
|
|
15
27
|
super(...args)
|
|
16
28
|
this.addTraceSub('exit', message => this.exit(message))
|
|
17
29
|
}
|
|
18
30
|
|
|
19
|
-
start (
|
|
20
|
-
|
|
31
|
+
start (ctx) {
|
|
32
|
+
const { req, res } = ctx
|
|
33
|
+
let store = legacyStorage.getStore()
|
|
34
|
+
if (this.#startConfig === undefined) {
|
|
35
|
+
this.#refreshStartCache()
|
|
36
|
+
}
|
|
37
|
+
// A fresh request has no span yet; web.startSpan creates and enters one.
|
|
38
|
+
// A reused context (HTTP/2 stream, serverless re-entry) returns the
|
|
39
|
+
// existing span without entering, so the explicit enter below is the only
|
|
40
|
+
// one in that case.
|
|
41
|
+
const spanCreated = !web.getContext(req)?.span
|
|
21
42
|
const span = web.startSpan(
|
|
22
43
|
this.tracer,
|
|
23
|
-
|
|
24
|
-
...this.config,
|
|
25
|
-
service: this.config.service || this.serviceName(),
|
|
26
|
-
},
|
|
44
|
+
this.#startConfig,
|
|
27
45
|
req,
|
|
28
46
|
res,
|
|
29
|
-
this
|
|
47
|
+
this.#operationName
|
|
30
48
|
)
|
|
49
|
+
if (this.#serviceSource !== undefined) {
|
|
50
|
+
span.setTag(SVC_SRC_KEY, this.#serviceSource)
|
|
51
|
+
}
|
|
31
52
|
span.setTag(COMPONENT, this.constructor.id)
|
|
32
53
|
span._integrationName = this.constructor.id
|
|
33
54
|
|
|
34
55
|
const context = web.getContext(req)
|
|
56
|
+
context.parentStore = store
|
|
35
57
|
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
const appsecActive = incomingHttpRequestStart.hasSubscribers
|
|
59
|
+
if (appsecActive) {
|
|
60
|
+
// AppSec, IAST, and AI Guard need req on the store so downstream
|
|
61
|
+
// subscribers can access them from the async context.
|
|
62
|
+
store = withRequest(store, req)
|
|
38
63
|
}
|
|
39
64
|
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
if (
|
|
44
|
-
|
|
65
|
+
// Skip the re-enter when web.startSpan already entered { ...store, span }
|
|
66
|
+
// and AppSec did not rebuild the store with req: the bind would be
|
|
67
|
+
// identical to the one startSpan just made.
|
|
68
|
+
if (!spanCreated || appsecActive) {
|
|
69
|
+
this.enter(span, store)
|
|
45
70
|
}
|
|
46
71
|
|
|
47
|
-
this.enter(span, store)
|
|
48
|
-
|
|
49
72
|
if (!context.instrumented) {
|
|
50
73
|
context.res.writeHead = web.wrapWriteHead(context)
|
|
51
74
|
context.instrumented = true
|
|
52
75
|
}
|
|
53
76
|
|
|
54
|
-
if (
|
|
55
|
-
|
|
77
|
+
if (appsecActive) {
|
|
78
|
+
// Reuse the ctx allocated by the HTTP server instrumentation rather
|
|
79
|
+
// than a fresh `{ req, res, abortController }` per request; the AppSec
|
|
80
|
+
// subscriber only reads from the message.
|
|
81
|
+
incomingHttpRequestStart.publish(ctx)
|
|
56
82
|
}
|
|
57
83
|
}
|
|
58
84
|
|
|
@@ -85,7 +111,24 @@ class HttpServerPlugin extends ServerPlugin {
|
|
|
85
111
|
}
|
|
86
112
|
|
|
87
113
|
configure (config) {
|
|
88
|
-
|
|
114
|
+
const result = super.configure(web.normalizeConfig(config))
|
|
115
|
+
// Invalidate the start-cache; the next `start` refills it. Resolving
|
|
116
|
+
// service / operation eagerly here would pin nomenclature lookups to
|
|
117
|
+
// the order plugins and tracer initialise.
|
|
118
|
+
this.#startConfig = undefined
|
|
119
|
+
return result
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#refreshStartCache () {
|
|
123
|
+
const { name: schemaServiceName, source: schemaServiceSource } = this.serviceName()
|
|
124
|
+
const tracerService = this.tracer._service
|
|
125
|
+
const configService = this.config.service
|
|
126
|
+
const service = configService || schemaServiceName
|
|
127
|
+
this.#serviceSource = (configService && service !== tracerService)
|
|
128
|
+
? 'opt.plugin'
|
|
129
|
+
: (service === tracerService ? undefined : schemaServiceSource)
|
|
130
|
+
this.#operationName = this.operationName()
|
|
131
|
+
this.#startConfig = { ...this.config, service }
|
|
89
132
|
}
|
|
90
133
|
}
|
|
91
134
|
|
|
@@ -10,6 +10,7 @@ const kinds = require('../../../ext/kinds')
|
|
|
10
10
|
const formats = require('../../../ext/formats')
|
|
11
11
|
const { COMPONENT, CLIENT_PORT_KEY } = require('../../dd-trace/src/constants')
|
|
12
12
|
const urlFilter = require('../../dd-trace/src/plugins/util/urlfilter')
|
|
13
|
+
const { buildClientHttpUrl } = require('../../dd-trace/src/plugins/util/url')
|
|
13
14
|
|
|
14
15
|
const HTTP_HEADERS = formats.HTTP_HEADERS
|
|
15
16
|
const HTTP_STATUS_CODE = tags.HTTP_STATUS_CODE
|
|
@@ -31,24 +32,26 @@ class Http2ClientPlugin extends ClientPlugin {
|
|
|
31
32
|
const { authority, options, headers = {} } = message
|
|
32
33
|
const sessionDetails = extractSessionDetails(authority, options)
|
|
33
34
|
const path = headers[HTTP2_HEADER_PATH] || '/'
|
|
34
|
-
const pathname = path.split(/[?#]
|
|
35
|
+
const pathname = path.split(/[?#]/, 1)[0]
|
|
35
36
|
const method = headers[HTTP2_HEADER_METHOD] || HTTP2_METHOD_GET
|
|
36
|
-
const
|
|
37
|
+
const base = `${sessionDetails.protocol}//${sessionDetails.host}:${sessionDetails.port}`
|
|
38
|
+
const uri = `${base}${pathname}`
|
|
37
39
|
const allowed = this.config.filter(uri)
|
|
40
|
+
const otelSemantics = this.config.DD_TRACE_OTEL_SEMANTICS_ENABLED
|
|
38
41
|
|
|
39
42
|
const store = storage('legacy').getStore()
|
|
40
43
|
const childOf = store && allowed ? store.span : null
|
|
41
44
|
const span = this.startSpan(this.operationName(), {
|
|
42
45
|
childOf,
|
|
43
46
|
integrationName: this.constructor.id,
|
|
47
|
+
service: this.serviceName({ pluginConfig: this.config, sessionDetails }),
|
|
44
48
|
meta: {
|
|
45
49
|
[COMPONENT]: this.constructor.id,
|
|
46
50
|
[SPAN_KIND]: CLIENT,
|
|
47
|
-
'service.name': this.serviceName({ pluginConfig: this.config, sessionDetails }),
|
|
48
51
|
'resource.name': method,
|
|
49
52
|
'span.type': 'http',
|
|
50
53
|
'http.method': method,
|
|
51
|
-
'http.url': uri,
|
|
54
|
+
'http.url': otelSemantics ? buildClientHttpUrl(this.config, base, path, uri) : uri,
|
|
52
55
|
'out.host': sessionDetails.host,
|
|
53
56
|
},
|
|
54
57
|
metrics: {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
// Plugin temporarily disabled. See https://github.com/DataDog/dd-trace-js/issues/312
|
|
4
|
-
|
|
5
3
|
const ServerPlugin = require('../../dd-trace/src/plugins/server')
|
|
6
4
|
const web = require('../../dd-trace/src/plugins/util/web')
|
|
7
|
-
const { COMPONENT } = require('../../dd-trace/src/constants')
|
|
5
|
+
const { COMPONENT, SVC_SRC_KEY } = require('../../dd-trace/src/constants')
|
|
8
6
|
|
|
9
7
|
class Http2ServerPlugin extends ServerPlugin {
|
|
10
8
|
constructor (tracer, config) {
|
|
11
9
|
super(tracer, config)
|
|
12
10
|
this.addBind('apm:http2:server:response:emit', this.bindEmit)
|
|
11
|
+
this.addSub('apm:http2:server:request:adopt', this.adopt)
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
static id = 'http2'
|
|
@@ -19,17 +18,25 @@ class Http2ServerPlugin extends ServerPlugin {
|
|
|
19
18
|
bindStart (ctx) {
|
|
20
19
|
const { req, res } = ctx
|
|
21
20
|
|
|
21
|
+
const { name: schemaServiceName, source: schemaServiceSource } = this.serviceName()
|
|
22
|
+
const service = this.config.service || schemaServiceName
|
|
23
|
+
const serviceSource = (this.config.service && service !== this.tracer._service)
|
|
24
|
+
? 'opt.plugin'
|
|
25
|
+
: (service === this.tracer._service ? undefined : schemaServiceSource)
|
|
22
26
|
const span = web.startSpan(
|
|
23
27
|
this.tracer,
|
|
24
28
|
{
|
|
25
29
|
...this.config,
|
|
26
|
-
service
|
|
30
|
+
service,
|
|
27
31
|
},
|
|
28
32
|
req,
|
|
29
33
|
res,
|
|
30
34
|
this.operationName(),
|
|
31
35
|
ctx
|
|
32
36
|
)
|
|
37
|
+
if (serviceSource !== undefined) {
|
|
38
|
+
span.setTag(SVC_SRC_KEY, serviceSource)
|
|
39
|
+
}
|
|
33
40
|
|
|
34
41
|
span.setTag(COMPONENT, this.constructor.id)
|
|
35
42
|
span._integrationName = this.constructor.id
|
|
@@ -39,15 +46,35 @@ class Http2ServerPlugin extends ServerPlugin {
|
|
|
39
46
|
|
|
40
47
|
const context = web.getContext(req)
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
// A mixed server adopts the real request off this stream later; key the
|
|
50
|
+
// context on the stream now so that lookup resolves. Skipped for the common
|
|
51
|
+
// single-listener request, which never adopts.
|
|
52
|
+
if (ctx.adoptable) web.linkContextToStream(req.stream, context)
|
|
53
|
+
|
|
54
|
+
instrumentWriteHead(context)
|
|
46
55
|
|
|
47
56
|
return ctx.currentStore
|
|
48
57
|
}
|
|
49
58
|
|
|
59
|
+
// A mixed server (raw-stream + 'request' listeners) creates the span from the
|
|
60
|
+
// 'stream' event with a throwaway adapter. When the compatibility layer then
|
|
61
|
+
// synthesizes the real request/response off the same stream, point the shared
|
|
62
|
+
// context at them so `web.setFramework`/`web.setRoute` from the user's
|
|
63
|
+
// 'request' handler resolve to this span and the finish `hooks.request`
|
|
64
|
+
// receives the real objects instead of the adapter.
|
|
65
|
+
adopt (ctx) {
|
|
66
|
+
const context = web.patch(ctx.req)
|
|
67
|
+
context.req = ctx.req
|
|
68
|
+
context.res = ctx.res
|
|
69
|
+
instrumentWriteHead(context)
|
|
70
|
+
}
|
|
71
|
+
|
|
50
72
|
bindEmit (ctx) {
|
|
73
|
+
// Both the compatibility response and the core-API stream emit 'close'
|
|
74
|
+
// exactly once, so the span is finished from a single source. `web.js`
|
|
75
|
+
// bypasses its `finished` idempotency guard for stream-backed requests
|
|
76
|
+
// (`!req.stream`); that bypass is harmless here only because of this
|
|
77
|
+
// single-finish property.
|
|
51
78
|
if (ctx.eventName !== 'close') return ctx.currentStore
|
|
52
79
|
|
|
53
80
|
const { req } = ctx
|
|
@@ -70,4 +97,17 @@ class Http2ServerPlugin extends ServerPlugin {
|
|
|
70
97
|
}
|
|
71
98
|
}
|
|
72
99
|
|
|
100
|
+
// The core stream API has no `res.writeHead`; CORS preflight tagging only
|
|
101
|
+
// applies to the compatibility response that exposes it. Runs once per context:
|
|
102
|
+
// the mixed path calls it again from `adopt` once the real response is in place.
|
|
103
|
+
/**
|
|
104
|
+
* @param {{ res: { writeHead?: Function }, instrumented?: boolean }} context
|
|
105
|
+
*/
|
|
106
|
+
function instrumentWriteHead (context) {
|
|
107
|
+
if (!context.instrumented && typeof context.res.writeHead === 'function') {
|
|
108
|
+
context.res.writeHead = web.wrapWriteHead(context)
|
|
109
|
+
context.instrumented = true
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
73
113
|
module.exports = Http2ServerPlugin
|
|
@@ -5,7 +5,7 @@ const realSetTimeout = setTimeout
|
|
|
5
5
|
|
|
6
6
|
const CiPlugin = require('../../dd-trace/src/plugins/ci_plugin')
|
|
7
7
|
const { storage } = require('../../datadog-core')
|
|
8
|
-
const { getEnvironmentVariable
|
|
8
|
+
const { getEnvironmentVariable } = require('../../dd-trace/src/config/helper')
|
|
9
9
|
const { appClosing: appClosingTelemetry } = require('../../dd-trace/src/telemetry')
|
|
10
10
|
|
|
11
11
|
const {
|
|
@@ -16,11 +16,11 @@ const {
|
|
|
16
16
|
getTestSuiteCommonTags,
|
|
17
17
|
addIntelligentTestRunnerSpanTags,
|
|
18
18
|
TEST_PARAMETERS,
|
|
19
|
-
TEST_COMMAND,
|
|
20
19
|
TEST_FRAMEWORK_VERSION,
|
|
21
20
|
TEST_SOURCE_START,
|
|
22
21
|
TEST_ITR_UNSKIPPABLE,
|
|
23
22
|
TEST_ITR_FORCED_RUN,
|
|
23
|
+
TEST_ITR_SKIPPING_ENABLED,
|
|
24
24
|
TEST_CODE_OWNERS,
|
|
25
25
|
ITR_CORRELATION_ID,
|
|
26
26
|
TEST_SOURCE_FILE,
|
|
@@ -61,15 +61,6 @@ const isJestWorker = !!getEnvironmentVariable('JEST_WORKER_ID')
|
|
|
61
61
|
// https://github.com/facebook/jest/blob/d6ad15b0f88a05816c2fe034dd6900d28315d570/packages/jest-worker/src/types.ts#L38
|
|
62
62
|
const CHILD_MESSAGE_END = 2
|
|
63
63
|
|
|
64
|
-
function withTimeout (promise, timeoutMs) {
|
|
65
|
-
return new Promise(resolve => {
|
|
66
|
-
realSetTimeout(resolve, timeoutMs)
|
|
67
|
-
|
|
68
|
-
// Also resolve if the original promise resolves
|
|
69
|
-
promise.then(resolve)
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
|
|
73
64
|
class JestPlugin extends CiPlugin {
|
|
74
65
|
static id = 'jest'
|
|
75
66
|
|
|
@@ -107,13 +98,16 @@ class JestPlugin extends CiPlugin {
|
|
|
107
98
|
process.on('message', handler)
|
|
108
99
|
}
|
|
109
100
|
this.testSuiteSpanPerTestSuiteAbsolutePath = new Map()
|
|
101
|
+
this.pendingTestSuiteFinishes = new Set()
|
|
110
102
|
|
|
111
103
|
this.addSub('ci:jest:session:finish', ({
|
|
112
104
|
status,
|
|
113
105
|
isSuitesSkipped,
|
|
114
106
|
isSuitesSkippingEnabled,
|
|
115
107
|
isCodeCoverageEnabled,
|
|
108
|
+
isCoverageReportUploadEnabled,
|
|
116
109
|
testCodeCoverageLinesTotal,
|
|
110
|
+
testSessionCoverageFiles,
|
|
117
111
|
numSkippedSuites,
|
|
118
112
|
hasUnskippableSuites,
|
|
119
113
|
hasForcedToRunSuites,
|
|
@@ -123,58 +117,73 @@ class JestPlugin extends CiPlugin {
|
|
|
123
117
|
isTestManagementTestsEnabled,
|
|
124
118
|
onDone,
|
|
125
119
|
}) => {
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
const finishSession = () => {
|
|
121
|
+
this.testSessionSpan.setTag(TEST_STATUS, status)
|
|
122
|
+
this.testModuleSpan.setTag(TEST_STATUS, status)
|
|
128
123
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
addIntelligentTestRunnerSpanTags(
|
|
135
|
-
this.testSessionSpan,
|
|
136
|
-
this.testModuleSpan,
|
|
137
|
-
{
|
|
138
|
-
isSuitesSkipped,
|
|
139
|
-
isSuitesSkippingEnabled,
|
|
140
|
-
isCodeCoverageEnabled,
|
|
141
|
-
testCodeCoverageLinesTotal,
|
|
142
|
-
skippingType: 'suite',
|
|
143
|
-
skippingCount: numSkippedSuites,
|
|
144
|
-
hasUnskippableSuites,
|
|
145
|
-
hasForcedToRunSuites,
|
|
124
|
+
if (error) {
|
|
125
|
+
this.testSessionSpan.setTag('error', error)
|
|
126
|
+
this.testModuleSpan.setTag('error', error)
|
|
146
127
|
}
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
if (isEarlyFlakeDetectionEnabled) {
|
|
150
|
-
this.testSessionSpan.setTag(TEST_EARLY_FLAKE_ENABLED, 'true')
|
|
151
|
-
}
|
|
152
|
-
if (isEarlyFlakeDetectionFaulty) {
|
|
153
|
-
this.testSessionSpan.setTag(TEST_EARLY_FLAKE_ABORT_REASON, 'faulty')
|
|
154
|
-
}
|
|
155
|
-
if (isTestManagementTestsEnabled) {
|
|
156
|
-
this.testSessionSpan.setTag(TEST_MANAGEMENT_ENABLED, 'true')
|
|
157
|
-
}
|
|
158
128
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
129
|
+
addIntelligentTestRunnerSpanTags(
|
|
130
|
+
this.testSessionSpan,
|
|
131
|
+
this.testModuleSpan,
|
|
132
|
+
{
|
|
133
|
+
isSuitesSkipped,
|
|
134
|
+
isSuitesSkippingEnabled,
|
|
135
|
+
isCodeCoverageEnabled,
|
|
136
|
+
testCodeCoverageLinesTotal,
|
|
137
|
+
skippingType: 'suite',
|
|
138
|
+
skippingCount: numSkippedSuites,
|
|
139
|
+
hasUnskippableSuites,
|
|
140
|
+
hasForcedToRunSuites,
|
|
141
|
+
}
|
|
142
|
+
)
|
|
166
143
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
144
|
+
if (testSessionCoverageFiles?.length && isCoverageReportUploadEnabled) {
|
|
145
|
+
this.tracer._exporter.exportCoverage({
|
|
146
|
+
sessionId: this.testSessionSpan.context()._traceId,
|
|
147
|
+
files: testSessionCoverageFiles,
|
|
148
|
+
})
|
|
149
|
+
}
|
|
171
150
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (onDone) {
|
|
175
|
-
onDone()
|
|
151
|
+
if (isEarlyFlakeDetectionEnabled) {
|
|
152
|
+
this.testSessionSpan.setTag(TEST_EARLY_FLAKE_ENABLED, 'true')
|
|
176
153
|
}
|
|
177
|
-
|
|
154
|
+
if (isEarlyFlakeDetectionFaulty) {
|
|
155
|
+
this.testSessionSpan.setTag(TEST_EARLY_FLAKE_ABORT_REASON, 'faulty')
|
|
156
|
+
}
|
|
157
|
+
if (isTestManagementTestsEnabled) {
|
|
158
|
+
this.testSessionSpan.setTag(TEST_MANAGEMENT_ENABLED, 'true')
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
this.testModuleSpan.finish()
|
|
162
|
+
this.telemetry.ciVisEvent(TELEMETRY_EVENT_FINISHED, 'module')
|
|
163
|
+
this.testSessionSpan.finish()
|
|
164
|
+
this.telemetry.ciVisEvent(TELEMETRY_EVENT_FINISHED, 'session', {
|
|
165
|
+
hasFailedTestReplay: this.libraryConfig?.isDiEnabled || undefined,
|
|
166
|
+
})
|
|
167
|
+
finishAllTraceSpans(this.testSessionSpan)
|
|
168
|
+
|
|
169
|
+
this.telemetry.count(TELEMETRY_TEST_SESSION, {
|
|
170
|
+
provider: this.ciProviderName,
|
|
171
|
+
autoInjected: !!this._tracerConfig.testOptimization.DD_CIVISIBILITY_AUTO_INSTRUMENTATION_PROVIDER,
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
appClosingTelemetry()
|
|
175
|
+
this.tracer._exporter.flush(() => {
|
|
176
|
+
if (onDone) {
|
|
177
|
+
onDone()
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (this.pendingTestSuiteFinishes.size > 0) {
|
|
183
|
+
Promise.all(this.pendingTestSuiteFinishes).then(finishSession)
|
|
184
|
+
} else {
|
|
185
|
+
finishSession()
|
|
186
|
+
}
|
|
178
187
|
})
|
|
179
188
|
|
|
180
189
|
// Test suites can be run in a different process from jest's main one.
|
|
@@ -184,7 +193,7 @@ class JestPlugin extends CiPlugin {
|
|
|
184
193
|
for (const config of configs) {
|
|
185
194
|
config._ddTestSessionId = this.testSessionSpan.context().toTraceId()
|
|
186
195
|
config._ddTestModuleId = this.testModuleSpan.context().toSpanId()
|
|
187
|
-
config._ddTestCommand = this.
|
|
196
|
+
config._ddTestCommand = this.command
|
|
188
197
|
config._ddRequestErrorTags = this.getSessionRequestErrorTags()
|
|
189
198
|
config._ddItrCorrelationId = this.itrCorrelationId
|
|
190
199
|
config._ddIsEarlyFlakeDetectionEnabled = !!this.libraryConfig?.isEarlyFlakeDetectionEnabled
|
|
@@ -197,6 +206,7 @@ class JestPlugin extends CiPlugin {
|
|
|
197
206
|
config._ddIsDiEnabled = this.libraryConfig?.isDiEnabled ?? false
|
|
198
207
|
config._ddIsKnownTestsEnabled = this.libraryConfig?.isKnownTestsEnabled ?? false
|
|
199
208
|
config._ddIsImpactedTestsEnabled = this.libraryConfig?.isImpactedTestsEnabled ?? false
|
|
209
|
+
config._ddItrSkippingEnabledTags = this.getSessionItrSkippingEnabledTags()
|
|
200
210
|
}
|
|
201
211
|
})
|
|
202
212
|
|
|
@@ -217,6 +227,7 @@ class JestPlugin extends CiPlugin {
|
|
|
217
227
|
_ddForcedToRun,
|
|
218
228
|
_ddUnskippable,
|
|
219
229
|
_ddTestCodeCoverageEnabled,
|
|
230
|
+
_ddItrSkippingEnabledTags: itrSkippingEnabledTags,
|
|
220
231
|
} = testEnvironmentOptions
|
|
221
232
|
|
|
222
233
|
const testSessionSpanContext = this.tracer.extract('text_map', {
|
|
@@ -228,6 +239,7 @@ class JestPlugin extends CiPlugin {
|
|
|
228
239
|
...getTestSuiteCommonTags(testCommand, frameworkVersion, testSuite, 'jest'),
|
|
229
240
|
// requestErrorTags from test env options may be undefined
|
|
230
241
|
...(requestErrorTags !== undefined && requestErrorTags !== null ? requestErrorTags : {}),
|
|
242
|
+
...(itrSkippingEnabledTags !== undefined && itrSkippingEnabledTags !== null ? itrSkippingEnabledTags : {}),
|
|
231
243
|
}
|
|
232
244
|
|
|
233
245
|
if (_ddUnskippable) {
|
|
@@ -305,10 +317,18 @@ class JestPlugin extends CiPlugin {
|
|
|
305
317
|
}
|
|
306
318
|
})
|
|
307
319
|
|
|
308
|
-
this.addSub('ci:jest:test-suite:finish', ({
|
|
320
|
+
this.addSub('ci:jest:test-suite:finish', ({
|
|
321
|
+
status,
|
|
322
|
+
errorMessage,
|
|
323
|
+
error,
|
|
324
|
+
testSuiteAbsolutePath,
|
|
325
|
+
waitForFinish,
|
|
326
|
+
onDone,
|
|
327
|
+
}) => {
|
|
309
328
|
const testSuiteSpan = this.testSuiteSpanPerTestSuiteAbsolutePath.get(testSuiteAbsolutePath)
|
|
310
329
|
if (!testSuiteSpan) {
|
|
311
330
|
log.warn('"ci:jest:test-suite:finish": no span found for test suite absolute path %s', testSuiteAbsolutePath)
|
|
331
|
+
onDone?.()
|
|
312
332
|
return
|
|
313
333
|
}
|
|
314
334
|
testSuiteSpan.setTag(TEST_STATUS, status)
|
|
@@ -319,8 +339,13 @@ class JestPlugin extends CiPlugin {
|
|
|
319
339
|
testSuiteSpan.setTag('error', new Error(errorMessage))
|
|
320
340
|
testSuiteSpan.setTag(TEST_STATUS, 'fail')
|
|
321
341
|
}
|
|
322
|
-
|
|
323
|
-
|
|
342
|
+
let resolvePendingFinish
|
|
343
|
+
const pendingFinish = new Promise(resolve => {
|
|
344
|
+
resolvePendingFinish = resolve
|
|
345
|
+
})
|
|
346
|
+
this.pendingTestSuiteFinishes.add(pendingFinish)
|
|
347
|
+
|
|
348
|
+
const finish = () => {
|
|
324
349
|
testSuiteSpan.finish()
|
|
325
350
|
this.telemetry.ciVisEvent(TELEMETRY_EVENT_FINISHED, 'suite')
|
|
326
351
|
// Suites potentially run in a different process than the session,
|
|
@@ -334,7 +359,19 @@ class JestPlugin extends CiPlugin {
|
|
|
334
359
|
}
|
|
335
360
|
this.removeAllDiProbes()
|
|
336
361
|
this.testSuiteSpanPerTestSuiteAbsolutePath.delete(testSuiteAbsolutePath)
|
|
337
|
-
|
|
362
|
+
this.pendingTestSuiteFinishes.delete(pendingFinish)
|
|
363
|
+
resolvePendingFinish()
|
|
364
|
+
if (onDone) {
|
|
365
|
+
onDone()
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (waitForFinish) {
|
|
370
|
+
// Give late async work time to run before Jest restarts a worker because of workerIdleMemoryLimit.
|
|
371
|
+
realSetTimeout(finish)
|
|
372
|
+
} else {
|
|
373
|
+
process.nextTick(finish)
|
|
374
|
+
}
|
|
338
375
|
})
|
|
339
376
|
|
|
340
377
|
this.addSub('ci:jest:test-suite:error', ({ error, errorMessage, testSuiteAbsolutePath }) => {
|
|
@@ -405,6 +442,7 @@ class JestPlugin extends CiPlugin {
|
|
|
405
442
|
isAtrRetry,
|
|
406
443
|
finalStatus,
|
|
407
444
|
earlyFlakeAbortReason,
|
|
445
|
+
promises,
|
|
408
446
|
}) => {
|
|
409
447
|
span.setTag(TEST_STATUS, status)
|
|
410
448
|
if (finalStatus) {
|
|
@@ -435,12 +473,33 @@ class JestPlugin extends CiPlugin {
|
|
|
435
473
|
this.getTestTelemetryTags(span)
|
|
436
474
|
)
|
|
437
475
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
476
|
+
const finish = () => {
|
|
477
|
+
span.finish()
|
|
478
|
+
finishAllTraceSpans(span)
|
|
479
|
+
this.activeTestSpan = null
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (finalStatus) {
|
|
483
|
+
if (promises?.hitBreakpointPromise) {
|
|
484
|
+
finish()
|
|
485
|
+
this.cancelDiBreakpointHitWait()
|
|
486
|
+
return
|
|
487
|
+
}
|
|
488
|
+
if (promises && this.diBreakpointHitPromise) {
|
|
489
|
+
promises.hitBreakpointPromise = this.waitForPreparedDiBreakpointHit().then(finish)
|
|
490
|
+
return
|
|
491
|
+
}
|
|
492
|
+
finish()
|
|
493
|
+
this.cancelDiBreakpointHitWait()
|
|
494
|
+
return
|
|
495
|
+
}
|
|
496
|
+
finish()
|
|
497
|
+
if (status === 'fail' && promises?.hitBreakpointPromise) {
|
|
498
|
+
this.prepareDiBreakpointHitWait()
|
|
499
|
+
}
|
|
441
500
|
})
|
|
442
501
|
|
|
443
|
-
this.addSub('ci:jest:test:err', ({ span, error, shouldSetProbe, promises }) => {
|
|
502
|
+
this.addSub('ci:jest:test:err', ({ span, error, shouldSetProbe, shouldWaitForHitProbe, promises }) => {
|
|
444
503
|
if (error && span) {
|
|
445
504
|
span.setTag(TEST_STATUS, 'fail')
|
|
446
505
|
span.setTag('error', getFormattedError(error, this.repositoryRoot))
|
|
@@ -448,8 +507,11 @@ class JestPlugin extends CiPlugin {
|
|
|
448
507
|
const probeInformation = this.addDiProbe(error)
|
|
449
508
|
if (probeInformation) {
|
|
450
509
|
const { setProbePromise } = probeInformation
|
|
451
|
-
|
|
510
|
+
this.prepareDiBreakpointHitWait()
|
|
511
|
+
promises.isProbeReady = this.waitForDiOperation(setProbePromise)
|
|
452
512
|
}
|
|
513
|
+
} else if (shouldWaitForHitProbe && this.di) {
|
|
514
|
+
promises.hitBreakpointPromise = this.waitForDiBreakpointHits()
|
|
453
515
|
}
|
|
454
516
|
}
|
|
455
517
|
})
|
|
@@ -558,6 +620,10 @@ class JestPlugin extends CiPlugin {
|
|
|
558
620
|
extraTags[TEST_HAS_DYNAMIC_NAME] = 'true'
|
|
559
621
|
}
|
|
560
622
|
const testSuiteSpan = this.testSuiteSpanPerTestSuiteAbsolutePath.get(testSuiteAbsolutePath) || this.testSuiteSpan
|
|
623
|
+
const skippingEnabled = testSuiteSpan?.context()?.getTag?.(TEST_ITR_SKIPPING_ENABLED)
|
|
624
|
+
if (skippingEnabled !== undefined) {
|
|
625
|
+
extraTags[TEST_ITR_SKIPPING_ENABLED] = skippingEnabled
|
|
626
|
+
}
|
|
561
627
|
|
|
562
628
|
return super.startTestSpan(name, suite, testSuiteSpan, extraTags)
|
|
563
629
|
}
|