Skip to content

feat(test-optimization): add EFD retry count override#9344

Merged
juan-fernandez merged 3 commits into
masterfrom
juan-fernandez/early-flake-retry-count
Jul 15, 2026
Merged

feat(test-optimization): add EFD retry count override#9344
juan-fernandez merged 3 commits into
masterfrom
juan-fernandez/early-flake-retry-count

Conversation

@juan-fernandez

@juan-fernandez juan-fernandez commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds DD_TEST_EARLY_FLAKE_DETECTION_RETRY_COUNT, an optional non-negative integer that overrides the number of Early Flake Detection retries in each supported duration bucket.

When set, the 5s, 10s, 30s, and 5m buckets all use this value. Tests lasting at least five minutes retain the existing no-retry behavior. When the variable is unset, the backend-provided duration policy remains unchanged. Setting it to 0 disables EFD retries.

Motivation

DD_CIVISIBILITY_FLAKY_RETRY_COUNT controls Automatic Test Retries, but it does not limit Early Flake Detection. This makes it possible for EFD's duration buckets to run a new test more times than the configured ATR retry count, increasing CI duration unexpectedly.

The new setting provides a separate, explicit EFD retry limit while preserving the existing backend policy by default.

Additional Notes

The override is applied at the shared library-configuration boundary, so it covers Playwright, Jest, Mocha, Cucumber, Vitest, and Cypress.

The generated retry policy uses only the standard duration-bucket keys; it does not introduce an additional sentinel key.

Validation performed:

  • Added a Playwright integration test that failed before the implementation (1 !== 2) and passes afterward.
  • Passed the full config, CI Visibility exporter, and shared test utility unit suites.
  • Confirmed statement and branch coverage on every changed production line.
  • Passed targeted ESLint, generated config type verification, CODEOWNERS validation, exercised-test validation, and git diff --check.

@datadog-official

datadog-official Bot commented Jul 14, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.61% (+0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f071805 | Docs | Datadog PR Page | Give us feedback!

@datadog-official

datadog-official Bot commented Jul 14, 2026

Copy link
Copy Markdown

View session in Datadog

Bits Code status: ✅ Done

Comment @DataDog to request changes

@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.77 MB
Deduped: 7.43 MB
No deduping: 7.43 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.1 | 122.62 kB | 438.86 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-15 10:22:32

Comparing candidate commit f071805 in PR branch juan-fernandez/early-flake-retry-count with baseline commit 9c965cc in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2308 metrics, 50 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-210.750ms; +204.810ms] or [-7.943%; +7.719%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-228.996ms; +222.967ms] or [-8.961%; +8.725%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-129.078ms; +179.336ms] or [-4.217%; +5.859%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-190.760ms; +187.861ms] or [-6.561%; +6.462%]

scenario:appsec-control-20

  • unstable execution_time [-122.377ms; +114.029ms] or [-7.459%; +6.950%]

scenario:appsec-control-24

  • unstable execution_time [-116.085ms; +112.901ms] or [-9.366%; +9.109%]

scenario:appsec-control-26

  • unstable execution_time [-131.005ms; +107.567ms] or [-10.690%; +8.778%]

scenario:appsec-iast-no-vulnerability-control-20

  • unstable execution_time [-10.531ms; +24.179ms] or [-4.027%; +9.246%]

scenario:appsec-iast-no-vulnerability-iast-enabled-always-active-20

  • unstable execution_time [-16.584ms; +14.202ms] or [-6.374%; +5.459%]

scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-17.508ms; +9.905ms] or [-6.906%; +3.907%]

scenario:child_process-shell-string-24

  • unstable execution_time [-12.266ms; +26.868ms] or [-3.815%; +8.358%]
  • unstable throughput [-249498.983op/s; +116058.021op/s] or [-6.862%; +3.192%]

scenario:debugger-line-probe-with-snapshot-default-24

  • unstable cpu_user_time [-1522.702ms; +553.366ms] or [-17.946%; +6.522%]
  • unstable execution_time [-1595.192ms; +653.460ms] or [-17.282%; +7.079%]
  • unstable instructions [-12.9G instructions; +4.5G instructions] or [-18.657%; +6.501%]
  • unstable throughput [-230.337op/s; +495.129op/s] or [-6.497%; +13.966%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-4149.835ms; +2302.234ms] or [-37.920%; +21.037%]
  • unstable execution_time [-4186.996ms; +2316.246ms] or [-35.815%; +19.813%]
  • unstable instructions [-37.0G instructions; +20.5G instructions] or [-40.246%; +22.294%]
  • unstable max_rss_usage [-12.817MB; +7.081MB] or [-7.791%; +4.304%]
  • unstable throughput [-515.842op/s; +839.403op/s] or [-17.552%; +28.561%]

scenario:debugger-line-probe-with-snapshot-minimal-24

  • unstable cpu_user_time [-1655.552ms; +678.730ms] or [-19.527%; +8.005%]
  • unstable execution_time [-1682.018ms; +718.747ms] or [-18.317%; +7.827%]
  • unstable instructions [-14.2G instructions; +5.6G instructions] or [-20.422%; +8.113%]
  • unstable throughput [-228.753op/s; +444.555op/s] or [-6.382%; +12.402%]

scenario:debugger-line-probe-with-snapshot-minimal-26

  • unstable cpu_user_time [-4044.251ms; +3206.147ms] or [-37.711%; +29.896%]
  • unstable execution_time [-4031.760ms; +3195.373ms] or [-35.160%; +27.866%]
  • unstable instructions [-36.2G instructions; +28.3G instructions] or [-39.930%; +31.215%]
  • unstable max_rss_usage [-13.135MB; +9.112MB] or [-8.020%; +5.564%]
  • unstable throughput [-621.989op/s; +827.069op/s] or [-20.953%; +27.861%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-2.464s; +5.247s] or [-24.272%; +51.692%]
  • unstable execution_time [-2.563s; +5.369s] or [-23.534%; +49.291%]
  • unstable instructions [-21.6G instructions; +46.2G instructions] or [-25.354%; +54.304%]
  • unstable max_rss_usage [-8.451MB; +16.504MB] or [-5.240%; +10.234%]
  • unstable throughput [-1090.109op/s; +528.268op/s] or [-35.160%; +17.039%]

scenario:dogstatsd-aggregated-20

  • unstable cpu_usage_percentage [-5.724%; +5.733%]
  • unstable execution_time [-106.085ms; +113.604ms] or [-8.158%; +8.736%]
  • unstable throughput [-732761.412op/s; +725652.162op/s] or [-6.270%; +6.209%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-291.580ms; +358.911ms] or [-6.026%; +7.417%]
  • unstable execution_time [-295.703ms; +360.992ms] or [-6.010%; +7.337%]
  • unstable throughput [-127815.007op/s; +103990.191op/s] or [-7.495%; +6.098%]

scenario:plugin-aws-sdk-extract-response-body-26

  • unstable execution_time [-68.824ms; +116.621ms] or [-4.496%; +7.619%]
  • unstable throughput [-353231.457op/s; +210914.786op/s] or [-6.697%; +3.999%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-24

  • unstable cpu_usage_percentage [-4.269%; +6.289%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable cpu_user_time [-732.550ms; +727.047ms] or [-5.711%; +5.668%]
  • unstable execution_time [-741.867ms; +735.346ms] or [-5.659%; +5.609%]
  • unstable throughput [-3.379op/s; +3.393op/s] or [-5.502%; +5.525%]

scenario:plugin-memcached-get-24

  • unstable execution_time [-107.198ms; +181.812ms] or [-4.460%; +7.565%]

scenario:plugin-pg-service-26

  • unstable execution_time [-53.693ms; +69.579ms] or [-5.872%; +7.609%]
  • unstable throughput [-451036.673op/s; +324502.756op/s] or [-6.767%; +4.869%]

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.64%. Comparing base (9c965cc) to head (f071805).
⚠️ Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9344      +/-   ##
==========================================
+ Coverage   96.61%   96.64%   +0.03%     
==========================================
  Files         920      923       +3     
  Lines      122266   122855     +589     
  Branches    21008    21343     +335     
==========================================
+ Hits       118128   118738     +610     
+ Misses       4138     4117      -21     
Flag Coverage Δ
aiguard 53.65% <100.00%> (+0.05%) ⬆️
aiguard-integration 57.10% <100.00%> (+0.13%) ⬆️
apm-bucket-0 53.88% <100.00%> (+0.05%) ⬆️
apm-bucket-1 58.45% <100.00%> (+0.35%) ⬆️
apm-bucket-2 56.18% <100.00%> (+0.04%) ⬆️
apm-capabilities-tracing 60.63% <100.00%> (+0.25%) ⬆️
apm-integrations-aerospike 53.03% <100.00%> (+0.06%) ⬆️
apm-integrations-confluentinc-kafka-javascript 57.12% <100.00%> (+0.09%) ⬆️
apm-integrations-couchbase 53.37% <100.00%> (+0.05%) ⬆️
apm-integrations-http 58.04% <100.00%> (+0.06%) ⬆️
apm-integrations-kafkajs 57.83% <100.00%> (+0.09%) ⬆️
apm-integrations-next 54.26% <100.00%> (-0.02%) ⬇️
apm-integrations-prisma 54.26% <100.00%> (+0.04%) ⬆️
apm-integrations-tedious 53.14% <100.00%> (+0.05%) ⬆️
appsec 68.85% <100.00%> (-0.11%) ⬇️
appsec-express_fastify_graphql 65.74% <100.00%> (+0.03%) ⬆️
appsec-integration 51.95% <100.00%> (+0.08%) ⬆️
appsec-kafka_ldapjs_lodash 59.17% <100.00%> (+0.06%) ⬆️
appsec-mongodb-core_mongoose_mysql 62.40% <100.00%> (+0.14%) ⬆️
appsec-next 52.88% <100.00%> (-0.01%) ⬇️
appsec-node-serialize_passport_postgres 62.04% <100.00%> (+0.15%) ⬆️
appsec-sourcing_stripe_template 60.43% <100.00%> (+0.08%) ⬆️
debugger 65.70% <100.00%> (-0.05%) ⬇️
instrumentations-bucket-0 48.88% <100.00%> (+0.08%) ⬆️
instrumentations-bucket-1 55.08% <100.00%> (+0.09%) ⬆️
instrumentations-bucket-10 56.71% <100.00%> (+0.05%) ⬆️
instrumentations-bucket-11 48.87% <100.00%> (+0.08%) ⬆️
instrumentations-bucket-12 49.05% <100.00%> (+0.15%) ⬆️
instrumentations-bucket-13 48.81% <100.00%> (+0.08%) ⬆️
instrumentations-bucket-2 50.02% <100.00%> (+0.23%) ⬆️
instrumentations-bucket-3 53.99% <100.00%> (+0.12%) ⬆️
instrumentations-bucket-4 49.29% <100.00%> (+0.08%) ⬆️
instrumentations-bucket-5 53.16% <100.00%> (+0.11%) ⬆️
instrumentations-bucket-6 55.73% <100.00%> (+0.09%) ⬆️
instrumentations-bucket-7 53.63% <100.00%> (-0.01%) ⬇️
instrumentations-bucket-8 54.76% <100.00%> (+0.09%) ⬆️
instrumentations-bucket-9 56.19% <100.00%> (+0.06%) ⬆️
instrumentations-instrumentation-couchbase 48.27% <100.00%> (+0.09%) ⬆️
instrumentations-integration-esbuild 34.07% <100.00%> (+0.17%) ⬆️
llmobs-ai_anthropic_bedrock 57.77% <100.00%> (+<0.01%) ⬆️
llmobs-bucket-1 57.11% <100.00%> (+0.07%) ⬆️
llmobs-openai 57.50% <100.00%> (+0.07%) ⬆️
llmobs-sdk 60.07% <100.00%> (+0.06%) ⬆️
llmobs-vertex-ai 54.31% <100.00%> (+0.05%) ⬆️
master-coverage 96.64% <100.00%> (?)
openfeature 54.70% <100.00%> (+0.10%) ⬆️
openfeature-unit 49.91% <100.00%> (+0.08%) ⬆️
platform-core_esbuild_instrumentations-misc 38.54% <100.00%> (+0.14%) ⬆️
platform-integration 62.33% <100.00%> (+<0.01%) ⬆️
platform-shimmer_unit-guardrails_webpack 37.33% <100.00%> (+0.10%) ⬆️
plugins-bucket-0 53.26% <100.00%> (+0.04%) ⬆️
plugins-bucket-1 55.20% <100.00%> (+0.17%) ⬆️
plugins-bucket-11 57.53% <100.00%> (+0.03%) ⬆️
plugins-bucket-18 57.14% <100.00%> (+0.04%) ⬆️
plugins-bucket-19 55.47% <100.00%> (+0.05%) ⬆️
plugins-bucket-20 57.66% <100.00%> (+0.15%) ⬆️
plugins-bucket-4 53.87% <100.00%> (-0.02%) ⬇️
plugins-bullmq_cassandra_cookie 57.47% <100.00%> (+0.09%) ⬆️
plugins-cookie-parser_crypto_dd-trace-api 52.42% <100.00%> (+0.06%) ⬆️
plugins-fetch_fs_generic-pool 54.59% <100.00%> (+0.09%) ⬆️
plugins-google-cloud-pubsub_grpc_handlebars 59.92% <100.00%> (+0.03%) ⬆️
plugins-hapi_hono_ioredis 55.86% <100.00%> (-0.04%) ⬇️
plugins-jest_knex_langgraph 51.77% <100.00%> (+0.06%) ⬆️
plugins-ldapjs_light-my-request_limitd-client 53.51% <100.00%> (+0.03%) ⬆️
plugins-lodash_mariadb_memcached 54.30% <100.00%> (+0.05%) ⬆️
plugins-moleculer_mongodb_mongodb-core 57.40% <100.00%> (+0.08%) ⬆️
plugins-mongoose_multer_mysql 54.79% <100.00%> (+0.04%) ⬆️
plugins-mysql2_nats_node-serialize 56.33% <100.00%> (+0.09%) ⬆️
plugins-opensearch_passport-http_pino 55.19% <100.00%> (+0.10%) ⬆️
plugins-postgres_process_pug 54.38% <100.00%> (+0.05%) ⬆️
plugins-redis_router_sequelize 57.19% <100.00%> (+0.16%) ⬆️
plugins-test-and-upstream-rhea_undici_url 57.06% <100.00%> (+0.01%) ⬆️
plugins-valkey_vm_winston 53.94% <100.00%> (-0.02%) ⬇️
plugins-ws 54.93% <100.00%> (+0.09%) ⬆️
profiling 58.26% <100.00%> (-0.01%) ⬇️
serverless-aws-sdk-aws-sdk 50.78% <100.00%> (+0.07%) ⬆️
serverless-aws-sdk-bedrockruntime 50.75% <100.00%> (+0.02%) ⬆️
serverless-aws-sdk-client 52.09% <100.00%> (+0.11%) ⬆️
serverless-aws-sdk-dynamodb 51.80% <100.00%> (+0.01%) ⬆️
serverless-aws-sdk-eventbridge 46.46% <100.00%> (+0.19%) ⬆️
serverless-aws-sdk-kinesis 54.79% <100.00%> (+0.05%) ⬆️
serverless-aws-sdk-lambda 52.87% <100.00%> (+0.05%) ⬆️
serverless-aws-sdk-s3 51.59% <100.00%> (+0.01%) ⬆️
serverless-aws-sdk-serverless-peer-service 54.82% <100.00%> (+0.06%) ⬆️
serverless-aws-sdk-sns 55.54% <100.00%> (+0.03%) ⬆️
serverless-aws-sdk-sqs 55.96% <100.00%> (+0.02%) ⬆️
serverless-aws-sdk-stepfunctions 51.36% <100.00%> (+0.06%) ⬆️
serverless-aws-sdk-util 48.54% <100.00%> (+0.05%) ⬆️
serverless-bucket-0 55.24% <100.00%> (+0.07%) ⬆️
serverless-bucket-1 56.07% <100.00%> (+0.01%) ⬆️
test-optimization-cucumber 72.95% <100.00%> (+<0.01%) ⬆️
test-optimization-cypress 66.36% <64.28%> (+0.08%) ⬆️
test-optimization-jest 74.29% <100.00%> (+0.02%) ⬆️
test-optimization-mocha 74.69% <100.00%> (+0.07%) ⬆️
test-optimization-playwright-playwright-atr 61.50% <64.28%> (-0.04%) ⬇️
test-optimization-playwright-playwright-efd 61.70% <100.00%> (-0.02%) ⬇️
test-optimization-playwright-playwright-final-status 61.67% <64.28%> (+0.03%) ⬆️
test-optimization-playwright-playwright-impacted-tests 61.39% <64.28%> (+0.13%) ⬆️
test-optimization-playwright-playwright-reporting 61.28% <64.28%> (-0.04%) ⬇️
test-optimization-playwright-playwright-test-management 62.23% <64.28%> (-0.09%) ⬇️
test-optimization-playwright-playwright-test-span 61.41% <64.28%> (-0.10%) ⬇️
test-optimization-selenium 60.72% <64.28%> (-0.10%) ⬇️
test-optimization-testopt 59.16% <64.28%> (+0.11%) ⬆️
test-optimization-vitest 71.40% <64.28%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2c14f5c42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js Outdated
Comment thread packages/dd-trace/src/ci-visibility/exporters/ci-visibility-exporter.js Outdated
Comment thread packages/dd-trace/src/config/supported-configurations.json
@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: f071805688

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@juan-fernandez
juan-fernandez marked this pull request as ready for review July 15, 2026 10:42
@juan-fernandez
juan-fernandez requested review from a team as code owners July 15, 2026 10:42
@juan-fernandez
juan-fernandez requested review from khanayan123 and removed request for a team July 15, 2026 10:42

@datadog-official datadog-official Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datadog Autotest: PASS

More details

PR adds DD_TEST_EARLY_FLAKE_DETECTION_RETRY_COUNT to override EFD retry counts across all duration buckets. Implementation correctly filters the backend's duration-based policy, applies the override uniformly, and preserves existing behavior when unset. All 8 new tests pass (unit, config, and integration), edge cases are handled properly, and the feature integrates cleanly with existing EFD and flaky retry systems.

Was this helpful? React 👍 or 👎

📊 Validated against 30 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit f071805 · What is Autotest? · Any feedback? Reach out in #autotest

@juan-fernandez
juan-fernandez merged commit 7358b50 into master Jul 15, 2026
658 checks passed
@juan-fernandez
juan-fernandez deleted the juan-fernandez/early-flake-retry-count branch July 15, 2026 11:31
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 16, 2026
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants