Skip to content

fix(test-optimization): retry transient HTTP responses - #10039

Merged
juan-fernandez merged 1 commit into
masterfrom
juan-fernandez/test-optimization-http-retries
Aug 28, 2026
Merged

juan-fernandez merged 1 commit into
masterfrom
juan-fernandez/test-optimization-http-retries

Conversation

@juan-fernandez

Copy link
Copy Markdown
Collaborator

What does this PR do?

Retries transient HTTP 408, 429, and 500-599 responses for Test Optimization payloads during both background sends and finalization. Background sends retain the existing attempt cap, while finalization retries continue only while the existing deadline has capacity.

Rate-limit reset headers remain bounded to 30 seconds for background sends. A larger reset delay is allowed during finalization only when it fits inside the finalization deadline.

Motivation

Background payload sends currently retry transient network errors but not transient HTTP responses, and HTTP 408 is not retried at all. This can drop a payload after a single temporary intake response even though the request is replayable.

This change is extracted from #9987 and is based directly on master. It is independent of #10018 and #10038.

Additional Notes

This PR intentionally excludes socket concurrency, payload buffering/backpressure, request attempt timeouts, detachment, final-flush timeout changes, and telemetry enrichment.

Verification:

  • 23 Test Optimization exporter request tests using fake timers
  • Scoped coverage for the changed request path
  • ESLint and git diff --check

Retry HTTP 408, 429, and 500-599 responses for background and finalization payload sends. Keep the existing attempt cap for background work, allow finalization retries while its deadline has capacity, and bound background rate-limit waits without constraining a larger finalization budget.
@dd-octo-sts

dd-octo-sts Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 8.42 MB
Deduped: 9.09 MB
No deduping: 9.09 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 445.14 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

@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

@codex review

@juan-fernandez

Copy link
Copy Markdown
Collaborator Author

/datadog autotest review

@datadog-prod-us1-5 datadog-prod-us1-5 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

The retry rules keep the background attempt limit and rate-limit bound. Finalization retries remain limited by the deadline.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit b0af7e2 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: b0af7e236e

ℹ️ 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".

@pr-commenter

pr-commenter Bot commented Aug 28, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-28 09:13:55

Comparing candidate commit b0af7e2 in PR branch juan-fernandez/test-optimization-http-retries with baseline commit d140900 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2297 metrics, 13 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-20

  • unstable max_rss_usage [-23.345MB; +45.424MB] or [-13.003%; +25.302%]

scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-26

  • unstable max_rss_usage [-14.745MB; +17.911MB] or [-4.547%; +5.524%]

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

  • unstable max_rss_usage [-9.788MB; +18.378MB] or [-4.051%; +7.605%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-211.851ms; +444.159ms] or [-4.335%; +9.088%]
  • unstable execution_time [-214.900ms; +447.637ms] or [-4.331%; +9.021%]
  • unstable throughput [-161408.721op/s; +77550.849op/s] or [-9.532%; +4.580%]

scenario:fs-subscribed-24

  • unstable execution_time [-19.603ms; +33.546ms] or [-4.863%; +8.323%]

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

  • unstable cpu_user_time [-46.158ms; +116.548ms] or [-2.896%; +7.313%]
  • unstable execution_time [-45.226ms; +116.090ms] or [-2.829%; +7.263%]

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

  • unstable cpu_usage_percentage [-6.986%; +3.305%]

scenario:plugin-pg-service-26

  • unstable cpu_usage_percentage [-6.502%; +4.373%]
  • unstable execution_time [-52.517ms; +75.750ms] or [-5.864%; +8.459%]
  • unstable throughput [-458600.372op/s; +326176.453op/s] or [-6.756%; +4.805%]

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Tests

✅ All CI checks and tests passed.

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 98.59% (-0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: b0af7e2 | Docs | View more details | Give us feedback!

@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.58%. Comparing base (d140900) to head (b0af7e2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10039      +/-   ##
==========================================
- Coverage   98.58%   98.58%   -0.01%     
==========================================
  Files         991      991              
  Lines      149346   149354       +8     
  Branches    12707    13085     +378     
==========================================
+ Hits       147237   147244       +7     
- Misses       2109     2110       +1     
Flag Coverage Δ
aiguard 62.53% <ø> (-0.03%) ⬇️
aiguard-integration 59.13% <ø> (ø)
apm-bucket-0 61.97% <ø> (-0.03%) ⬇️
apm-bucket-1 67.54% <ø> (-0.03%) ⬇️
apm-bucket-2 67.12% <ø> (-0.03%) ⬇️
apm-bucket-3 63.78% <ø> (-0.03%) ⬇️
apm-capabilities-tracing 62.44% <100.00%> (+<0.01%) ⬆️
apm-integrations-aerospike 59.78% <ø> (-0.03%) ⬇️
apm-integrations-confluentinc-kafka-javascript 66.10% <ø> (-0.03%) ⬇️
apm-integrations-couchbase 60.32% <ø> (-0.03%) ⬇️
apm-integrations-http 65.78% <ø> (-0.03%) ⬇️
apm-integrations-kafkajs 66.70% <ø> (-0.03%) ⬇️
apm-integrations-next 63.29% <ø> (-0.03%) ⬇️
apm-integrations-prisma 61.39% <ø> (-0.03%) ⬇️
appsec 76.59% <ø> (-0.02%) ⬇️
appsec-express_fastify_graphql 73.03% <ø> (-0.02%) ⬇️
appsec-integration 49.23% <ø> (ø)
appsec-kafka_ldapjs_lodash 67.05% <ø> (-0.03%) ⬇️
appsec-mongodb-core_mongoose_mysql 70.37% <ø> (-0.02%) ⬇️
appsec-next 56.62% <ø> (-0.02%) ⬇️
appsec-node-serialize_passport_postgres 69.82% <ø> (-0.02%) ⬇️
appsec-sourcing_stripe_template 68.20% <ø> (-0.03%) ⬇️
debugger 68.91% <ø> (-0.05%) ⬇️
instrumentations-bucket-0 55.10% <ø> (-0.03%) ⬇️
instrumentations-bucket-1 63.63% <ø> (-0.03%) ⬇️
instrumentations-bucket-10 64.87% <ø> (-0.03%) ⬇️
instrumentations-bucket-11 65.53% <ø> (-0.03%) ⬇️
instrumentations-bucket-12 54.98% <ø> (-0.03%) ⬇️
instrumentations-bucket-13 55.27% <ø> (-0.03%) ⬇️
instrumentations-bucket-14 55.10% <ø> (-0.03%) ⬇️
instrumentations-bucket-2 56.19% <ø> (-0.03%) ⬇️
instrumentations-bucket-3 57.02% <ø> (-0.03%) ⬇️
instrumentations-bucket-4 63.08% <ø> (-0.03%) ⬇️
instrumentations-bucket-5 49.31% <ø> (-0.03%) ⬇️
instrumentations-bucket-6 64.97% <ø> (-0.03%) ⬇️
instrumentations-bucket-7 55.24% <ø> (-0.03%) ⬇️
instrumentations-bucket-8 62.45% <ø> (-0.03%) ⬇️
instrumentations-bucket-9 57.84% <ø> (-0.03%) ⬇️
instrumentations-instrumentation-couchbase 53.64% <ø> (-0.03%) ⬇️
instrumentations-integration-esbuild 34.38% <ø> (ø)
llmobs-ai_anthropic_bedrock 66.35% <ø> (-0.02%) ⬇️
llmobs-bucket-1 64.46% <ø> (-0.03%) ⬇️
llmobs-openai 66.33% <ø> (-0.03%) ⬇️
llmobs-openai-agents_vertex-ai 63.51% <ø> (-0.02%) ⬇️
llmobs-sdk 75.77% <ø> (-0.03%) ⬇️
master-coverage 98.58% <100.00%> (?)
openfeature 59.74% <ø> (-0.01%) ⬇️
openfeature-unit 57.48% <ø> (-0.03%) ⬇️
platform-core_esbuild_instrumentations-misc 40.52% <ø> (-0.02%) ⬇️
platform-integration 64.48% <ø> (ø)
platform-shimmer_unit-guardrails_webpack 38.25% <ø> (-0.02%) ⬇️
plugins-browser-bunyan_bullmq_cassandra 65.76% <ø> (-0.03%) ⬇️
plugins-bucket-0 60.38% <ø> (-0.03%) ⬇️
plugins-bucket-1 57.66% <ø> (ø)
plugins-bucket-11 66.26% <ø> (-0.03%) ⬇️
plugins-bucket-18 65.78% <ø> (-0.03%) ⬇️
plugins-bucket-19 64.39% <ø> (-0.02%) ⬇️
plugins-bucket-20 66.25% <ø> (-0.03%) ⬇️
plugins-bucket-4 60.57% <ø> (-0.03%) ⬇️
plugins-cookie_cookie-parser_crypto 54.65% <ø> (-0.03%) ⬇️
plugins-fastify_fetch_fs 64.94% <ø> (+0.01%) ⬆️
plugins-generic-pool_google-cloud-pubsub_grpc 68.54% <ø> (-0.03%) ⬇️
plugins-handlebars_hapi_hono 62.97% <ø> (-0.03%) ⬇️
plugins-ioredis_knex_langgraph 61.04% <ø> (-0.03%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 62.71% <ø> (-0.02%) ⬇️
plugins-lodash_mariadb_memcached 63.32% <ø> (-0.03%) ⬇️
plugins-moleculer_mongodb_mongodb-core 65.63% <ø> (-0.03%) ⬇️
plugins-mongoose_multer_mysql 63.42% <ø> (-0.03%) ⬇️
plugins-mysql2_nats_node-serialize 65.61% <ø> (-0.03%) ⬇️
plugins-opensearch_passport-http_pino 63.44% <ø> (-0.03%) ⬇️
plugins-postgres_process_pug 62.53% <ø> (-0.03%) ⬇️
plugins-redis_router_sequelize 66.21% <ø> (-0.03%) ⬇️
plugins-test-and-upstream-rhea_undici_url 65.57% <ø> (-0.03%) ⬇️
plugins-valkey_vm_winston 61.84% <ø> (-0.03%) ⬇️
plugins-ws 63.84% <ø> (-0.03%) ⬇️
profiling 65.87% <ø> (-0.03%) ⬇️
serverless-aws-sdk-aws-sdk 54.81% <ø> (-0.02%) ⬇️
serverless-aws-sdk-base-inject-field 54.23% <ø> (-0.03%) ⬇️
serverless-aws-sdk-bedrockruntime 57.53% <ø> (-0.03%) ⬇️
serverless-aws-sdk-client 59.37% <ø> (-0.03%) ⬇️
serverless-aws-sdk-dynamodb 58.48% <ø> (-0.03%) ⬇️
serverless-aws-sdk-eventbridge 57.06% <ø> (-0.02%) ⬇️
serverless-aws-sdk-kinesis 62.58% <ø> (-0.03%) ⬇️
serverless-aws-sdk-lambda 60.48% <ø> (-0.03%) ⬇️
serverless-aws-sdk-s3 58.55% <ø> (-0.03%) ⬇️
serverless-aws-sdk-serverless-peer-service 63.15% <ø> (-0.03%) ⬇️
serverless-aws-sdk-sns 63.49% <ø> (-0.03%) ⬇️
serverless-aws-sdk-sqs 63.95% <ø> (-0.03%) ⬇️
serverless-aws-sdk-stepfunctions 58.35% <ø> (-0.03%) ⬇️
serverless-aws-sdk-util 54.90% <ø> (-0.03%) ⬇️
serverless-bucket-0 57.10% <ø> (ø)
serverless-bucket-1 63.11% <ø> (-0.03%) ⬇️
test-optimization-cucumber 70.45% <84.21%> (+0.02%) ⬆️
test-optimization-cypress 64.63% <63.15%> (+0.07%) ⬆️
test-optimization-jest 72.01% <84.21%> (-0.01%) ⬇️
test-optimization-mocha 71.88% <84.21%> (+0.05%) ⬆️
test-optimization-playwright-playwright-atr 59.50% <47.36%> (+<0.01%) ⬆️
test-optimization-playwright-playwright-efd 60.18% <47.36%> (-0.02%) ⬇️
test-optimization-playwright-playwright-final-status 59.79% <47.36%> (+<0.01%) ⬆️
test-optimization-playwright-playwright-impacted-tests 59.90% <47.36%> (+0.15%) ⬆️
test-optimization-playwright-playwright-reporting 60.94% <63.15%> (-0.02%) ⬇️
test-optimization-playwright-playwright-test-management 60.98% <47.36%> (-0.02%) ⬇️
test-optimization-playwright-playwright-test-span 59.54% <47.36%> (-0.05%) ⬇️
test-optimization-selenium 58.60% <47.36%> (-0.12%) ⬇️
test-optimization-testopt 61.64% <47.36%> (+0.06%) ⬆️
test-optimization-vitest 72.54% <47.36%> (+0.05%) ⬆️
test-optimization-vitest-browser 58.46% <47.36%> (+<0.01%) ⬆️
test-optimization-webdriverio 65.08% <47.36%> (+0.43%) ⬆️

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
juan-fernandez enabled auto-merge (squash) August 28, 2026 09:47
@juan-fernandez
juan-fernandez merged commit 59a06aa into master Aug 28, 2026
688 checks passed
@juan-fernandez
juan-fernandez deleted the juan-fernandez/test-optimization-http-retries branch August 28, 2026 10:21
This was referenced Aug 31, 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