dd-trace 5.52.0 → 5.54.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/README.md +5 -0
- package/index.d.ts +87 -22
- package/initialize.mjs +3 -4
- package/package.json +36 -34
- 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 +57 -37
- 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 +5 -4
- package/packages/datadog-instrumentations/src/child_process.js +3 -3
- package/packages/datadog-instrumentations/src/confluentinc-kafka-javascript.js +92 -62
- package/packages/datadog-instrumentations/src/couchbase.js +5 -4
- package/packages/datadog-instrumentations/src/cucumber.js +126 -84
- package/packages/datadog-instrumentations/src/cypress.js +2 -1
- package/packages/datadog-instrumentations/src/dns.js +1 -1
- package/packages/datadog-instrumentations/src/express.js +2 -6
- package/packages/datadog-instrumentations/src/fs.js +7 -6
- package/packages/datadog-instrumentations/src/google-cloud-pubsub.js +28 -34
- 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/helpers/extract-package-and-module-path.js +16 -10
- package/packages/datadog-instrumentations/src/helpers/hook.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/hooks.js +1 -1
- package/packages/datadog-instrumentations/src/helpers/instrument.js +1 -41
- package/packages/datadog-instrumentations/src/helpers/register.js +21 -18
- package/packages/datadog-instrumentations/src/http/client.js +16 -21
- package/packages/datadog-instrumentations/src/iovalkey.js +51 -0
- package/packages/datadog-instrumentations/src/jest.js +184 -87
- package/packages/datadog-instrumentations/src/kafkajs.js +65 -44
- package/packages/datadog-instrumentations/src/knex.js +4 -4
- package/packages/datadog-instrumentations/src/ldapjs.js +3 -4
- package/packages/datadog-instrumentations/src/mariadb.js +38 -61
- package/packages/datadog-instrumentations/src/mocha/main.js +85 -59
- package/packages/datadog-instrumentations/src/mocha/utils.js +103 -82
- package/packages/datadog-instrumentations/src/mocha/worker.js +6 -0
- package/packages/datadog-instrumentations/src/mongodb-core.js +1 -1
- package/packages/datadog-instrumentations/src/mysql.js +20 -36
- package/packages/datadog-instrumentations/src/mysql2.js +55 -47
- package/packages/datadog-instrumentations/src/net.js +4 -2
- package/packages/datadog-instrumentations/src/next.js +7 -14
- package/packages/datadog-instrumentations/src/nyc.js +1 -1
- package/packages/datadog-instrumentations/src/openai.js +21 -23
- package/packages/datadog-instrumentations/src/oracledb.js +1 -1
- package/packages/datadog-instrumentations/src/pg.js +6 -13
- package/packages/datadog-instrumentations/src/playwright.js +170 -136
- package/packages/datadog-instrumentations/src/redis.js +3 -3
- package/packages/datadog-instrumentations/src/restify.js +2 -2
- package/packages/datadog-instrumentations/src/rhea.js +42 -54
- package/packages/datadog-instrumentations/src/router.js +22 -25
- package/packages/datadog-instrumentations/src/tedious.js +1 -1
- package/packages/datadog-instrumentations/src/url.js +9 -17
- package/packages/datadog-instrumentations/src/vitest.js +126 -97
- 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-aws-sdk/src/base.js +3 -2
- 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/dynamodb.js +24 -31
- package/packages/datadog-plugin-aws-sdk/src/services/eventbridge.js +2 -2
- package/packages/datadog-plugin-aws-sdk/src/services/kinesis.js +6 -6
- package/packages/datadog-plugin-aws-sdk/src/services/lambda.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sns.js +1 -1
- package/packages/datadog-plugin-aws-sdk/src/services/sqs.js +4 -5
- 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 +86 -20
- package/packages/datadog-plugin-cypress/src/cypress-plugin.js +97 -27
- package/packages/datadog-plugin-cypress/src/plugin.js +11 -1
- package/packages/datadog-plugin-cypress/src/support.js +24 -5
- 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 +26 -9
- package/packages/datadog-plugin-graphql/src/execute.js +2 -2
- package/packages/datadog-plugin-graphql/src/index.js +7 -6
- package/packages/datadog-plugin-graphql/src/resolve.js +2 -2
- 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 +18 -7
- package/packages/datadog-plugin-http2/src/client.js +20 -20
- package/packages/datadog-plugin-iovalkey/src/index.js +18 -0
- package/packages/datadog-plugin-jest/src/index.js +36 -28
- 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 +15 -7
- 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 +88 -48
- package/packages/datadog-plugin-mongodb-core/src/index.js +1 -1
- package/packages/datadog-plugin-mysql/src/index.js +11 -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 +6 -5
- package/packages/datadog-plugin-openai/src/services.js +6 -10
- package/packages/datadog-plugin-openai/src/tracing.js +10 -14
- package/packages/datadog-plugin-oracledb/src/index.js +1 -1
- package/packages/datadog-plugin-playwright/src/index.js +48 -22
- package/packages/datadog-plugin-redis/src/index.js +9 -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 +99 -72
- package/packages/datadog-shimmer/src/shimmer.js +163 -36
- 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/graphql.js +2 -2
- 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 +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/hardcoded-secrets-rules.js +1 -1
- package/packages/dd-trace/src/appsec/iast/analyzers/header-injection-analyzer.js +4 -6
- 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 +4 -6
- 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 +6 -13
- 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 +1 -7
- 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 +5 -7
- 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 +6 -6
- package/packages/dd-trace/src/appsec/iast/telemetry/verbosity.js +1 -1
- 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 -24
- 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/vulnerability-reporter.js +9 -11
- package/packages/dd-trace/src/appsec/index.js +15 -12
- package/packages/dd-trace/src/appsec/rasp/index.js +19 -17
- package/packages/dd-trace/src/appsec/rasp/lfi.js +2 -1
- package/packages/dd-trace/src/appsec/rasp/utils.js +11 -6
- package/packages/dd-trace/src/appsec/reporter.js +233 -40
- package/packages/dd-trace/src/appsec/rule_manager.js +2 -2
- package/packages/dd-trace/src/appsec/sdk/user_blocking.js +2 -2
- package/packages/dd-trace/src/appsec/stack_trace.js +2 -4
- package/packages/dd-trace/src/appsec/telemetry/index.js +1 -2
- package/packages/dd-trace/src/appsec/telemetry/rasp.js +3 -14
- 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 -8
- package/packages/dd-trace/src/azure_metadata.js +2 -7
- package/packages/dd-trace/src/ci-visibility/dynamic-instrumentation/index.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/di-logs-writer.js +1 -1
- package/packages/dd-trace/src/ci-visibility/exporters/agentless/writer.js +1 -1
- 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 +2 -2
- 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 +1 -1
- package/packages/dd-trace/src/ci-visibility/log-submission/log-submission-plugin.js +1 -1
- package/packages/dd-trace/src/ci-visibility/requests/get-library-configuration.js +8 -5
- 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 +1 -1
- package/packages/dd-trace/src/config.js +82 -51
- package/packages/dd-trace/src/config_stable.js +3 -3
- package/packages/dd-trace/src/datastreams/encoding.js +9 -9
- package/packages/dd-trace/src/datastreams/fnv.js +1 -1
- 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 +1 -1
- 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 +131 -72
- package/packages/dd-trace/src/debugger/devtools_client/condition.js +6 -8
- package/packages/dd-trace/src/debugger/devtools_client/defaults.js +1 -1
- package/packages/dd-trace/src/debugger/devtools_client/index.js +17 -27
- package/packages/dd-trace/src/debugger/devtools_client/remote_config.js +18 -38
- package/packages/dd-trace/src/debugger/devtools_client/send.js +8 -7
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/index.js +16 -8
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/processor.js +8 -10
- package/packages/dd-trace/src/debugger/devtools_client/snapshot/redaction.js +3 -3
- package/packages/dd-trace/src/debugger/devtools_client/source-maps.js +2 -10
- package/packages/dd-trace/src/debugger/devtools_client/state.js +31 -4
- package/packages/dd-trace/src/dogstatsd.js +7 -4
- package/packages/dd-trace/src/encode/0.4.js +9 -9
- package/packages/dd-trace/src/encode/0.5.js +1 -1
- package/packages/dd-trace/src/encode/agentless-ci-visibility.js +3 -3
- 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 +6 -6
- package/packages/dd-trace/src/exporters/agent/writer.js +1 -5
- package/packages/dd-trace/src/exporters/common/docker.js +1 -1
- package/packages/dd-trace/src/exporters/common/form-data.js +6 -4
- package/packages/dd-trace/src/exporters/common/request.js +1 -1
- package/packages/dd-trace/src/exporters/common/util.js +1 -1
- 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 +12 -6
- package/packages/dd-trace/src/iitm.js +10 -22
- package/packages/dd-trace/src/lambda/handler.js +6 -6
- package/packages/dd-trace/src/lambda/runtime/patch.js +4 -4
- package/packages/dd-trace/src/lambda/runtime/ritm.js +1 -1
- 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/index.js +6 -6
- package/packages/dd-trace/src/llmobs/plugins/openai.js +1 -1
- package/packages/dd-trace/src/llmobs/sdk.js +2 -2
- package/packages/dd-trace/src/llmobs/tagger.js +113 -99
- 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 +4 -4
- package/packages/dd-trace/src/log/log.js +1 -1
- package/packages/dd-trace/src/log/writer.js +2 -2
- package/packages/dd-trace/src/msgpack/chunk.js +3 -3
- package/packages/dd-trace/src/msgpack/encoder.js +28 -28
- package/packages/dd-trace/src/noop/dogstatsd.js +6 -6
- package/packages/dd-trace/src/noop/span.js +3 -5
- 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 +6 -5
- package/packages/dd-trace/src/opentracing/propagation/log.js +6 -8
- package/packages/dd-trace/src/opentracing/propagation/text_map.js +27 -23
- package/packages/dd-trace/src/opentracing/propagation/tracestate.js +8 -4
- package/packages/dd-trace/src/opentracing/span.js +9 -14
- package/packages/dd-trace/src/opentracing/tracer.js +9 -6
- 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/plugins/ci_plugin.js +62 -10
- 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 +1 -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 +23 -15
- package/packages/dd-trace/src/plugins/util/git.js +165 -11
- 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 +1 -1
- package/packages/dd-trace/src/plugins/util/test.js +311 -48
- 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 +12 -3
- package/packages/dd-trace/src/plugins/util/web.js +5 -4
- package/packages/dd-trace/src/priority_sampler.js +22 -22
- package/packages/dd-trace/src/profiling/config.js +44 -8
- package/packages/dd-trace/src/profiling/exporters/event_serializer.js +5 -5
- package/packages/dd-trace/src/profiling/exporters/file.js +2 -1
- package/packages/dd-trace/src/profiling/profiler.js +37 -2
- 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/tagger.js +3 -5
- package/packages/dd-trace/src/profiling/webspan-utils.js +1 -1
- package/packages/dd-trace/src/proxy.js +7 -13
- 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 +4 -4
- package/packages/dd-trace/src/runtime_metrics/runtime_metrics.js +2 -2
- package/packages/dd-trace/src/sampler.js +33 -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 +0 -48
- package/packages/dd-trace/src/service-naming/schemas/util.js +1 -1
- package/packages/dd-trace/src/service-naming/schemas/v0/storage.js +8 -0
- package/packages/dd-trace/src/service-naming/schemas/v0/web.js +2 -3
- package/packages/dd-trace/src/service-naming/schemas/v1/storage.js +4 -0
- package/packages/dd-trace/src/span_processor.js +3 -3
- package/packages/dd-trace/src/span_sampler.js +4 -1
- package/packages/dd-trace/src/standalone/tracesource.js +1 -1
- package/packages/dd-trace/src/startup-log.js +2 -2
- package/packages/dd-trace/src/telemetry/dependencies.js +4 -4
- 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 +1 -1
- package/packages/dd-trace/src/telemetry/telemetry.js +23 -24
- package/packages/dd-trace/src/util.js +1 -1
- 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
|
@@ -8,6 +8,7 @@ const log = require('../../dd-trace/src/log')
|
|
|
8
8
|
const testStartCh = channel('ci:cucumber:test:start')
|
|
9
9
|
const testRetryCh = channel('ci:cucumber:test:retry')
|
|
10
10
|
const testFinishCh = channel('ci:cucumber:test:finish') // used for test steps too
|
|
11
|
+
const testFnCh = channel('ci:cucumber:test:fn')
|
|
11
12
|
|
|
12
13
|
const testStepStartCh = channel('ci:cucumber:test-step:start')
|
|
13
14
|
|
|
@@ -23,6 +24,8 @@ const skippableSuitesCh = channel('ci:cucumber:test-suite:skippable')
|
|
|
23
24
|
const sessionStartCh = channel('ci:cucumber:session:start')
|
|
24
25
|
const sessionFinishCh = channel('ci:cucumber:session:finish')
|
|
25
26
|
const testManagementTestsCh = channel('ci:cucumber:test-management-tests')
|
|
27
|
+
const impactedTestsCh = channel('ci:cucumber:modified-tests')
|
|
28
|
+
const isModifiedCh = channel('ci:cucumber:is-modified-test')
|
|
26
29
|
|
|
27
30
|
const workerReportTraceCh = channel('ci:cucumber:worker-report:trace')
|
|
28
31
|
|
|
@@ -41,7 +44,7 @@ const {
|
|
|
41
44
|
} = require('../../dd-trace/src/plugins/util/test')
|
|
42
45
|
|
|
43
46
|
const isMarkedAsUnskippable = (pickle) => {
|
|
44
|
-
return
|
|
47
|
+
return pickle.tags.some(tag => tag.name === '@datadog:unskippable')
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
// We'll preserve the original coverage here
|
|
@@ -52,8 +55,9 @@ const patched = new WeakSet()
|
|
|
52
55
|
|
|
53
56
|
const lastStatusByPickleId = new Map()
|
|
54
57
|
const numRetriesByPickleId = new Map()
|
|
55
|
-
const
|
|
58
|
+
const numAttemptToCtx = new Map()
|
|
56
59
|
const newTestsByTestFullname = new Map()
|
|
60
|
+
const modifiedTestsByPickleId = new Map()
|
|
57
61
|
|
|
58
62
|
let eventDataCollector = null
|
|
59
63
|
let pickleByFile = {}
|
|
@@ -73,15 +77,17 @@ let isEarlyFlakeDetectionFaulty = false
|
|
|
73
77
|
let isFlakyTestRetriesEnabled = false
|
|
74
78
|
let isKnownTestsEnabled = false
|
|
75
79
|
let isTestManagementTestsEnabled = false
|
|
80
|
+
let isImpactedTestsEnabled = false
|
|
76
81
|
let testManagementAttemptToFixRetries = 0
|
|
77
82
|
let testManagementTests = {}
|
|
83
|
+
let modifiedTests = {}
|
|
78
84
|
let numTestRetries = 0
|
|
79
85
|
let knownTests = []
|
|
80
86
|
let skippedSuites = []
|
|
81
87
|
let isSuitesSkipped = false
|
|
82
88
|
|
|
83
89
|
function getSuiteStatusFromTestStatuses (testStatuses) {
|
|
84
|
-
if (testStatuses.
|
|
90
|
+
if (testStatuses.includes('fail')) {
|
|
85
91
|
return 'fail'
|
|
86
92
|
}
|
|
87
93
|
if (testStatuses.every(status => status === 'skip')) {
|
|
@@ -132,7 +138,7 @@ function getTestStatusFromRetries (testStatuses) {
|
|
|
132
138
|
if (testStatuses.every(status => status === 'fail')) {
|
|
133
139
|
return 'fail'
|
|
134
140
|
}
|
|
135
|
-
if (testStatuses.
|
|
141
|
+
if (testStatuses.includes('pass')) {
|
|
136
142
|
return 'pass'
|
|
137
143
|
}
|
|
138
144
|
return 'pass'
|
|
@@ -227,16 +233,12 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
227
233
|
patched.add(pl)
|
|
228
234
|
|
|
229
235
|
shimmer.wrap(pl.prototype, 'run', run => function () {
|
|
230
|
-
if (!
|
|
236
|
+
if (!testFinishCh.hasSubscribers) {
|
|
231
237
|
return run.apply(this, arguments)
|
|
232
238
|
}
|
|
233
239
|
|
|
234
240
|
let numAttempt = 0
|
|
235
241
|
|
|
236
|
-
const asyncResource = new AsyncResource('bound-anonymous-fn')
|
|
237
|
-
|
|
238
|
-
numAttemptToAsyncResource.set(numAttempt, asyncResource)
|
|
239
|
-
|
|
240
242
|
const testFileAbsolutePath = this.pickle.uri
|
|
241
243
|
|
|
242
244
|
const testSourceLine = this.gherkinDocument?.feature?.location?.line
|
|
@@ -247,9 +249,9 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
247
249
|
testSourceLine,
|
|
248
250
|
isParallel: !!process.env.CUCUMBER_WORKER_ID
|
|
249
251
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
})
|
|
252
|
+
const ctx = testStartPayload
|
|
253
|
+
numAttemptToCtx.set(numAttempt, ctx)
|
|
254
|
+
testStartCh.runStores(ctx, () => {})
|
|
253
255
|
const promises = {}
|
|
254
256
|
try {
|
|
255
257
|
this.eventBroadcaster.on('envelope', shimmer.wrapFunction(null, () => async (testCase) => {
|
|
@@ -261,11 +263,11 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
261
263
|
try {
|
|
262
264
|
const cucumberResult = this.getWorstStepResult()
|
|
263
265
|
error = getErrorFromCucumberResult(cucumberResult)
|
|
264
|
-
} catch
|
|
266
|
+
} catch {
|
|
265
267
|
// ignore error
|
|
266
268
|
}
|
|
267
269
|
|
|
268
|
-
const
|
|
270
|
+
const failedAttemptCtx = numAttemptToCtx.get(numAttempt)
|
|
269
271
|
const isFirstAttempt = numAttempt++ === 0
|
|
270
272
|
const isAtrRetry = !isFirstAttempt && isFlakyTestRetriesEnabled
|
|
271
273
|
|
|
@@ -273,23 +275,19 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
273
275
|
await promises.hitBreakpointPromise
|
|
274
276
|
}
|
|
275
277
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
testRetryCh.publish({ isFirstAttempt, error, isAtrRetry })
|
|
279
|
-
})
|
|
278
|
+
// the current span will be finished and a new one will be created
|
|
279
|
+
testRetryCh.publish({ isFirstAttempt, error, isAtrRetry, ...failedAttemptCtx.currentStore })
|
|
280
280
|
|
|
281
|
-
const
|
|
282
|
-
|
|
281
|
+
const newCtx = { ...testStartPayload, promises }
|
|
282
|
+
numAttemptToCtx.set(numAttempt, newCtx)
|
|
283
283
|
|
|
284
|
-
|
|
285
|
-
testStartCh.publish({ ...testStartPayload, promises }) // a new span will be created
|
|
286
|
-
})
|
|
284
|
+
testStartCh.runStores(newCtx, () => {})
|
|
287
285
|
}
|
|
288
286
|
}
|
|
289
287
|
}))
|
|
290
288
|
let promise
|
|
291
289
|
|
|
292
|
-
|
|
290
|
+
testFnCh.runStores(ctx, () => {
|
|
293
291
|
promise = run.apply(this, arguments)
|
|
294
292
|
})
|
|
295
293
|
promise.finally(async () => {
|
|
@@ -312,6 +310,7 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
312
310
|
let hasFailedAttemptToFix = false
|
|
313
311
|
let isDisabled = false
|
|
314
312
|
let isQuarantined = false
|
|
313
|
+
let isModified = false
|
|
315
314
|
|
|
316
315
|
if (isTestManagementTestsEnabled) {
|
|
317
316
|
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
@@ -336,46 +335,55 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
336
335
|
}
|
|
337
336
|
}
|
|
338
337
|
|
|
339
|
-
|
|
340
|
-
|
|
338
|
+
const numRetries = numRetriesByPickleId.get(this.pickle.id)
|
|
339
|
+
|
|
340
|
+
if (isImpactedTestsEnabled) {
|
|
341
|
+
isModified = modifiedTestsByPickleId.get(this.pickle.id)
|
|
342
|
+
}
|
|
341
343
|
|
|
344
|
+
if (isKnownTestsEnabled && status !== 'skip') {
|
|
342
345
|
isNew = numRetries !== undefined
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (isNew || isModified) {
|
|
343
349
|
isEfdRetry = numRetries > 0
|
|
344
350
|
}
|
|
345
351
|
|
|
346
|
-
const
|
|
352
|
+
const attemptCtx = numAttemptToCtx.get(numAttempt)
|
|
347
353
|
|
|
348
354
|
const error = getErrorFromCucumberResult(result)
|
|
349
355
|
|
|
350
356
|
if (promises.hitBreakpointPromise) {
|
|
351
357
|
await promises.hitBreakpointPromise
|
|
352
358
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
359
|
+
testFinishCh.publish({
|
|
360
|
+
status,
|
|
361
|
+
skipReason,
|
|
362
|
+
error,
|
|
363
|
+
isNew,
|
|
364
|
+
isEfdRetry,
|
|
365
|
+
isFlakyRetry: numAttempt > 0,
|
|
366
|
+
isAttemptToFix,
|
|
367
|
+
isAttemptToFixRetry,
|
|
368
|
+
hasFailedAllRetries,
|
|
369
|
+
hasPassedAllRetries,
|
|
370
|
+
hasFailedAttemptToFix,
|
|
371
|
+
isDisabled,
|
|
372
|
+
isQuarantined,
|
|
373
|
+
isModified,
|
|
374
|
+
...attemptCtx.currentStore
|
|
369
375
|
})
|
|
370
376
|
})
|
|
371
377
|
return promise
|
|
372
378
|
} catch (err) {
|
|
373
|
-
|
|
374
|
-
|
|
379
|
+
ctx.err = err
|
|
380
|
+
errorCh.runStores(ctx, () => {
|
|
381
|
+
throw err
|
|
382
|
+
})
|
|
375
383
|
}
|
|
376
384
|
})
|
|
377
385
|
shimmer.wrap(pl.prototype, 'runStep', runStep => function () {
|
|
378
|
-
if (!
|
|
386
|
+
if (!testFinishCh.hasSubscribers) {
|
|
379
387
|
return runStep.apply(this, arguments)
|
|
380
388
|
}
|
|
381
389
|
const testStep = arguments[0]
|
|
@@ -387,9 +395,8 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
387
395
|
resource = testStep.isHook ? 'hook' : testStep.pickleStep.text
|
|
388
396
|
}
|
|
389
397
|
|
|
390
|
-
const
|
|
391
|
-
return
|
|
392
|
-
testStepStartCh.publish({ resource })
|
|
398
|
+
const ctx = { resource }
|
|
399
|
+
return testStepStartCh.runStores(ctx, () => {
|
|
393
400
|
try {
|
|
394
401
|
const promise = runStep.apply(this, arguments)
|
|
395
402
|
|
|
@@ -398,12 +405,14 @@ function wrapRun (pl, isLatestVersion) {
|
|
|
398
405
|
? getStatusFromResultLatest(result)
|
|
399
406
|
: getStatusFromResult(result)
|
|
400
407
|
|
|
401
|
-
testFinishCh.publish({ isStep: true, status, skipReason, errorMessage })
|
|
408
|
+
testFinishCh.publish({ isStep: true, status, skipReason, errorMessage, ...ctx.currentStore })
|
|
402
409
|
})
|
|
403
410
|
return promise
|
|
404
411
|
} catch (err) {
|
|
405
|
-
|
|
406
|
-
|
|
412
|
+
ctx.err = err
|
|
413
|
+
errorCh.runStores(ctx, () => {
|
|
414
|
+
throw err
|
|
415
|
+
})
|
|
407
416
|
}
|
|
408
417
|
})
|
|
409
418
|
})
|
|
@@ -456,14 +465,15 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
456
465
|
isKnownTestsEnabled = configurationResponse.libraryConfig?.isKnownTestsEnabled
|
|
457
466
|
isTestManagementTestsEnabled = configurationResponse.libraryConfig?.isTestManagementEnabled
|
|
458
467
|
testManagementAttemptToFixRetries = configurationResponse.libraryConfig?.testManagementAttemptToFixRetries
|
|
468
|
+
isImpactedTestsEnabled = configurationResponse.libraryConfig?.isImpactedTestsEnabled
|
|
459
469
|
|
|
460
470
|
if (isKnownTestsEnabled) {
|
|
461
471
|
const knownTestsResponse = await getChannelPromise(knownTestsCh)
|
|
462
|
-
if (
|
|
463
|
-
knownTests = knownTestsResponse.knownTests
|
|
464
|
-
} else {
|
|
472
|
+
if (knownTestsResponse.err) {
|
|
465
473
|
isEarlyFlakeDetectionEnabled = false
|
|
466
474
|
isKnownTestsEnabled = false
|
|
475
|
+
} else {
|
|
476
|
+
knownTests = knownTestsResponse.knownTests
|
|
467
477
|
}
|
|
468
478
|
}
|
|
469
479
|
|
|
@@ -493,7 +503,7 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
493
503
|
this.pickleIds = picklesToRun
|
|
494
504
|
}
|
|
495
505
|
|
|
496
|
-
skippedSuites =
|
|
506
|
+
skippedSuites = [...filteredPickles.skippedSuites]
|
|
497
507
|
itrCorrelationId = skippableResponse.itrCorrelationId
|
|
498
508
|
}
|
|
499
509
|
}
|
|
@@ -515,10 +525,17 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
515
525
|
|
|
516
526
|
if (isTestManagementTestsEnabled) {
|
|
517
527
|
const testManagementTestsResponse = await getChannelPromise(testManagementTestsCh)
|
|
518
|
-
if (
|
|
519
|
-
testManagementTests = testManagementTestsResponse.testManagementTests
|
|
520
|
-
} else {
|
|
528
|
+
if (testManagementTestsResponse.err) {
|
|
521
529
|
isTestManagementTestsEnabled = false
|
|
530
|
+
} else {
|
|
531
|
+
testManagementTests = testManagementTestsResponse.testManagementTests
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (isImpactedTestsEnabled) {
|
|
536
|
+
const impactedTestsResponse = await getChannelPromise(impactedTestsCh)
|
|
537
|
+
if (!impactedTestsResponse.err) {
|
|
538
|
+
modifiedTests = impactedTestsResponse.modifiedTests
|
|
522
539
|
}
|
|
523
540
|
}
|
|
524
541
|
|
|
@@ -552,7 +569,7 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
552
569
|
originalCoverageMap.merge(fromCoverageMapToCoverage(untestedCoverage))
|
|
553
570
|
}
|
|
554
571
|
testCodeCoverageLinesTotal = originalCoverageMap.getCoverageSummary().lines.pct
|
|
555
|
-
} catch
|
|
572
|
+
} catch {
|
|
556
573
|
// ignore errors
|
|
557
574
|
}
|
|
558
575
|
// restore the original coverage
|
|
@@ -582,12 +599,15 @@ function getWrappedStart (start, frameworkVersion, isParallel = false, isCoordin
|
|
|
582
599
|
// Handles EFD in both the main process and the worker process.
|
|
583
600
|
function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = false, isWorker = false) {
|
|
584
601
|
return async function () {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
602
|
+
const pickle = isNewerCucumberVersion
|
|
603
|
+
? arguments[0].pickle
|
|
604
|
+
: this.eventDataCollector.getPickle(arguments[0])
|
|
605
|
+
const testCase = isNewerCucumberVersion
|
|
606
|
+
? arguments[0].testCase
|
|
607
|
+
: arguments[1]
|
|
608
|
+
const gherkinDocument = isNewerCucumberVersion
|
|
609
|
+
? arguments[0].gherkinDocument
|
|
610
|
+
: this.eventDataCollector.getGherkinDocument(pickle.uri)
|
|
591
611
|
|
|
592
612
|
const testFileAbsolutePath = pickle.uri
|
|
593
613
|
const testSuitePath = getTestSuitePath(testFileAbsolutePath, process.cwd())
|
|
@@ -609,6 +629,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
609
629
|
let isAttemptToFix = false
|
|
610
630
|
let isDisabled = false
|
|
611
631
|
let isQuarantined = false
|
|
632
|
+
let isModified = false
|
|
612
633
|
|
|
613
634
|
if (isTestManagementTestsEnabled) {
|
|
614
635
|
const testProperties = getTestProperties(testSuitePath, pickle.name)
|
|
@@ -621,6 +642,24 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
621
642
|
}
|
|
622
643
|
}
|
|
623
644
|
|
|
645
|
+
if (isImpactedTestsEnabled) {
|
|
646
|
+
const setIsModified = (receivedIsModified) => { isModified = receivedIsModified }
|
|
647
|
+
const scenarios = gherkinDocument.feature?.children?.filter(
|
|
648
|
+
children => pickle.astNodeIds.includes(children.scenario.id)
|
|
649
|
+
).map(scenario => scenario.scenario)
|
|
650
|
+
const stepIds = testCase?.testSteps?.flatMap(testStep => testStep.stepDefinitionIds)
|
|
651
|
+
|
|
652
|
+
isModifiedCh.publish({
|
|
653
|
+
scenarios,
|
|
654
|
+
testFileAbsolutePath: gherkinDocument.uri,
|
|
655
|
+
modifiedTests,
|
|
656
|
+
stepIds,
|
|
657
|
+
stepDefinitions: this.supportCodeLibrary.stepDefinitions,
|
|
658
|
+
setIsModified
|
|
659
|
+
})
|
|
660
|
+
modifiedTestsByPickleId.set(pickle.id, isModified)
|
|
661
|
+
}
|
|
662
|
+
|
|
624
663
|
if (isKnownTestsEnabled && !isAttemptToFix) {
|
|
625
664
|
isNew = isNewTest(testSuitePath, pickle.name)
|
|
626
665
|
if (isNew) {
|
|
@@ -631,7 +670,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
631
670
|
let runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
632
671
|
|
|
633
672
|
const testStatuses = lastStatusByPickleId.get(pickle.id)
|
|
634
|
-
const lastTestStatus = testStatuses
|
|
673
|
+
const lastTestStatus = testStatuses.at(-1)
|
|
635
674
|
|
|
636
675
|
// New tests should not be marked as attempt to fix, so EFD + Attempt to fix should not be enabled at the same time
|
|
637
676
|
if (isAttemptToFix && lastTestStatus !== 'skip') {
|
|
@@ -642,7 +681,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
642
681
|
}
|
|
643
682
|
|
|
644
683
|
// If it's a new test and it hasn't been skipped, we run it again
|
|
645
|
-
if (isEarlyFlakeDetectionEnabled && lastTestStatus !== 'skip' && isNew) {
|
|
684
|
+
if (isEarlyFlakeDetectionEnabled && lastTestStatus !== 'skip' && (isNew || isModified)) {
|
|
646
685
|
for (let retryIndex = 0; retryIndex < earlyFlakeDetectionNumRetries; retryIndex++) {
|
|
647
686
|
numRetriesByPickleId.set(pickle.id, retryIndex + 1)
|
|
648
687
|
runTestCaseResult = await runTestCaseFunction.apply(this, arguments)
|
|
@@ -651,7 +690,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
651
690
|
let testStatus = lastTestStatus
|
|
652
691
|
let shouldBePassedByEFD = false
|
|
653
692
|
let shouldBePassedByTestManagement = false
|
|
654
|
-
if (isNew && isEarlyFlakeDetectionEnabled) {
|
|
693
|
+
if ((isNew || isModified) && isEarlyFlakeDetectionEnabled) {
|
|
655
694
|
/**
|
|
656
695
|
* If Early Flake Detection (EFD) is enabled the logic is as follows:
|
|
657
696
|
* - If all attempts for a test are failing, the test has failed and we will let the test process fail.
|
|
@@ -672,10 +711,10 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
672
711
|
shouldBePassedByTestManagement = true
|
|
673
712
|
}
|
|
674
713
|
|
|
675
|
-
if (
|
|
676
|
-
pickleResultByFile[testFileAbsolutePath] = [testStatus]
|
|
677
|
-
} else {
|
|
714
|
+
if (pickleResultByFile[testFileAbsolutePath]) {
|
|
678
715
|
pickleResultByFile[testFileAbsolutePath].push(testStatus)
|
|
716
|
+
} else {
|
|
717
|
+
pickleResultByFile[testFileAbsolutePath] = [testStatus]
|
|
679
718
|
}
|
|
680
719
|
|
|
681
720
|
// If it's a worker, suite events are handled in `getWrappedParseWorkerMessage`
|
|
@@ -699,7 +738,7 @@ function getWrappedRunTestCase (runTestCaseFunction, isNewerCucumberVersion = fa
|
|
|
699
738
|
testSuiteFinishCh.publish({ status: testSuiteStatus, testSuitePath })
|
|
700
739
|
}
|
|
701
740
|
|
|
702
|
-
if (isNewerCucumberVersion && isEarlyFlakeDetectionEnabled && isNew) {
|
|
741
|
+
if (isNewerCucumberVersion && isEarlyFlakeDetectionEnabled && (isNew || isModified)) {
|
|
703
742
|
return shouldBePassedByEFD
|
|
704
743
|
}
|
|
705
744
|
|
|
@@ -726,13 +765,7 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion)
|
|
|
726
765
|
}
|
|
727
766
|
}
|
|
728
767
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
if (isNewVersion) {
|
|
732
|
-
envelope = message.envelope
|
|
733
|
-
} else {
|
|
734
|
-
envelope = message.jsonEnvelope
|
|
735
|
-
}
|
|
768
|
+
const envelope = isNewVersion ? message.envelope : message.jsonEnvelope
|
|
736
769
|
|
|
737
770
|
if (!envelope) {
|
|
738
771
|
return parseWorkerMessageFunction.apply(this, arguments)
|
|
@@ -742,7 +775,7 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion)
|
|
|
742
775
|
if (typeof parsed === 'string') {
|
|
743
776
|
try {
|
|
744
777
|
parsed = JSON.parse(envelope)
|
|
745
|
-
} catch
|
|
778
|
+
} catch {
|
|
746
779
|
// ignore errors and continue
|
|
747
780
|
return parseWorkerMessageFunction.apply(this, arguments)
|
|
748
781
|
}
|
|
@@ -795,11 +828,11 @@ function getWrappedParseWorkerMessage (parseWorkerMessageFunction, isNewVersion)
|
|
|
795
828
|
if (isEarlyFlakeDetectionEnabled && isNew) {
|
|
796
829
|
const testFullname = `${pickle.uri}:${pickle.name}`
|
|
797
830
|
let testStatuses = newTestsByTestFullname.get(testFullname)
|
|
798
|
-
if (
|
|
831
|
+
if (testStatuses) {
|
|
832
|
+
testStatuses.push(status)
|
|
833
|
+
} else {
|
|
799
834
|
testStatuses = [status]
|
|
800
835
|
newTestsByTestFullname.set(testFullname, testStatuses)
|
|
801
|
-
} else {
|
|
802
|
-
testStatuses.push(status)
|
|
803
836
|
}
|
|
804
837
|
// We have finished all retries
|
|
805
838
|
if (testStatuses.length === earlyFlakeDetectionNumRetries + 1) {
|
|
@@ -952,6 +985,11 @@ addHook({
|
|
|
952
985
|
this.options.worldParameters._ddEarlyFlakeDetectionNumRetries = earlyFlakeDetectionNumRetries
|
|
953
986
|
}
|
|
954
987
|
|
|
988
|
+
if (isImpactedTestsEnabled) {
|
|
989
|
+
this.options.worldParameters._ddImpactedTestsEnabled = isImpactedTestsEnabled
|
|
990
|
+
this.options.worldParameters._ddModifiedTests = modifiedTests
|
|
991
|
+
}
|
|
992
|
+
|
|
955
993
|
return startWorker.apply(this, arguments)
|
|
956
994
|
})
|
|
957
995
|
return adapterPackage
|
|
@@ -978,6 +1016,10 @@ addHook({
|
|
|
978
1016
|
if (isEarlyFlakeDetectionEnabled) {
|
|
979
1017
|
earlyFlakeDetectionNumRetries = this.options.worldParameters._ddEarlyFlakeDetectionNumRetries
|
|
980
1018
|
}
|
|
1019
|
+
isImpactedTestsEnabled = !!this.options.worldParameters._ddImpactedTestsEnabled
|
|
1020
|
+
if (isImpactedTestsEnabled) {
|
|
1021
|
+
modifiedTests = this.options.worldParameters._ddModifiedTests
|
|
1022
|
+
}
|
|
981
1023
|
}
|
|
982
1024
|
)
|
|
983
1025
|
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)
|
|
@@ -149,11 +149,9 @@ addHook({ name: 'express', versions: ['>=4.3.0 <5.0.0'] }, express => {
|
|
|
149
149
|
const queryReadCh = channel('datadog:express:query:finish')
|
|
150
150
|
|
|
151
151
|
addHook({ name: 'express', file: ['lib/request.js'], versions: ['>=5.0.0'] }, request => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
shimmer.wrap(requestDescriptor, 'get', function (originalGet) {
|
|
152
|
+
shimmer.wrap(request, 'query', function (originalGet) {
|
|
155
153
|
return function wrappedGet () {
|
|
156
|
-
const query = originalGet.
|
|
154
|
+
const query = originalGet.call(this)
|
|
157
155
|
|
|
158
156
|
if (queryReadCh.hasSubscribers && query) {
|
|
159
157
|
queryReadCh.publish({ query })
|
|
@@ -163,7 +161,5 @@ addHook({ name: 'express', file: ['lib/request.js'], versions: ['>=5.0.0'] }, re
|
|
|
163
161
|
}
|
|
164
162
|
})
|
|
165
163
|
|
|
166
|
-
Object.defineProperty(request, 'query', requestDescriptor)
|
|
167
|
-
|
|
168
164
|
return request
|
|
169
165
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { errorMonitor } = require('events')
|
|
3
4
|
const { channel, addHook } = require('./helpers/instrument')
|
|
4
5
|
const shimmer = require('../../datadog-shimmer')
|
|
5
6
|
|
|
@@ -199,16 +200,16 @@ function wrapCreateStream (original) {
|
|
|
199
200
|
}
|
|
200
201
|
const onFinish = () => {
|
|
201
202
|
finishChannel.runStores(ctx, () => {})
|
|
202
|
-
stream.
|
|
203
|
-
stream.
|
|
204
|
-
stream.
|
|
205
|
-
stream.
|
|
203
|
+
stream.removeListener('close', onFinish)
|
|
204
|
+
stream.removeListener('end', onFinish)
|
|
205
|
+
stream.removeListener('finish', onFinish)
|
|
206
|
+
stream.removeListener(errorMonitor, onError)
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
stream.once('close', onFinish)
|
|
209
210
|
stream.once('end', onFinish)
|
|
210
211
|
stream.once('finish', onFinish)
|
|
211
|
-
stream.once(
|
|
212
|
+
stream.once(errorMonitor, onError)
|
|
212
213
|
|
|
213
214
|
return stream
|
|
214
215
|
} catch (error) {
|
|
@@ -365,7 +366,7 @@ function massWrap (target, methods, wrapper) {
|
|
|
365
366
|
function wrap (target, method, wrapper) {
|
|
366
367
|
try {
|
|
367
368
|
shimmer.wrap(target, method, wrapper)
|
|
368
|
-
} catch
|
|
369
|
+
} catch {
|
|
369
370
|
// skip unavailable method
|
|
370
371
|
}
|
|
371
372
|
}
|
|
@@ -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,38 +64,32 @@ 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.
|
|
85
|
-
|
|
86
|
-
return outerAsyncResource.runInAsyncScope(() => cb.apply(this, arguments))
|
|
87
|
-
}))
|
|
78
|
+
return requestFinishCh.runStores(ctx, cb, this, ...arguments)
|
|
79
|
+
})
|
|
88
80
|
|
|
89
81
|
return method.apply(this, arguments)
|
|
90
82
|
} else {
|
|
91
83
|
return method.apply(this, arguments)
|
|
92
84
|
.then(
|
|
93
85
|
response => {
|
|
94
|
-
requestFinishCh.publish()
|
|
86
|
+
requestFinishCh.publish(ctx)
|
|
95
87
|
return response
|
|
96
88
|
},
|
|
97
89
|
error => {
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
ctx.error = error
|
|
91
|
+
requestErrorCh.publish(ctx)
|
|
92
|
+
requestFinishCh.publish(ctx)
|
|
100
93
|
throw error
|
|
101
94
|
}
|
|
102
95
|
)
|
|
@@ -119,16 +112,14 @@ addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'] }, (obj) => {
|
|
|
119
112
|
shimmer.wrap(Subscription.prototype, 'emit', emit => function (eventName, message) {
|
|
120
113
|
if (eventName !== 'message' || !message) return emit.apply(this, arguments)
|
|
121
114
|
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
})
|
|
115
|
+
const ctx = {}
|
|
116
|
+
try {
|
|
117
|
+
return emit.apply(this, arguments)
|
|
118
|
+
} catch (err) {
|
|
119
|
+
ctx.error = err
|
|
120
|
+
receiveErrorCh.publish(ctx)
|
|
121
|
+
throw err
|
|
122
|
+
}
|
|
132
123
|
})
|
|
133
124
|
|
|
134
125
|
return obj
|
|
@@ -136,22 +127,25 @@ addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'] }, (obj) => {
|
|
|
136
127
|
|
|
137
128
|
addHook({ name: '@google-cloud/pubsub', versions: ['>=1.2'], file: 'build/src/lease-manager.js' }, (obj) => {
|
|
138
129
|
const LeaseManager = obj.LeaseManager
|
|
130
|
+
const ctx = {}
|
|
139
131
|
|
|
140
132
|
shimmer.wrap(LeaseManager.prototype, '_dispense', dispense => function (message) {
|
|
141
133
|
if (receiveStartCh.hasSubscribers) {
|
|
142
|
-
|
|
134
|
+
ctx.message = message
|
|
135
|
+
return receiveStartCh.runStores(ctx, dispense, this, ...arguments)
|
|
136
|
+
} else {
|
|
137
|
+
return dispense.apply(this, arguments)
|
|
143
138
|
}
|
|
144
|
-
return dispense.apply(this, arguments)
|
|
145
139
|
})
|
|
146
140
|
|
|
147
141
|
shimmer.wrap(LeaseManager.prototype, 'remove', remove => function (message) {
|
|
148
|
-
receiveFinishCh.
|
|
149
|
-
return remove.apply(this, arguments)
|
|
142
|
+
return receiveFinishCh.runStores(ctx, remove, this, ...arguments)
|
|
150
143
|
})
|
|
151
144
|
|
|
152
145
|
shimmer.wrap(LeaseManager.prototype, 'clear', clear => function () {
|
|
153
146
|
for (const message of this._messages) {
|
|
154
|
-
|
|
147
|
+
ctx.message = message
|
|
148
|
+
receiveFinishCh.publish(ctx)
|
|
155
149
|
}
|
|
156
150
|
return clear.apply(this, arguments)
|
|
157
151
|
})
|