Skip to content

Conversation

vitor-de-araujo
Copy link
Contributor

@vitor-de-araujo vitor-de-araujo commented Oct 20, 2025

Description

Currently, if a request to the Test Optimization settings API fails with a 500 or other server error, we do not try again, and run the test session with Test Optimization features disabled. This PR adds retries to the Test Optimization API requests, for server errors (status >= 500; it does not make sense to retry 4xx errors as they are unlikely to succeed if called again with the same parameters) and network errors (such as timeout).

Testing

Unit tests added.

Risks

None.

Additional Notes

None.

Copy link
Contributor

github-actions bot commented Oct 20, 2025

CODEOWNERS have been resolved as:

ddtrace/internal/ci_visibility/_api_client.py                           @DataDog/ci-app-libraries
ddtrace/internal/ci_visibility/telemetry/api_request.py                 @DataDog/ci-app-libraries
tests/ci_visibility/api_client/test_ci_visibility_api_client.py         @DataDog/ci-app-libraries

Copy link
Contributor

github-actions bot commented Oct 20, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 221 ± 4 ms.

The average import time from base is: 221 ± 2 ms.

The import time difference between this PR and base is: 0.1 ± 0.1 ms.

The difference is not statistically significant (z = 0.84).

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 1.445 ms (0.65%)
ddtrace.bootstrap.sitecustomize 0.936 ms (0.42%)
ddtrace.bootstrap.preload 0.936 ms (0.42%)
ddtrace.internal.remoteconfig.client 0.487 ms (0.22%)
ddtrace 0.509 ms (0.23%)
ddtrace.internal._unpatched 0.037 ms (0.02%)
json 0.037 ms (0.02%)
json.decoder 0.037 ms (0.02%)
re 0.037 ms (0.02%)
enum 0.037 ms (0.02%)
types 0.037 ms (0.02%)

@vitor-de-araujo vitor-de-araujo marked this pull request as ready for review October 20, 2025 14:58
@vitor-de-araujo vitor-de-araujo requested a review from a team as a code owner October 20, 2025 14:58
Comment on lines +269 to +273
_get_setting_api_response(status_code=500),
_get_setting_api_response(status_code=500),
_get_setting_api_response(status_code=500),
_get_setting_api_response(status_code=500),
_get_setting_api_response(status_code=500),
Copy link
Member

Choose a reason for hiding this comment

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

nit: since the code allows for >500, why not add 504 or other status codes here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants