dd-trace 5.53.0 → 5.55.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 +2 -1
- package/ci/cypress/plugin.js +8 -0
- package/ci/cypress/polyfills.js +23 -0
- package/ci/init.js +8 -7
- package/index.d.ts +33 -16
- package/initialize.mjs +5 -6
- package/package.json +40 -38
- package/packages/datadog-code-origin/index.js +22 -4
- package/packages/datadog-core/src/utils/src/get.js +1 -1
- package/packages/datadog-core/src/utils/src/has.js +1 -1
- package/packages/datadog-core/src/utils/src/kebabcase.js +4 -6
- package/packages/datadog-core/src/utils/src/parse-tags.js +1 -1
- package/packages/datadog-core/src/utils/src/pick.js +2 -2
- package/packages/datadog-core/src/utils/src/set.js +1 -1
- package/packages/datadog-core/src/utils/src/uniq.js +1 -1
- package/packages/datadog-instrumentations/src/amqp10.js +19 -17
- package/packages/datadog-instrumentations/src/amqplib.js +52 -35
- package/packages/datadog-instrumentations/src/apollo.js +2 -2
- package/packages/datadog-instrumentations/src/aws-sdk.js +1 -1
- package/packages/datadog-instrumentations/src/cassandra-driver.js +10 -10
- package/packages/datadog-instrumentations/src/child_process.js +1 -2
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +89 -75
- package/packages/datadog-instrumentations/src/cookie-parser.js +1 -1
- package/packages/datadog-instrumentations/src/couchbase.js +6 -9
- package/packages/datadog-instrumentations/src/cucumber.js +108 -68
- package/packages/datadog-instrumentations/src/cypress.js +2 -1
- package/packages/datadog-instrumentations/src/dns.js +5 -5
- package/packages/datadog-instrumentations/src/elasticsearch.js +9 -10
- package/packages/datadog-instrumentations/src/fastify.js +7 -9
- package/packages/datadog-instrumentations/src/fs.js +1 -1
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +35 -43
- package/packages/datadog-instrumentations/src/graphql.js +7 -10
- package/packages/datadog-instrumentations/src/grpc/client.js +11 -23
- package/packages/datadog-instrumentations/src/grpc/server.js +7 -20
- package/packages/datadog-instrumentations/src/hapi.js +10 -11
- package/packages/datadog-instrumentations/src/helpers/extract-package-and-module-path.js +16 -10
- package/packages/datadog-instrumentations/src/helpers/fetch.js +4 -5
- package/packages/datadog-instrumentations/src/helpers/hook.js +2 -3
- package/packages/datadog-instrumentations/src/helpers/hooks.js +0 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -41
- package/packages/datadog-instrumentations/src/helpers/register.js +11 -12
- package/packages/datadog-instrumentations/src/http/client.js +14 -20
- package/packages/datadog-instrumentations/src/jest.js +201 -143
- package/packages/datadog-instrumentations/src/kafkajs.js +52 -44
- package/packages/datadog-instrumentations/src/knex.js +4 -4
- package/packages/datadog-instrumentations/src/koa.js +2 -3
- package/packages/datadog-instrumentations/src/ldapjs.js +3 -4
- package/packages/datadog-instrumentations/src/mariadb.js +49 -65
- package/packages/datadog-instrumentations/src/mocha/main.js +116 -73
- package/packages/datadog-instrumentations/src/mocha/utils.js +36 -12
- package/packages/datadog-instrumentations/src/mocha/worker.js +6 -0
- package/packages/datadog-instrumentations/src/mocha.js +3 -1
- package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +30 -37
- package/packages/datadog-instrumentations/src/mysql2.js +53 -47
- package/packages/datadog-instrumentations/src/net.js +1 -1
- package/packages/datadog-instrumentations/src/next.js +1 -0
- package/packages/datadog-instrumentations/src/nyc.js +3 -2
- package/packages/datadog-instrumentations/src/openai.js +22 -24
- package/packages/datadog-instrumentations/src/oracledb.js +1 -1
- package/packages/datadog-instrumentations/src/otel-sdk-trace.js +4 -3
- package/packages/datadog-instrumentations/src/pg.js +3 -5
- package/packages/datadog-instrumentations/src/playwright.js +123 -83
- package/packages/datadog-instrumentations/src/protobufjs.js +3 -4
- package/packages/datadog-instrumentations/src/redis.js +4 -4
- package/packages/datadog-instrumentations/src/restify.js +9 -13
- package/packages/datadog-instrumentations/src/rhea.js +42 -54
- package/packages/datadog-instrumentations/src/router.js +30 -32
- package/packages/datadog-instrumentations/src/tedious.js +2 -3
- package/packages/datadog-instrumentations/src/vitest.js +87 -52
- package/packages/datadog-plugin-amqp10/src/consumer.js +7 -3
- package/packages/datadog-plugin-amqp10/src/producer.js +7 -3
- package/packages/datadog-plugin-amqplib/src/client.js +6 -2
- package/packages/datadog-plugin-amqplib/src/consumer.js +7 -3
- package/packages/datadog-plugin-amqplib/src/producer.js +7 -3
- package/packages/datadog-plugin-amqplib/src/util.js +1 -1
- package/packages/datadog-plugin-apollo/src/gateway/request.js +5 -6
- package/packages/datadog-plugin-apollo/src/gateway/validate.js +2 -3
- package/packages/datadog-plugin-avsc/src/schema_iterator.js +12 -12
- package/packages/datadog-plugin-aws-sdk/src/base.js +15 -10
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/tracing.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/services/bedrockruntime/utils.js +13 -13
- package/packages/datadog-plugin-aws-sdk/src/services/cloudwatchlogs.js +3 -5
- package/packages/datadog-plugin-aws-sdk/src/services/dynamodb.js +28 -43
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +10 -11
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +4 -6
- package/packages/datadog-plugin-aws-sdk/src/services/redshift.js +3 -5
- package/packages/datadog-plugin-aws-sdk/src/services/s3.js +3 -5
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +2 -3
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +11 -15
- package/packages/datadog-plugin-aws-sdk/src/services/stepfunctions.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/util.js +5 -6
- package/packages/datadog-plugin-cassandra-driver/src/index.js +1 -1
- package/packages/datadog-plugin-child_process/src/index.js +4 -4
- package/packages/datadog-plugin-child_process/src/scrub-cmd-params.js +23 -23
- package/packages/datadog-plugin-cucumber/src/index.js +60 -4
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +99 -28
- package/packages/datadog-plugin-cypress/src/plugin.js +11 -1
- package/packages/datadog-plugin-cypress/src/support.js +24 -5
- package/packages/datadog-plugin-dd-trace-api/src/index.js +2 -1
- package/packages/datadog-plugin-elasticsearch/src/index.js +1 -1
- package/packages/datadog-plugin-express/src/code_origin.js +30 -0
- package/packages/datadog-plugin-express/src/index.js +10 -12
- package/packages/datadog-plugin-express/src/tracing.js +19 -0
- package/packages/datadog-plugin-google-cloud-pubsub/src/client.js +7 -3
- package/packages/datadog-plugin-google-cloud-pubsub/src/consumer.js +12 -7
- package/packages/datadog-plugin-google-cloud-pubsub/src/producer.js +6 -2
- package/packages/datadog-plugin-google-cloud-vertexai/src/tracing.js +27 -10
- package/packages/datadog-plugin-graphql/src/execute.js +2 -2
- package/packages/datadog-plugin-graphql/src/index.js +10 -8
- package/packages/datadog-plugin-graphql/src/resolve.js +19 -12
- package/packages/datadog-plugin-graphql/src/tools/index.js +1 -0
- package/packages/datadog-plugin-graphql/src/tools/signature.js +1 -0
- package/packages/datadog-plugin-graphql/src/tools/transforms.js +1 -0
- package/packages/datadog-plugin-grpc/src/client.js +2 -2
- package/packages/datadog-plugin-grpc/src/util.js +2 -2
- package/packages/datadog-plugin-http/src/client.js +23 -13
- package/packages/datadog-plugin-http2/src/client.js +24 -25
- package/packages/datadog-plugin-jest/src/index.js +26 -23
- package/packages/datadog-plugin-jest/src/util.js +8 -8
- package/packages/datadog-plugin-kafkajs/src/batch-consumer.js +3 -1
- package/packages/datadog-plugin-kafkajs/src/consumer.js +9 -5
- package/packages/datadog-plugin-kafkajs/src/producer.js +8 -3
- package/packages/datadog-plugin-kafkajs/src/utils.js +1 -1
- package/packages/datadog-plugin-langchain/src/handlers/chain.js +7 -7
- package/packages/datadog-plugin-langchain/src/handlers/embedding.js +2 -2
- package/packages/datadog-plugin-langchain/src/handlers/language_models/chat_model.js +6 -4
- package/packages/datadog-plugin-langchain/src/handlers/language_models/llm.js +5 -4
- package/packages/datadog-plugin-langchain/src/tracing.js +11 -10
- package/packages/datadog-plugin-mariadb/src/index.js +3 -9
- package/packages/datadog-plugin-mocha/src/index.js +39 -14
- package/packages/datadog-plugin-mongodb-core/src/index.js +3 -2
- package/packages/datadog-plugin-mysql/src/index.js +22 -9
- package/packages/datadog-plugin-mysql2/src/index.js +16 -0
- package/packages/datadog-plugin-net/src/tcp.js +1 -1
- package/packages/datadog-plugin-next/src/index.js +7 -6
- package/packages/datadog-plugin-openai/src/services.js +6 -10
- package/packages/datadog-plugin-openai/src/tracing.js +12 -18
- package/packages/datadog-plugin-oracledb/src/index.js +1 -1
- package/packages/datadog-plugin-playwright/src/index.js +25 -4
- package/packages/datadog-plugin-protobufjs/src/schema_iterator.js +8 -9
- package/packages/datadog-plugin-redis/src/index.js +2 -4
- package/packages/datadog-plugin-rhea/src/consumer.js +8 -6
- package/packages/datadog-plugin-rhea/src/producer.js +5 -2
- package/packages/datadog-plugin-router/src/index.js +1 -1
- package/packages/datadog-plugin-selenium/src/index.js +1 -6
- package/packages/datadog-plugin-vitest/src/index.js +52 -35
- package/packages/datadog-shimmer/src/shimmer.js +4 -8
- package/packages/dd-trace/src/appsec/api_security_sampler.js +2 -2
- package/packages/dd-trace/src/appsec/blocked_templates.js +1 -1
- package/packages/dd-trace/src/appsec/blocking.js +6 -20
- package/packages/dd-trace/src/appsec/iast/analyzers/analyzers.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-password-rules.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secret-rules.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +0 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hsts-header-missing-analyzer.js +7 -12
- package/packages/dd-trace/src/appsec/iast/analyzers/missing-header-analyzer.js +5 -8
- package/packages/dd-trace/src/appsec/iast/analyzers/nosql-injection-mongodb-analyzer.js +4 -0
- package/packages/dd-trace/src/appsec/iast/analyzers/path-traversal-analyzer.js +9 -12
- package/packages/dd-trace/src/appsec/iast/analyzers/vulnerability-analyzer.js +5 -4
- package/packages/dd-trace/src/appsec/iast/context/context-plugin.js +2 -3
- package/packages/dd-trace/src/appsec/iast/iast-plugin.js +3 -3
- package/packages/dd-trace/src/appsec/iast/index.js +1 -0
- package/packages/dd-trace/src/appsec/iast/overhead-controller.js +102 -7
- package/packages/dd-trace/src/appsec/iast/path-line.js +7 -8
- package/packages/dd-trace/src/appsec/iast/security-controls/index.js +16 -24
- package/packages/dd-trace/src/appsec/iast/security-controls/parser.js +6 -6
- package/packages/dd-trace/src/appsec/iast/taint-tracking/filter.js +2 -2
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations-taint-object.js +3 -3
- package/packages/dd-trace/src/appsec/iast/taint-tracking/operations.js +4 -28
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugin.js +2 -8
- package/packages/dd-trace/src/appsec/iast/taint-tracking/plugins/kafka.js +3 -4
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter-esm.mjs +1 -1
- package/packages/dd-trace/src/appsec/iast/taint-tracking/rewriter.js +7 -8
- package/packages/dd-trace/src/appsec/iast/taint-tracking/taint-tracking-impl.js +2 -2
- package/packages/dd-trace/src/appsec/iast/telemetry/span-tags.js +7 -7
- package/packages/dd-trace/src/appsec/iast/telemetry/verbosity.js +2 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/range-utils.js +10 -11
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/command-sensitive-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/ldap-sensitive-analyzer.js +1 -1
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/sql-sensitive-analyzer.js +7 -7
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-handler.js +23 -28
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-regex.js +3 -3
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/index.js +4 -4
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/utils.js +6 -11
- package/packages/dd-trace/src/appsec/iast/vulnerabilities.js +0 -1
- package/packages/dd-trace/src/appsec/iast/vulnerability-reporter.js +9 -11
- package/packages/dd-trace/src/appsec/index.js +5 -5
- package/packages/dd-trace/src/appsec/rasp/index.js +15 -15
- package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -1
- package/packages/dd-trace/src/appsec/reporter.js +232 -41
- package/packages/dd-trace/src/appsec/rule_manager.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/set_user.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/track_event.js +3 -3
- package/packages/dd-trace/src/appsec/stack_trace.js +2 -4
- package/packages/dd-trace/src/appsec/telemetry/index.js +31 -1
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +3 -5
- package/packages/dd-trace/src/appsec/telemetry/waf.js +3 -5
- package/packages/dd-trace/src/appsec/user_tracking.js +3 -5
- package/packages/dd-trace/src/appsec/waf/waf_context_wrapper.js +8 -4
- package/packages/dd-trace/src/azure_metadata.js +9 -9
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +9 -8
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/worker/index.js +2 -2
- package/packages/dd-trace/src/ci-visibility/early-flake-detection/get-known-tests.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agent-proxy/index.js +3 -3
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/coverage-writer.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +3 -2
- package/packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js +6 -4
- package/packages/dd-trace/src/ci-visibility/exporters/git/git_metadata.js +6 -5
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/index.js +7 -6
- package/packages/dd-trace/src/ci-visibility/exporters/test-worker/writer.js +0 -2
- package/packages/dd-trace/src/ci-visibility/intelligent-test-runner/get-skippable-suites.js +3 -2
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +5 -4
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +12 -8
- package/packages/dd-trace/src/ci-visibility/telemetry.js +4 -0
- package/packages/dd-trace/src/ci-visibility/test-management/get-test-management-tests.js +3 -2
- package/packages/dd-trace/src/config-helper.js +89 -0
- package/packages/dd-trace/src/config.js +159 -129
- package/packages/dd-trace/src/config_stable.js +10 -7
- package/packages/dd-trace/src/datastreams/encoding.js +9 -9
- package/packages/dd-trace/src/datastreams/fnv.js +2 -2
- package/packages/dd-trace/src/datastreams/pathway.js +4 -4
- package/packages/dd-trace/src/datastreams/processor.js +5 -7
- package/packages/dd-trace/src/datastreams/schemas/schema_builder.js +7 -7
- package/packages/dd-trace/src/datastreams/schemas/schema_sampler.js +4 -6
- package/packages/dd-trace/src/datastreams/size.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/breakpoints.js +75 -69
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +7 -10
- package/packages/dd-trace/src/debugger/devtools_client/defaults.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +9 -2
- package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +18 -38
- package/packages/dd-trace/src/debugger/devtools_client/send.js +3 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/collector.js +1 -2
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +11 -14
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/redaction.js +4 -4
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +2 -10
- package/packages/dd-trace/src/debugger/devtools_client/state.js +10 -3
- package/packages/dd-trace/src/debugger/index.js +1 -0
- package/packages/dd-trace/src/dogstatsd.js +7 -6
- package/packages/dd-trace/src/encode/0.4.js +14 -11
- package/packages/dd-trace/src/encode/0.5.js +4 -6
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +8 -8
- package/packages/dd-trace/src/encode/coverage-ci-visibility.js +1 -1
- package/packages/dd-trace/src/encode/tags-processors.js +1 -1
- package/packages/dd-trace/src/exporter.js +7 -6
- package/packages/dd-trace/src/exporters/agent/writer.js +1 -5
- package/packages/dd-trace/src/exporters/common/docker.js +4 -3
- package/packages/dd-trace/src/exporters/common/form-data.js +6 -4
- package/packages/dd-trace/src/exporters/common/request.js +5 -2
- package/packages/dd-trace/src/exporters/common/util.js +4 -2
- package/packages/dd-trace/src/external-logger/src/index.js +5 -5
- package/packages/dd-trace/src/flare/file.js +1 -5
- package/packages/dd-trace/src/format.js +1 -1
- package/packages/dd-trace/src/git_properties.js +1 -1
- package/packages/dd-trace/src/id.js +15 -9
- package/packages/dd-trace/src/iitm.js +10 -22
- package/packages/dd-trace/src/index.js +4 -3
- package/packages/dd-trace/src/lambda/handler.js +7 -6
- package/packages/dd-trace/src/lambda/index.js +2 -1
- package/packages/dd-trace/src/lambda/runtime/patch.js +7 -6
- package/packages/dd-trace/src/lambda/runtime/ritm.js +4 -3
- package/packages/dd-trace/src/llmobs/constants/tags.js +1 -0
- package/packages/dd-trace/src/llmobs/index.js +21 -5
- package/packages/dd-trace/src/llmobs/noop.js +18 -20
- package/packages/dd-trace/src/llmobs/plugins/bedrockruntime.js +6 -6
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chain.js +2 -6
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/chat_model.js +3 -3
- package/packages/dd-trace/src/llmobs/plugins/langchain/handlers/index.js +11 -13
- package/packages/dd-trace/src/llmobs/plugins/langchain/index.js +6 -6
- package/packages/dd-trace/src/llmobs/plugins/openai.js +2 -3
- package/packages/dd-trace/src/llmobs/sdk.js +4 -3
- package/packages/dd-trace/src/llmobs/span_processor.js +1 -1
- package/packages/dd-trace/src/llmobs/tagger.js +129 -102
- package/packages/dd-trace/src/llmobs/util.js +9 -9
- package/packages/dd-trace/src/llmobs/writers/base.js +1 -1
- package/packages/dd-trace/src/llmobs/writers/util.js +1 -1
- package/packages/dd-trace/src/log/index.js +9 -8
- package/packages/dd-trace/src/log/log.js +1 -1
- package/packages/dd-trace/src/log/writer.js +3 -4
- package/packages/dd-trace/src/msgpack/chunk.js +3 -3
- package/packages/dd-trace/src/msgpack/encoder.js +31 -31
- package/packages/dd-trace/src/noop/dogstatsd.js +6 -6
- package/packages/dd-trace/src/noop/span.js +4 -6
- package/packages/dd-trace/src/noop/tracer.js +1 -2
- package/packages/dd-trace/src/opentelemetry/span_processor.js +2 -2
- package/packages/dd-trace/src/opentelemetry/tracer.js +7 -6
- package/packages/dd-trace/src/opentracing/propagation/log.js +10 -13
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +40 -37
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +8 -4
- package/packages/dd-trace/src/opentracing/span.js +16 -20
- package/packages/dd-trace/src/opentracing/tracer.js +9 -6
- package/packages/dd-trace/src/payload-tagging/config/index.js +17 -21
- package/packages/dd-trace/src/payload-tagging/index.js +1 -1
- package/packages/dd-trace/src/payload-tagging/tagging.js +6 -6
- package/packages/dd-trace/src/pkg.js +1 -1
- package/packages/dd-trace/src/plugin_manager.js +4 -3
- package/packages/dd-trace/src/plugins/ci_plugin.js +87 -11
- package/packages/dd-trace/src/plugins/consumer.js +2 -2
- package/packages/dd-trace/src/plugins/inbound.js +5 -1
- package/packages/dd-trace/src/plugins/index.js +0 -1
- package/packages/dd-trace/src/plugins/outbound.js +4 -5
- package/packages/dd-trace/src/plugins/plugin.js +1 -1
- package/packages/dd-trace/src/plugins/producer.js +2 -2
- package/packages/dd-trace/src/plugins/storage.js +2 -2
- package/packages/dd-trace/src/plugins/util/ci.js +28 -20
- package/packages/dd-trace/src/plugins/util/git.js +166 -12
- package/packages/dd-trace/src/plugins/util/inferred_proxy.js +1 -1
- package/packages/dd-trace/src/plugins/util/ip_extractor.js +1 -1
- package/packages/dd-trace/src/plugins/util/llm.js +27 -10
- package/packages/dd-trace/src/plugins/util/stacktrace.js +9 -2
- package/packages/dd-trace/src/plugins/util/test.js +315 -51
- package/packages/dd-trace/src/plugins/util/url.js +1 -1
- package/packages/dd-trace/src/plugins/util/urlfilter.js +13 -17
- package/packages/dd-trace/src/plugins/util/user-provided-git.js +14 -4
- package/packages/dd-trace/src/plugins/util/web.js +8 -8
- package/packages/dd-trace/src/priority_sampler.js +64 -53
- package/packages/dd-trace/src/profiling/config.js +51 -35
- package/packages/dd-trace/src/profiling/exporter_cli.js +20 -20
- package/packages/dd-trace/src/profiling/exporters/agent.js +1 -1
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +7 -6
- package/packages/dd-trace/src/profiling/exporters/file.js +2 -1
- package/packages/dd-trace/src/profiling/index.js +2 -1
- package/packages/dd-trace/src/profiling/profiler.js +44 -6
- package/packages/dd-trace/src/profiling/profilers/events.js +14 -17
- package/packages/dd-trace/src/profiling/profilers/shared.js +6 -1
- package/packages/dd-trace/src/profiling/profilers/space.js +3 -3
- package/packages/dd-trace/src/profiling/profilers/wall.js +6 -7
- package/packages/dd-trace/src/profiling/ssi-heuristics.js +3 -5
- package/packages/dd-trace/src/profiling/ssi-telemetry-mock-profiler.js +3 -1
- package/packages/dd-trace/src/profiling/tagger.js +21 -13
- package/packages/dd-trace/src/profiling/webspan-utils.js +1 -1
- package/packages/dd-trace/src/proxy.js +9 -10
- package/packages/dd-trace/src/random_sampler.js +40 -0
- package/packages/dd-trace/src/rate_limiter.js +4 -4
- package/packages/dd-trace/src/remote_config/index.js +3 -7
- package/packages/dd-trace/src/remote_config/manager.js +25 -13
- package/packages/dd-trace/src/require-package-json.js +1 -1
- package/packages/dd-trace/src/ritm.js +8 -8
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +5 -4
- package/packages/dd-trace/src/sampler.js +41 -4
- package/packages/dd-trace/src/sampling_rule.js +12 -3
- package/packages/dd-trace/src/scope.js +1 -1
- package/packages/dd-trace/src/serverless.js +11 -4
- package/packages/dd-trace/src/service-naming/schemas/util.js +1 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +2 -3
- package/packages/dd-trace/src/span_processor.js +5 -4
- package/packages/dd-trace/src/span_sampler.js +4 -1
- package/packages/dd-trace/src/standalone/tracesource.js +2 -3
- package/packages/dd-trace/src/standalone/tracesource_priority_sampler.js +1 -2
- package/packages/dd-trace/src/startup-log.js +6 -18
- package/packages/dd-trace/src/supported-configurations.json +439 -0
- package/packages/dd-trace/src/telemetry/dependencies.js +64 -59
- package/packages/dd-trace/src/telemetry/logs/log-collector.js +9 -10
- package/packages/dd-trace/src/telemetry/metrics.js +10 -5
- package/packages/dd-trace/src/telemetry/send-data.js +8 -7
- package/packages/dd-trace/src/telemetry/telemetry.js +31 -45
- package/packages/dd-trace/src/tracer.js +3 -7
- package/packages/dd-trace/src/util.js +1 -6
- package/version.js +1 -0
- package/packages/datadog-instrumentations/src/paperplane.js +0 -77
- package/packages/datadog-plugin-paperplane/src/index.js +0 -25
- package/packages/datadog-plugin-paperplane/src/logger.js +0 -11
- package/packages/datadog-plugin-paperplane/src/server.js +0 -24
- package/packages/dd-trace/src/appsec/iast/analyzers/header-injection-analyzer.js +0 -122
- package/packages/dd-trace/src/appsec/iast/vulnerabilities-formatter/evidence-redaction/sensitive-analyzers/header-sensitive-analyzer.js +0 -20
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
const { createCoverageMap } = require('istanbul-lib-coverage')
|
|
3
3
|
|
|
4
|
-
const { addHook, channel
|
|
4
|
+
const { addHook, channel } = require('./helpers/instrument')
|
|
5
5
|
const shimmer = require('../../datadog-shimmer')
|
|
6
6
|
const log = require('../../dd-trace/src/log')
|
|
7
|
+
const { getEnvironmentVariable } = require('../../dd-trace/src/config-helper')
|
|
7
8
|
|
|
8
9
|
const testStartCh = channel('ci:cucumber:test:start')
|
|
9
10
|
const testRetryCh = channel('ci:cucumber:test:retry')
|
|
@@ -24,6 +25,8 @@ const skippableSuitesCh = channel('ci:cucumber:test-suite:skippable')
|
|
|
24
25
|
const sessionStartCh = channel('ci:cucumber:session:start')
|
|
25
26
|
const sessionFinishCh = channel('ci:cucumber:session:finish')
|
|
26
27
|
const testManagementTestsCh = channel('ci:cucumber:test-management-tests')
|
|
28
|
+
const impactedTestsCh = channel('ci:cucumber:modified-tests')
|
|
29
|
+
const isModifiedCh = channel('ci:cucumber:is-modified-test')
|
|
27
30
|
|
|
28
31
|
const workerReportTraceCh = channel('ci:cucumber:worker-report:trace')
|
|
29
32
|
|
|
@@ -42,7 +45,7 @@ const {
|
|
|
42
45
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
43
46
|
|
|
44
47
|
const isMarkedAsUnskippable = (pickle) => {
|
|
45
|
-
return
|
|
48
|
+
return pickle.tags.some(tag => tag.name === '@datadog:unskippable')
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
// We'll preserve the original coverage here
|
|
@@ -55,13 +58,12 @@ const lastStatusByPickleId = new Map()
|
|
|
55
58
|
const numRetriesByPickleId = new Map()
|
|
56
59
|
const numAttemptToCtx = new Map()
|
|
57
60
|
const newTestsByTestFullname = new Map()
|
|
61
|
+
const modifiedTestsByPickleId = new Map()
|
|
58
62
|
|
|
59
63
|
let eventDataCollector = null
|
|
60
64
|
let pickleByFile = {}
|
|
61
65
|
const pickleResultByFile = {}
|
|
62
66
|
|
|
63
|
-
const sessionAsyncResource = new AsyncResource('bound-anonymous-fn')
|
|
64
|
-
|
|
65
67
|
let skippableSuites = []
|
|
66
68
|
let itrCorrelationId = ''
|
|
67
69
|
let isForcedToRun = false
|
|
@@ -74,15 +76,17 @@ let isEarlyFlakeDetectionFaulty = false
|
|
|
74
76
|
let isFlakyTestRetriesEnabled = false
|
|
75
77
|
let isKnownTestsEnabled = false
|
|
76
78
|
let isTestManagementTestsEnabled = false
|
|
79
|
+
let isImpactedTestsEnabled = false
|
|
77
80
|
let testManagementAttemptToFixRetries = 0
|
|
78
81
|
let testManagementTests = {}
|
|
82
|
+
let modifiedTests = {}
|
|
79
83
|
let numTestRetries = 0
|
|
80
84
|
let knownTests = []
|
|
81
85
|
let skippedSuites = []
|
|
82
86
|
let isSuitesSkipped = false
|
|
83
87
|
|
|
84
88
|
function getSuiteStatusFromTestStatuses (testStatuses) {
|
|
85
|
-
if (testStatuses.
|
|
89
|
+
if (testStatuses.includes('fail')) {
|
|
86
90
|
return 'fail'
|
|
87
91
|
}
|
|
88
92
|
if (testStatuses.every(status => status === 'skip')) {
|
|
@@ -133,7 +137,7 @@ function getTestStatusFromRetries (testStatuses) {
|
|
|
133
137
|
if (testStatuses.every(status => status === 'fail')) {
|
|
134
138
|
return 'fail'
|
|
135
139
|
}
|
|
136
|
-
if (testStatuses.
|
|
140
|
+
if (testStatuses.includes('pass')) {
|
|
137
141
|
return 'pass'
|
|
138
142
|
}
|
|
139
143
|
return 'pass'
|
|
@@ -155,9 +159,7 @@ function getErrorFromCucumberResult (cucumberResult) {
|
|
|
155
159
|
|
|
156
160
|
function getChannelPromise (channelToPublishTo, isParallel = false) {
|
|
157
161
|
return new Promise(resolve => {
|
|
158
|
-
|
|
159
|
-
channelToPublishTo.publish({ onDone: resolve, isParallel })
|
|
160
|
-
})
|
|
162
|
+
channelToPublishTo.publish({ onDone: resolve, isParallel })
|
|
161
163
|
})
|
|
162
164
|
}
|
|
163
165
|
|
|
@@ -242,11 +244,11 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
242
244
|
testName: this.pickle.name,
|
|
243
245
|
testFileAbsolutePath,
|
|
244
246
|
testSourceLine,
|
|
245
|
-
isParallel: !!
|
|
247
|
+
isParallel: !!getEnvironmentVariable('CUCUMBER_WORKER_ID')
|
|
246
248
|
}
|
|
247
249
|
const ctx = testStartPayload
|
|
248
250
|
numAttemptToCtx.set(numAttempt, ctx)
|
|
249
|
-
testStartCh.runStores(ctx, () => {
|
|
251
|
+
testStartCh.runStores(ctx, () => {})
|
|
250
252
|
const promises = {}
|
|
251
253
|
try {
|
|
252
254
|
this.eventBroadcaster.on('envelope', shimmer.wrapFunction(null, () => async (testCase) => {
|
|
@@ -258,7 +260,7 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
258
260
|
try {
|
|
259
261
|
const cucumberResult = this.getWorstStepResult()
|
|
260
262
|
error = getErrorFromCucumberResult(cucumberResult)
|
|
261
|
-
} catch
|
|
263
|
+
} catch {
|
|
262
264
|
// ignore error
|
|
263
265
|
}
|
|
264
266
|
|
|
@@ -276,7 +278,7 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
276
278
|
const newCtx = { ...testStartPayload, promises }
|
|
277
279
|
numAttemptToCtx.set(numAttempt, newCtx)
|
|
278
280
|
|
|
279
|
-
testStartCh.runStores(newCtx, () => {
|
|
281
|
+
testStartCh.runStores(newCtx, () => {})
|
|
280
282
|
}
|
|
281
283
|
}
|
|
282
284
|
}))
|
|
@@ -305,6 +307,7 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
305
307
|
let hasFailedAttemptToFix = false
|
|
306
308
|
let isDisabled = false
|
|
307
309
|
let isQuarantined = false
|
|
310
|
+
let isModified = false
|
|
308
311
|
|
|
309
312
|
if (isTestManagementTestsEnabled) {
|
|
310
313
|
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
@@ -329,10 +332,17 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
329
332
|
}
|
|
330
333
|
}
|
|
331
334
|
|
|
332
|
-
|
|
333
|
-
const numRetries = numRetriesByPickleId.get(this.pickle.id)
|
|
335
|
+
const numRetries = numRetriesByPickleId.get(this.pickle.id)
|
|
334
336
|
|
|
337
|
+
if (isImpactedTestsEnabled) {
|
|
338
|
+
isModified = modifiedTestsByPickleId.get(this.pickle.id)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (isKnownTestsEnabled && status !== 'skip') {
|
|
335
342
|
isNew = numRetries !== undefined
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (isNew || isModified) {
|
|
336
346
|
isEfdRetry = numRetries > 0
|
|
337
347
|
}
|
|
338
348
|
|
|
@@ -357,6 +367,7 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
357
367
|
hasFailedAttemptToFix,
|
|
358
368
|
isDisabled,
|
|
359
369
|
isQuarantined,
|
|
370
|
+
isModified,
|
|
360
371
|
...attemptCtx.currentStore
|
|
361
372
|
})
|
|
362
373
|
})
|
|
@@ -451,14 +462,15 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
451
462
|
isKnownTestsEnabled = configurationResponse.libraryConfig?.isKnownTestsEnabled
|
|
452
463
|
isTestManagementTestsEnabled = configurationResponse.libraryConfig?.isTestManagementEnabled
|
|
453
464
|
testManagementAttemptToFixRetries = configurationResponse.libraryConfig?.testManagementAttemptToFixRetries
|
|
465
|
+
isImpactedTestsEnabled = configurationResponse.libraryConfig?.isImpactedTestsEnabled
|
|
454
466
|
|
|
455
467
|
if (isKnownTestsEnabled) {
|
|
456
468
|
const knownTestsResponse = await getChannelPromise(knownTestsCh)
|
|
457
|
-
if (
|
|
458
|
-
knownTests = knownTestsResponse.knownTests
|
|
459
|
-
} else {
|
|
469
|
+
if (knownTestsResponse.err) {
|
|
460
470
|
isEarlyFlakeDetectionEnabled = false
|
|
461
471
|
isKnownTestsEnabled = false
|
|
472
|
+
} else {
|
|
473
|
+
knownTests = knownTestsResponse.knownTests
|
|
462
474
|
}
|
|
463
475
|
}
|
|
464
476
|
|
|
@@ -488,7 +500,7 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
488
500
|
this.pickleIds = picklesToRun
|
|
489
501
|
}
|
|
490
502
|
|
|
491
|
-
skippedSuites =
|
|
503
|
+
skippedSuites = [...filteredPickles.skippedSuites]
|
|
492
504
|
itrCorrelationId = skippableResponse.itrCorrelationId
|
|
493
505
|
}
|
|
494
506
|
}
|
|
@@ -510,23 +522,28 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
510
522
|
|
|
511
523
|
if (isTestManagementTestsEnabled) {
|
|
512
524
|
const testManagementTestsResponse = await getChannelPromise(testManagementTestsCh)
|
|
513
|
-
if (
|
|
514
|
-
testManagementTests = testManagementTestsResponse.testManagementTests
|
|
515
|
-
} else {
|
|
525
|
+
if (testManagementTestsResponse.err) {
|
|
516
526
|
isTestManagementTestsEnabled = false
|
|
527
|
+
} else {
|
|
528
|
+
testManagementTests = testManagementTestsResponse.testManagementTests
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
if (isImpactedTestsEnabled) {
|
|
533
|
+
const impactedTestsResponse = await getChannelPromise(impactedTestsCh)
|
|
534
|
+
if (!impactedTestsResponse.err) {
|
|
535
|
+
modifiedTests = impactedTestsResponse.modifiedTests
|
|
517
536
|
}
|
|
518
537
|
}
|
|
519
538
|
|
|
520
539
|
const processArgv = process.argv.slice(2).join(' ')
|
|
521
|
-
const command =
|
|
540
|
+
const command = getEnvironmentVariable('npm_lifecycle_script') || `cucumber-js ${processArgv}`
|
|
522
541
|
|
|
523
542
|
if (isFlakyTestRetriesEnabled && !options.retry && numTestRetries > 0) {
|
|
524
543
|
options.retry = numTestRetries
|
|
525
544
|
}
|
|
526
545
|
|
|
527
|
-
|
|
528
|
-
sessionStartCh.publish({ command, frameworkVersion })
|
|
529
|
-
})
|
|
546
|
+
sessionStartCh.publish({ command, frameworkVersion })
|
|
530
547
|
|
|
531
548
|
if (!errorSkippableRequest && skippedSuites.length) {
|
|
532
549
|
itrSkippedSuitesCh.publish({ skippedSuites, frameworkVersion })
|
|
@@ -547,26 +564,24 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
547
564
|
originalCoverageMap.merge(fromCoverageMapToCoverage(untestedCoverage))
|
|
548
565
|
}
|
|
549
566
|
testCodeCoverageLinesTotal = originalCoverageMap.getCoverageSummary().lines.pct
|
|
550
|
-
} catch
|
|
567
|
+
} catch {
|
|
551
568
|
// ignore errors
|
|
552
569
|
}
|
|
553
570
|
// restore the original coverage
|
|
554
571
|
global.__coverage__ = fromCoverageMapToCoverage(originalCoverageMap)
|
|
555
572
|
}
|
|
556
573
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
isParallel
|
|
569
|
-
})
|
|
574
|
+
sessionFinishCh.publish({
|
|
575
|
+
status: success ? 'pass' : 'fail',
|
|
576
|
+
isSuitesSkipped,
|
|
577
|
+
testCodeCoverageLinesTotal,
|
|
578
|
+
numSkippedSuites: skippedSuites.length,
|
|
579
|
+
hasUnskippableSuites: isUnskippable,
|
|
580
|
+
hasForcedToRunSuites: isForcedToRun,
|
|
581
|
+
isEarlyFlakeDetectionEnabled,
|
|
582
|
+
isEarlyFlakeDetectionFaulty,
|
|
583
|
+
isTestManagementTestsEnabled,
|
|
584
|
+
isParallel
|
|
570
585
|
})
|
|
571
586
|
eventDataCollector = null
|
|
572
587
|
return success
|
|
@@ -577,12 +592,15 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
577
592
|
// Handles EFD in both the main process and the worker process.
|
|
578
593
|
function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = false, isWorker = false) {
|
|
579
594
|
return async function () {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
595
|
+
const pickle = isNewerCucumberVersion
|
|
596
|
+
? arguments[0].pickle
|
|
597
|
+
: this.eventDataCollector.getPickle(arguments[0])
|
|
598
|
+
const testCase = isNewerCucumberVersion
|
|
599
|
+
? arguments[0].testCase
|
|
600
|
+
: arguments[1]
|
|
601
|
+
const gherkinDocument = isNewerCucumberVersion
|
|
602
|
+
? arguments[0].gherkinDocument
|
|
603
|
+
: this.eventDataCollector.getGherkinDocument(pickle.uri)
|
|
586
604
|
|
|
587
605
|
const testFileAbsolutePath = pickle.uri
|
|
588
606
|
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
@@ -604,6 +622,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
604
622
|
let isAttemptToFix = false
|
|
605
623
|
let isDisabled = false
|
|
606
624
|
let isQuarantined = false
|
|
625
|
+
let isModified = false
|
|
607
626
|
|
|
608
627
|
if (isTestManagementTestsEnabled) {
|
|
609
628
|
const testProperties = getTestProperties(testSuitePath, pickle.name)
|
|
@@ -616,6 +635,24 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
616
635
|
}
|
|
617
636
|
}
|
|
618
637
|
|
|
638
|
+
if (isImpactedTestsEnabled) {
|
|
639
|
+
const setIsModified = (receivedIsModified) => { isModified = receivedIsModified }
|
|
640
|
+
const scenarios = gherkinDocument.feature?.children?.filter(
|
|
641
|
+
children => pickle.astNodeIds.includes(children.scenario.id)
|
|
642
|
+
).map(scenario => scenario.scenario)
|
|
643
|
+
const stepIds = testCase?.testSteps?.flatMap(testStep => testStep.stepDefinitionIds)
|
|
644
|
+
|
|
645
|
+
isModifiedCh.publish({
|
|
646
|
+
scenarios,
|
|
647
|
+
testFileAbsolutePath: gherkinDocument.uri,
|
|
648
|
+
modifiedTests,
|
|
649
|
+
stepIds,
|
|
650
|
+
stepDefinitions: this.supportCodeLibrary.stepDefinitions,
|
|
651
|
+
setIsModified
|
|
652
|
+
})
|
|
653
|
+
modifiedTestsByPickleId.set(pickle.id, isModified)
|
|
654
|
+
}
|
|
655
|
+
|
|
619
656
|
if (isKnownTestsEnabled && !isAttemptToFix) {
|
|
620
657
|
isNew = isNewTest(testSuitePath, pickle.name)
|
|
621
658
|
if (isNew) {
|
|
@@ -626,27 +663,29 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
626
663
|
let runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
627
664
|
|
|
628
665
|
const testStatuses = lastStatusByPickleId.get(pickle.id)
|
|
629
|
-
const lastTestStatus = testStatuses
|
|
666
|
+
const lastTestStatus = testStatuses.at(-1)
|
|
630
667
|
|
|
631
668
|
// New tests should not be marked as attempt to fix, so EFD + Attempt to fix should not be enabled at the same time
|
|
632
669
|
if (isAttemptToFix && lastTestStatus !== 'skip') {
|
|
633
670
|
for (let retryIndex = 0; retryIndex < testManagementAttemptToFixRetries; retryIndex++) {
|
|
634
671
|
numRetriesByPickleId.set(pickle.id, retryIndex + 1)
|
|
672
|
+
// eslint-disable-next-line no-await-in-loop
|
|
635
673
|
runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
636
674
|
}
|
|
637
675
|
}
|
|
638
676
|
|
|
639
677
|
// If it's a new test and it hasn't been skipped, we run it again
|
|
640
|
-
if (isEarlyFlakeDetectionEnabled && lastTestStatus !== 'skip' && isNew) {
|
|
678
|
+
if (isEarlyFlakeDetectionEnabled && lastTestStatus !== 'skip' && (isNew || isModified)) {
|
|
641
679
|
for (let retryIndex = 0; retryIndex < earlyFlakeDetectionNumRetries; retryIndex++) {
|
|
642
680
|
numRetriesByPickleId.set(pickle.id, retryIndex + 1)
|
|
681
|
+
// eslint-disable-next-line no-await-in-loop
|
|
643
682
|
runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
644
683
|
}
|
|
645
684
|
}
|
|
646
685
|
let testStatus = lastTestStatus
|
|
647
686
|
let shouldBePassedByEFD = false
|
|
648
687
|
let shouldBePassedByTestManagement = false
|
|
649
|
-
if (isNew && isEarlyFlakeDetectionEnabled) {
|
|
688
|
+
if ((isNew || isModified) && isEarlyFlakeDetectionEnabled) {
|
|
650
689
|
/**
|
|
651
690
|
* If Early Flake Detection (EFD) is enabled the logic is as follows:
|
|
652
691
|
* - If all attempts for a test are failing, the test has failed and we will let the test process fail.
|
|
@@ -667,10 +706,10 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
667
706
|
shouldBePassedByTestManagement = true
|
|
668
707
|
}
|
|
669
708
|
|
|
670
|
-
if (
|
|
671
|
-
pickleResultByFile[testFileAbsolutePath] = [testStatus]
|
|
672
|
-
} else {
|
|
709
|
+
if (pickleResultByFile[testFileAbsolutePath]) {
|
|
673
710
|
pickleResultByFile[testFileAbsolutePath].push(testStatus)
|
|
711
|
+
} else {
|
|
712
|
+
pickleResultByFile[testFileAbsolutePath] = [testStatus]
|
|
674
713
|
}
|
|
675
714
|
|
|
676
715
|
// If it's a worker, suite events are handled in `getWrappedParseWorkerMessage`
|
|
@@ -694,7 +733,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
694
733
|
testSuiteFinishCh.publish({ status: testSuiteStatus, testSuitePath })
|
|
695
734
|
}
|
|
696
735
|
|
|
697
|
-
if (isNewerCucumberVersion && isEarlyFlakeDetectionEnabled && isNew) {
|
|
736
|
+
if (isNewerCucumberVersion && isEarlyFlakeDetectionEnabled && (isNew || isModified)) {
|
|
698
737
|
return shouldBePassedByEFD
|
|
699
738
|
}
|
|
700
739
|
|
|
@@ -714,20 +753,12 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion)
|
|
|
714
753
|
if (Array.isArray(message)) {
|
|
715
754
|
const [messageCode, payload] = message
|
|
716
755
|
if (messageCode === CUCUMBER_WORKER_TRACE_PAYLOAD_CODE) {
|
|
717
|
-
|
|
718
|
-
workerReportTraceCh.publish(payload)
|
|
719
|
-
})
|
|
756
|
+
workerReportTraceCh.publish(payload)
|
|
720
757
|
return
|
|
721
758
|
}
|
|
722
759
|
}
|
|
723
760
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
if (isNewVersion) {
|
|
727
|
-
envelope = message.envelope
|
|
728
|
-
} else {
|
|
729
|
-
envelope = message.jsonEnvelope
|
|
730
|
-
}
|
|
761
|
+
const envelope = isNewVersion ? message.envelope : message.jsonEnvelope
|
|
731
762
|
|
|
732
763
|
if (!envelope) {
|
|
733
764
|
return parseWorkerMessageFunction.apply(this, arguments)
|
|
@@ -737,7 +768,7 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion)
|
|
|
737
768
|
if (typeof parsed === 'string') {
|
|
738
769
|
try {
|
|
739
770
|
parsed = JSON.parse(envelope)
|
|
740
|
-
} catch
|
|
771
|
+
} catch {
|
|
741
772
|
// ignore errors and continue
|
|
742
773
|
return parseWorkerMessageFunction.apply(this, arguments)
|
|
743
774
|
}
|
|
@@ -790,11 +821,11 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion)
|
|
|
790
821
|
if (isEarlyFlakeDetectionEnabled && isNew) {
|
|
791
822
|
const testFullname = `${pickle.uri}:${pickle.name}`
|
|
792
823
|
let testStatuses = newTestsByTestFullname.get(testFullname)
|
|
793
|
-
if (
|
|
824
|
+
if (testStatuses) {
|
|
825
|
+
testStatuses.push(status)
|
|
826
|
+
} else {
|
|
794
827
|
testStatuses = [status]
|
|
795
828
|
newTestsByTestFullname.set(testFullname, testStatuses)
|
|
796
|
-
} else {
|
|
797
|
-
testStatuses.push(status)
|
|
798
829
|
}
|
|
799
830
|
// We have finished all retries
|
|
800
831
|
if (testStatuses.length === earlyFlakeDetectionNumRetries + 1) {
|
|
@@ -894,7 +925,7 @@ addHook({
|
|
|
894
925
|
shimmer.wrap(
|
|
895
926
|
workerPackage.Worker.prototype,
|
|
896
927
|
'runTestCase',
|
|
897
|
-
runTestCase => getWrappedRunTestCase(runTestCase, true, !!
|
|
928
|
+
runTestCase => getWrappedRunTestCase(runTestCase, true, !!getEnvironmentVariable('CUCUMBER_WORKER_ID'))
|
|
898
929
|
)
|
|
899
930
|
return workerPackage
|
|
900
931
|
})
|
|
@@ -947,6 +978,11 @@ addHook({
|
|
|
947
978
|
this.options.worldParameters._ddEarlyFlakeDetectionNumRetries = earlyFlakeDetectionNumRetries
|
|
948
979
|
}
|
|
949
980
|
|
|
981
|
+
if (isImpactedTestsEnabled) {
|
|
982
|
+
this.options.worldParameters._ddImpactedTestsEnabled = isImpactedTestsEnabled
|
|
983
|
+
this.options.worldParameters._ddModifiedTests = modifiedTests
|
|
984
|
+
}
|
|
985
|
+
|
|
950
986
|
return startWorker.apply(this, arguments)
|
|
951
987
|
})
|
|
952
988
|
return adapterPackage
|
|
@@ -973,6 +1009,10 @@ addHook({
|
|
|
973
1009
|
if (isEarlyFlakeDetectionEnabled) {
|
|
974
1010
|
earlyFlakeDetectionNumRetries = this.options.worldParameters._ddEarlyFlakeDetectionNumRetries
|
|
975
1011
|
}
|
|
1012
|
+
isImpactedTestsEnabled = !!this.options.worldParameters._ddImpactedTestsEnabled
|
|
1013
|
+
if (isImpactedTestsEnabled) {
|
|
1014
|
+
modifiedTests = this.options.worldParameters._ddModifiedTests
|
|
1015
|
+
}
|
|
976
1016
|
}
|
|
977
1017
|
)
|
|
978
1018
|
return workerPackage
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const { addHook } = require('./helpers/instrument')
|
|
2
|
+
const { DD_MAJOR } = require('../../../version')
|
|
2
3
|
|
|
3
4
|
// No handler because this is only useful for testing.
|
|
4
5
|
// Cypress plugin does not patch any library.
|
|
5
6
|
addHook({
|
|
6
7
|
name: 'cypress',
|
|
7
|
-
versions: ['>=6.7.0']
|
|
8
|
+
versions: DD_MAJOR >= 6 ? ['>=10.2.0'] : ['>=6.7.0']
|
|
8
9
|
}, lib => lib)
|
|
@@ -39,12 +39,12 @@ addHook({ name: names }, dns => {
|
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
function patchResolveShorthands (prototype) {
|
|
42
|
-
Object.keys(rrtypes)
|
|
43
|
-
|
|
44
|
-
.forEach(method => {
|
|
42
|
+
for (const method of Object.keys(rrtypes)) {
|
|
43
|
+
if (prototype[method]) {
|
|
45
44
|
rrtypeMap.set(prototype[method], rrtypes[method])
|
|
46
45
|
shimmer.wrap(prototype, method, fn => wrap('apm:dns:resolve', fn, 2, rrtypes[method]))
|
|
47
|
-
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function wrap (prefix, fn, expectedArgs, rrtype) {
|
|
@@ -62,7 +62,7 @@ function wrap (prefix, fn, expectedArgs, rrtype) {
|
|
|
62
62
|
return fn.apply(this, arguments)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const args =
|
|
65
|
+
const args = [...arguments]
|
|
66
66
|
args.pop() // gets rid of the callback
|
|
67
67
|
if (rrtype) {
|
|
68
68
|
args.push(rrtype)
|
|
@@ -91,18 +91,17 @@ function createWrapRequest (name) {
|
|
|
91
91
|
return cb.apply(null, arguments)
|
|
92
92
|
}))
|
|
93
93
|
return request.apply(this, arguments)
|
|
94
|
+
}
|
|
95
|
+
const promise = request.apply(this, arguments)
|
|
96
|
+
if (promise && typeof promise.then === 'function') {
|
|
97
|
+
const onResolve = asyncResource.bind(() => finish(params))
|
|
98
|
+
const onReject = asyncResource.bind(e => finish(params, e))
|
|
99
|
+
|
|
100
|
+
promise.then(onResolve, onReject)
|
|
94
101
|
} else {
|
|
95
|
-
|
|
96
|
-
if (promise && typeof promise.then === 'function') {
|
|
97
|
-
const onResolve = asyncResource.bind(() => finish(params))
|
|
98
|
-
const onReject = asyncResource.bind(e => finish(params, e))
|
|
99
|
-
|
|
100
|
-
promise.then(onResolve, onReject)
|
|
101
|
-
} else {
|
|
102
|
-
finish(params)
|
|
103
|
-
}
|
|
104
|
-
return promise
|
|
102
|
+
finish(params)
|
|
105
103
|
}
|
|
104
|
+
return promise
|
|
106
105
|
} catch (err) {
|
|
107
106
|
err.stack // trigger getting the stack at the original throwing point
|
|
108
107
|
errorCh.publish(err)
|
|
@@ -59,21 +59,19 @@ function wrapAddHook (addHook) {
|
|
|
59
59
|
return parsingResource.runInAsyncScope(() => {
|
|
60
60
|
return done.apply(this, arguments)
|
|
61
61
|
})
|
|
62
|
-
} else {
|
|
63
|
-
return done.apply(this, arguments)
|
|
64
62
|
}
|
|
63
|
+
return done.apply(this, arguments)
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
return fn.apply(this, arguments)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (promise && typeof promise.catch === 'function') {
|
|
72
|
-
return promise.catch(err => publishError(err, req))
|
|
73
|
-
}
|
|
67
|
+
}
|
|
68
|
+
const promise = fn.apply(this, arguments)
|
|
74
69
|
|
|
75
|
-
|
|
70
|
+
if (promise && typeof promise.catch === 'function') {
|
|
71
|
+
return promise.catch(err => publishError(err, req))
|
|
76
72
|
}
|
|
73
|
+
|
|
74
|
+
return promise
|
|
77
75
|
} catch (e) {
|
|
78
76
|
throw publishError(e, req)
|
|
79
77
|
}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
4
|
channel,
|
|
5
|
-
addHook
|
|
6
|
-
AsyncResource
|
|
5
|
+
addHook
|
|
7
6
|
} = require('./helpers/instrument')
|
|
8
7
|
const shimmer = require('../../datadog-shimmer')
|
|
9
8
|
|
|
@@ -65,42 +64,35 @@ function wrapMethod (method) {
|
|
|
65
64
|
return function (request) {
|
|
66
65
|
if (!requestStartCh.hasSubscribers) return method.apply(this, arguments)
|
|
67
66
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
return innerAsyncResource.runInAsyncScope(() => {
|
|
71
|
-
const projectId = this.auth._cachedProjectId
|
|
67
|
+
const ctx = { request, api, projectId: this.auth._cachedProjectId }
|
|
68
|
+
return requestStartCh.runStores(ctx, () => {
|
|
72
69
|
const cb = arguments[arguments.length - 1]
|
|
73
70
|
|
|
74
|
-
requestStartCh.publish({ request, api, projectId })
|
|
75
|
-
|
|
76
71
|
if (typeof cb === 'function') {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
arguments[arguments.length - 1] = shimmer.wrapFunction(cb, cb => innerAsyncResource.bind(function (error) {
|
|
72
|
+
arguments[arguments.length - 1] = shimmer.wrapFunction(cb, cb => function (error) {
|
|
80
73
|
if (error) {
|
|
81
|
-
|
|
74
|
+
ctx.error = error
|
|
75
|
+
requestErrorCh.publish(ctx)
|
|
82
76
|
}
|
|
83
77
|
|
|
84
|
-
requestFinishCh.
|
|
78
|
+
return requestFinishCh.runStores(ctx, cb, this, ...arguments)
|
|
79
|
+
})
|
|
85
80
|
|
|
86
|
-
return outerAsyncResource.runInAsyncScope(() => cb.apply(this, arguments))
|
|
87
|
-
}))
|
|
88
|
-
|
|
89
|
-
return method.apply(this, arguments)
|
|
90
|
-
} else {
|
|
91
81
|
return method.apply(this, arguments)
|
|
92
|
-
.then(
|
|
93
|
-
response => {
|
|
94
|
-
requestFinishCh.publish()
|
|
95
|
-
return response
|
|
96
|
-
},
|
|
97
|
-
error => {
|
|
98
|
-
requestErrorCh.publish(error)
|
|
99
|
-
requestFinishCh.publish()
|
|
100
|
-
throw error
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
82
|
}
|
|
83
|
+
return method.apply(this, arguments)
|
|
84
|
+
.then(
|
|
85
|
+
response => {
|
|
86
|
+
requestFinishCh.publish(ctx)
|
|
87
|
+
return response
|
|
88
|
+
},
|
|
89
|
+
error => {
|
|
90
|
+
ctx.error = error
|
|
91
|
+
requestErrorCh.publish(ctx)
|
|
92
|
+
requestFinishCh.publish(ctx)
|
|
93
|
+
throw error
|
|
94
|
+
}
|
|
95
|
+
)
|
|
104
96
|
})
|
|
105
97
|
}
|
|
106
98
|
}
|
|
@@ -119,16 +111,14 @@ addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'] }, (obj) => {
|
|
|
119
111
|
shimmer.wrap(Subscription.prototype, 'emit', emit => function (eventName, message) {
|
|
120
112
|
if (eventName !== 'message' || !message) return emit.apply(this, arguments)
|
|
121
113
|
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
})
|
|
114
|
+
const ctx = {}
|
|
115
|
+
try {
|
|
116
|
+
return emit.apply(this, arguments)
|
|
117
|
+
} catch (err) {
|
|
118
|
+
ctx.error = err
|
|
119
|
+
receiveErrorCh.publish(ctx)
|
|
120
|
+
throw err
|
|
121
|
+
}
|
|
132
122
|
})
|
|
133
123
|
|
|
134
124
|
return obj
|
|
@@ -136,22 +126,24 @@ addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'] }, (obj) => {
|
|
|
136
126
|
|
|
137
127
|
addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'], file: 'build/src/lease-manager.js' }, (obj) => {
|
|
138
128
|
const LeaseManager = obj.LeaseManager
|
|
129
|
+
const ctx = {}
|
|
139
130
|
|
|
140
131
|
shimmer.wrap(LeaseManager.prototype, '_dispense', dispense => function (message) {
|
|
141
132
|
if (receiveStartCh.hasSubscribers) {
|
|
142
|
-
|
|
133
|
+
ctx.message = message
|
|
134
|
+
return receiveStartCh.runStores(ctx, dispense, this, ...arguments)
|
|
143
135
|
}
|
|
144
136
|
return dispense.apply(this, arguments)
|
|
145
137
|
})
|
|
146
138
|
|
|
147
139
|
shimmer.wrap(LeaseManager.prototype, 'remove', remove => function (message) {
|
|
148
|
-
receiveFinishCh.
|
|
149
|
-
return remove.apply(this, arguments)
|
|
140
|
+
return receiveFinishCh.runStores(ctx, remove, this, ...arguments)
|
|
150
141
|
})
|
|
151
142
|
|
|
152
143
|
shimmer.wrap(LeaseManager.prototype, 'clear', clear => function () {
|
|
153
144
|
for (const message of this._messages) {
|
|
154
|
-
|
|
145
|
+
ctx.message = message
|
|
146
|
+
receiveFinishCh.publish(ctx)
|
|
155
147
|
}
|
|
156
148
|
return clear.apply(this, arguments)
|
|
157
149
|
})
|