Skip to content

fix(test-optimization): batch worker traces by byte size - #11398

Draft
BridgeAR wants to merge 1 commit into
masterfrom
BridgeAR/2026-11-23-test-worker-trace-batching
Draft

BridgeAR wants to merge 1 commit into
masterfrom
BridgeAR/2026-11-23-test-worker-trace-batching

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

Vitest Early Flake Detection can generate enough traces in one file for JSON serialization to exceed the V8 string limit. The parent receives none of the attempts.

The shared worker exporter sends whole trace chunks in JSON batches with an 8 MiB target. It sends an oversized trace alone and keeps the existing IPC formats. A callback-based flush waits for all sends in that flush.

Playwright matches failure media by test attempt. A batch containing only child spans no longer consumes the attachments before the test span arrives.

Fixes: #11390

Vitest Early Flake Detection can generate enough traces in one file for
JSON serialization to exceed V8's string limit. In that case, the parent
receives none of the attempts.

Send whole trace chunks in JSON batches with an 8 MiB target across test
frameworks. Send an oversized trace alone and continue if serialization
or a send fails. Keep the existing IPC formats and wait for every batch
in a callback-based flush.

Playwright matches failure media by test attempt so a child-only batch
cannot consume the attachments before the test span arrives.

Fixes: #11390
@dd-octo-sts

dd-octo-sts Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 9.56 MB
Deduped: 10.31 MB
No deduping: 10.31 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.5.3 | 131.25 kB | 531.9 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

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog retried 1 test - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 98.55% (+8.97%)

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

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.15%. Comparing base (41dee42) to head (4859f2d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11398      +/-   ##
==========================================
+ Coverage   89.61%   99.15%   +9.54%     
==========================================
  Files        1128     1136       +8     
  Lines      184036   188454    +4418     
  Branches       86       86              
==========================================
+ Hits       164923   186870   +21947     
+ Misses      19113     1584   -17529     
Flag Coverage Δ
ai-guard 63.33% <ø> (-0.02%) ⬇️
apm-capabilities 55.17% <74.65%> (+<0.01%) ⬆️
apm-integrations 81.96% <ø> (-0.02%) ⬇️
appsec 59.23% <19.35%> (-0.02%) ⬇️
debugger 70.89% <ø> (-0.02%) ⬇️
instrumentation 60.17% <19.35%> (+0.04%) ⬆️
llmobs 82.51% <ø> (-0.02%) ⬇️
master-coverage 99.15% <100.00%> (?)
openfeature 68.07% <ø> (-0.02%) ⬇️
platform 68.15% <ø> (-0.01%) ⬇️
profiling 66.51% <ø> (-0.02%) ⬇️
serverless 66.67% <ø> (-0.02%) ⬇️
test-optimization 82.03% <100.00%> (?)

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.

@pr-commenter

pr-commenter Bot commented Nov 24, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-11-24 00:58:17

Comparing candidate commit 4859f2d in PR branch BridgeAR/2026-11-23-test-worker-trace-batching with baseline commit 41dee42 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2474 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 [-62.467MB; +45.340MB] or [-29.140%; +21.150%]

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

  • unstable max_rss_usage [-25.338MB; +43.482MB] or [-10.804%; +18.541%]

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

  • unstable max_rss_usage [-42651.473KB; +41067.473KB] or [-11.637%; +11.205%]

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

  • unstable max_rss_usage [-26.279MB; +14.721MB] or [-8.482%; +4.752%]

scenario:encoders-0.4-immediate-flush-20

  • unstable max_rss_usage [-2.212MB; +6.396MB] or [-2.593%; +7.499%]

scenario:openfeature-initialization-configuration-20

  • unstable max_rss_usage [-4609.355KB; +6568.264KB] or [-5.867%; +8.360%]

scenario:openfeature-initialization-configuration-26

  • unstable cpu_user_time [-75.968ms; +133.904ms] or [-4.575%; +8.064%]
  • unstable execution_time [-78.139ms; +133.673ms] or [-4.528%; +7.746%]
  • unstable throughput [-41750.528op/s; +23358.936op/s] or [-7.081%; +3.962%]

scenario:openfeature-initialization-error-20

  • unstable max_rss_usage [-4747.238KB; +4653.056KB] or [-6.295%; +6.171%]

scenario:openfeature-initialization-error-24

  • unstable max_rss_usage [-8.259MB; +25.692MB] or [-2.890%; +8.990%]

scenario:openfeature-scale-full-26

  • unstable max_rss_usage [-30.807MB; +20.338MB] or [-12.709%; +8.390%]

scenario:plugin-graphql-long-with-depth-off-26

  • unstable max_rss_usage [-28887.636KB; +27385.922KB] or [-14.866%; +14.093%]

This branch has not been deployed

No deployments
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.

[BUG]: Vitest worker drops all test events for a file when its spans exceed the max string length

1 participant