![]() |
VOOZH | about |
Early Flake Detection is Datadog’s test flakiness solution that enhances code quality by identifying flaky tests early in the development cycle. For more information about flaky tests, see Flaky Test Management.
By running newly added tests multiple times, Datadog can detect flakiness before these tests are merged into the default branch. A study shows that up to 75% of flaky tests can be identified with this approach.
Running a test multiple times increases the likelihood of exposing random conditions that cause flakiness. Early Flake Detection helps ensure that only stable, reliable tests are integrated into the default branch:
You can choose to block the merge of the feature branch with a PR Gate. For more information, see the PR Gates documentation.
Before implementing Early Flake Detection, you must configure Test Optimization for your development environment. If you are reporting data through the Datadog Agent, use v6.40 or 7.40 and later.
After you set up your Datadog library for Test Optimization, configure Early Flake Detection in CI/CD Optimization settings. You can apply the setting at the organization, repository, or test service level.
dd-trace-js>=5.23.0
The test framework compatibility is the same as Test Optimization Compatibility, with the exception of playwright, which is only supported from >=1.38.0.
dd-trace-java>=1.34.0
The test framework compatibility is the same as Test Optimization Compatibility, with the exception of Scala Weaver.
dd-trace-dotnet>=2.51.0
dd-trace-py >= 3.0.0 (pytest >= 7.2.0)
datadog-ci-rb>=1.5.0
orchestrion >= 0.9.4 + dd-trace-go >= 1.69.1
dd-sdk-swift-testing>=2.5.2
The following Datadog library versions add pagination support on the known tests endpoint:
| Library | Minimum version |
|---|---|
dd-trace-js | 5.94.0 |
dd-trace-java | 1.60.0 |
dd-trace-dotnet | 3.42.0 |
ddtrace (Python) | 4.6.0 |
datadog-ci (Ruby) | 1.27.0 |
dd-trace-go/v2 | 2.8.0 |
dd-sdk-swift-testing | 2.6.7 |
You can use the following facets to query sessions that run Early Flake Detection and new tests in the Test Optimization Explorer.
@test.early_flake.enabled tag set to true.@test.is_new tag set to true, and retries for this test have the @test.is_retry tag set to true.If you suspect there are issues with Early Flake Detection, open CI/CD Optimization settings, find your repository or test service, and toggle Early Flake Detection off.
This could be caused by a couple of reasons:
Finally, if your test service has more than 100,000 known tests and your Datadog library version does not support pagination on the known tests endpoint, the library cannot fetch the known tests baseline and no tests are identified as new. To prevent this, update to the latest tracer version.
If a test hasn’t been active for more than 14 days, it might be re-identified as new.
If the Datadog library can’t fetch the full list of known tests, the Datadog library may retry tests that are not new. There is a mechanism to prevent this error from slowing down the CI pipeline, but if it happens, contact Datadog Support.
Additional helpful documentation, links, and articles:
| |