Skip to content

fix(test-optimization): wait for all worker writers#9349

Merged
BridgeAR merged 1 commit into
masterfrom
BridgeAR/2026-07-14-fix-test-worker-flush
Jul 14, 2026
Merged

fix(test-optimization): wait for all worker writers#9349
BridgeAR merged 1 commit into
masterfrom
BridgeAR/2026-07-14-fix-test-worker-flush

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

Summary

The worker flush callback now waits for trace, coverage, log, and telemetry payloads to complete.

This prevents coverage, logs, or telemetry payloads from being lost when traces flush before their IPC sends complete.
@dd-octo-sts

dd-octo-sts Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 6.74 MB
Deduped: 7.4 MB
No deduping: 7.4 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

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Jul 14, 2026

Copy link
Copy Markdown

Tests

Fix all issues with BitsAI

⚠️ Warnings

🧪 2 Tests failed in 1 job

All Green | all-green   GitHub Actions

Plugin aerospike with aerospike >=5.12.1 (5.12.1) without configuration client should instrument createIndex from client   View in Datadog
AssertionError [ERR_ASSERTION]: Expected values to be partially and strictly deep-equal:
+ actual - expected

  {
+   duration: 1772461,
+   error: 0,
    meta: {
+     '_dd.base_service': 'test',
+     '_dd.git.commit.sha': '312936cc845d6c273caa25daf1e3e0bd08754fa3',
+     '_dd.git.repository_url': 'https://github.com/DataDog/dd-trace-js',
...
Plugin aerospike with aerospike >=5.12.1 (5.12.1) without configuration client should instrument query from client   View in Datadog
AggregateError: Asserting traces failed. No result matched the expected one.
    at Timeout._onTimeout (/home/runner/work/dd-trace-js/dd-trace-js/packages/dd-trace/test/plugins/agent.js:376:17)
    at listOnTimeout (node:internal/timers:585:17)
    at process.processTimers (node:internal/timers:521:7) {
  errors: [
    AssertionError [ERR_ASSERTION]: Expected values to be partially and strictly deep-equal:
    + actual - expected
    
      {
    +   duration: 1912842,
...

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 96.58% (+0.00%)

Useful? React with 👍 / 👎

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

@BridgeAR
BridgeAR marked this pull request as ready for review July 14, 2026 18:38
@BridgeAR
BridgeAR requested a review from a team as a code owner July 14, 2026 18:38
@pr-commenter

pr-commenter Bot commented Jul 14, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-14 18:43:08

Comparing candidate commit 2d8740e in PR branch BridgeAR/2026-07-14-fix-test-worker-flush with baseline commit 225522c in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2309 metrics, 49 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 [-213.304ms; +205.150ms] or [-8.037%; +7.730%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-229.938ms; +236.849ms] or [-9.017%; +9.288%]

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

  • unstable execution_time [-159.870ms; +156.370ms] or [-5.178%; +5.064%]

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

  • unstable execution_time [-194.304ms; +183.804ms] or [-6.698%; +6.336%]

scenario:appsec-control-20

  • unstable execution_time [-119.353ms; +122.429ms] or [-7.215%; +7.401%]

scenario:appsec-control-24

  • unstable execution_time [-116.553ms; +89.570ms] or [-9.495%; +7.297%]

scenario:appsec-control-26

  • unstable execution_time [-127.952ms; +119.205ms] or [-10.319%; +9.613%]

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

  • unstable execution_time [-21.054ms; +15.202ms] or [-8.160%; +5.892%]

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

  • unstable execution_time [-13.933ms; +18.802ms] or [-5.279%; +7.123%]

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

  • unstable execution_time [-16.017ms; +19.237ms] or [-6.258%; +7.516%]

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

  • unstable execution_time [-25.350ms; +30.669ms] or [-4.618%; +5.587%]

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

  • unstable execution_time [-30.131ms; +34.972ms] or [-5.392%; +6.259%]

scenario:child_process-shell-string-24

  • unstable execution_time [-15.225ms; +20.647ms] or [-4.732%; +6.418%]

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

  • unstable cpu_user_time [-1550.262ms; +532.342ms] or [-18.578%; +6.379%]
  • unstable execution_time [-1589.759ms; +566.714ms] or [-17.555%; +6.258%]
  • unstable instructions [-13.0G instructions; +4.4G instructions] or [-19.114%; +6.461%]
  • unstable throughput [-186.272op/s; +479.316op/s] or [-5.150%; +13.252%]

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

  • unstable cpu_user_time [-2.667s; +5.744s] or [-25.921%; +55.823%]
  • unstable execution_time [-2.665s; +5.759s] or [-24.149%; +52.185%]
  • unstable instructions [-23.6G instructions; +51.2G instructions] or [-27.254%; +59.195%]
  • unstable max_rss_usage [-9.135MB; +17.739MB] or [-5.625%; +10.923%]
  • unstable throughput [-1130.882op/s; +522.382op/s] or [-36.754%; +16.978%]

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

  • unstable cpu_user_time [-2712.417ms; +4211.279ms] or [-28.428%; +44.137%]
  • unstable execution_time [-2887.418ms; +4428.202ms] or [-28.097%; +43.089%]
  • unstable instructions [-23.2G instructions; +36.9G instructions] or [-29.186%; +46.299%]
  • unstable max_rss_usage [-7.707MB; +12.924MB] or [-4.834%; +8.107%]
  • unstable throughput [-841.957op/s; +566.323op/s] or [-26.009%; +17.494%]

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

  • unstable cpu_user_time [-1603.565ms; +2763.040ms] or [-19.044%; +32.814%]
  • unstable execution_time [-1617.251ms; +2806.397ms] or [-17.699%; +30.712%]
  • unstable instructions [-13.6G instructions; +23.4G instructions] or [-19.732%; +34.075%]
  • unstable max_rss_usage [-6.439MB; +10.194MB] or [-4.115%; +6.514%]
  • unstable throughput [-788.584op/s; +440.230op/s] or [-21.999%; +12.281%]

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

  • unstable cpu_user_time [-2571.690ms; +4113.623ms] or [-26.916%; +43.054%]
  • unstable execution_time [-2532.761ms; +4126.706ms] or [-24.643%; +40.152%]
  • unstable instructions [-23.2G instructions; +36.8G instructions] or [-29.074%; +46.171%]
  • unstable max_rss_usage [-7.398MB; +13.493MB] or [-4.628%; +8.440%]
  • unstable throughput [-815.886op/s; +492.572op/s] or [-25.323%; +15.288%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-279.587ms; +435.448ms] or [-5.850%; +9.112%]
  • unstable execution_time [-291.102ms; +442.427ms] or [-5.990%; +9.104%]
  • unstable throughput [-157828.422op/s; +105801.154op/s] or [-9.124%; +6.116%]

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

  • unstable cpu_usage_percentage [-4.161%; +6.835%]

scenario:plugin-couchbase-upsert-20

  • unstable cpu_user_time [-482.649ms; +750.610ms] or [-10.812%; +16.815%]
  • unstable execution_time [-486.633ms; +747.030ms] or [-10.876%; +16.696%]
  • unstable throughput [-2784525.492op/s; +1863421.192op/s] or [-9.817%; +6.570%]

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

  • unstable max_rss_usage [-5.797MB; +8.280MB] or [-4.425%; +6.320%]

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

  • unstable cpu_user_time [-712.962ms; +692.372ms] or [-5.572%; +5.411%]
  • unstable execution_time [-718.622ms; +696.866ms] or [-5.495%; +5.328%]
  • unstable throughput [-3.223op/s; +3.339op/s] or [-5.238%; +5.426%]

scenario:plugin-pg-service-20

  • unstable execution_time [-125.837ms; +44.741ms] or [-7.651%; +2.720%]

@datadog-datadog-us1-prod datadog-datadog-us1-prod 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 PR correctly implements awaiting all writer flushes before signaling completion. The counter-based coordination handles mixed sync/async callbacks properly, and all edge cases (no telemetry writer, multiple flushes, empty payloads) are handled correctly. Tests comprehensively validate the new callback coordination logic.

Was this helpful? React 👍 or 👎

📊 Validated against 6 scenarios · Open Bits AI session

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

@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.11%. Comparing base (225522c) to head (2d8740e).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9349      +/-   ##
==========================================
- Coverage   96.61%   96.11%   -0.51%     
==========================================
  Files         920      920              
  Lines      122387   122408      +21     
  Branches    21592    20702     -890     
==========================================
- Hits       118249   117647     -602     
- Misses       4138     4761     +623     
Flag Coverage Δ
aiguard 53.55% <ø> (-0.05%) ⬇️
aiguard-integration 56.97% <ø> (ø)
apm-bucket-0 53.78% <ø> (-0.05%) ⬇️
apm-bucket-1 58.05% <ø> (-0.05%) ⬇️
apm-bucket-2 56.10% <ø> (-0.05%) ⬇️
apm-capabilities-tracing 60.33% <100.00%> (-0.01%) ⬇️
apm-integrations-aerospike 52.92% <ø> (-0.05%) ⬇️
apm-integrations-confluentinc-kafka-javascript 57.04% <ø> (-0.05%) ⬇️
apm-integrations-couchbase 53.26% <ø> (-0.05%) ⬇️
apm-integrations-http 57.94% <ø> (-0.05%) ⬇️
apm-integrations-kafkajs 57.69% <ø> (-0.05%) ⬇️
apm-integrations-next 54.23% <ø> (-0.05%) ⬇️
apm-integrations-prisma 54.16% <ø> (-0.05%) ⬇️
apm-integrations-tedious 53.03% <ø> (-0.05%) ⬇️
appsec 68.92% <ø> (-0.10%) ⬇️
appsec-express_fastify_graphql 65.67% <ø> (-0.03%) ⬇️
appsec-integration 51.89% <ø> (ø)
appsec-kafka_ldapjs_lodash 59.07% <ø> (-0.10%) ⬇️
appsec-mongodb-core_mongoose_mysql 62.22% <ø> (-0.04%) ⬇️
appsec-next 52.84% <ø> (-0.04%) ⬇️
appsec-node-serialize_passport_postgres 61.85% <ø> (-0.04%) ⬇️
appsec-sourcing_stripe_template 60.31% <ø> (-0.04%) ⬇️
debugger 65.74% <ø> (-0.02%) ⬇️
instrumentations-bucket-0 48.75% <ø> (-0.05%) ⬇️
instrumentations-bucket-1 54.95% <ø> (-0.05%) ⬇️
instrumentations-bucket-10 56.61% <ø> (-0.05%) ⬇️
instrumentations-bucket-11 48.74% <ø> (-0.05%) ⬇️
instrumentations-bucket-12 48.85% <ø> (-0.05%) ⬇️
instrumentations-bucket-13 48.68% <ø> (-0.05%) ⬇️
instrumentations-bucket-2 49.74% <ø> (-0.05%) ⬇️
instrumentations-bucket-3 53.82% <ø> (-0.05%) ⬇️
instrumentations-bucket-4 49.16% <ø> (-0.05%) ⬇️
instrumentations-bucket-5 53.00% <ø> (-0.05%) ⬇️
instrumentations-bucket-6 55.58% <ø> (-0.05%) ⬇️
instrumentations-bucket-7 53.59% <ø> (-0.05%) ⬇️
instrumentations-bucket-8 54.63% <ø> (-0.05%) ⬇️
instrumentations-bucket-9 56.08% <ø> (-0.04%) ⬇️
instrumentations-instrumentation-couchbase 48.13% <ø> (-0.05%) ⬇️
instrumentations-integration-esbuild 33.89% <ø> (ø)
llmobs-ai_anthropic_bedrock 57.73% <ø> (-0.04%) ⬇️
llmobs-bucket-1 57.00% <ø> (-0.04%) ⬇️
llmobs-openai 57.39% <ø> (-0.04%) ⬇️
llmobs-sdk 59.96% <ø> (-0.05%) ⬇️
llmobs-vertex-ai 54.22% <ø> (-0.05%) ⬇️
master-coverage 96.11% <100.00%> (?)
openfeature 54.60% <ø> (+<0.01%) ⬆️
openfeature-unit 49.78% <ø> (-0.05%) ⬇️
platform-core_esbuild_instrumentations-misc 38.37% <ø> (-0.03%) ⬇️
platform-integration 62.33% <ø> (ø)
platform-shimmer_unit-guardrails_webpack 37.20% <ø> (-0.03%) ⬇️
plugins-bucket-0 53.17% <ø> (-0.05%) ⬇️
plugins-bucket-1 55.02% <ø> (ø)
plugins-bucket-11 57.49% <ø> (-0.05%) ⬇️
plugins-bucket-18 56.98% <ø> (-0.05%) ⬇️
plugins-bucket-19 ?
plugins-bucket-20 57.59% <ø> (-0.05%) ⬇️
plugins-bucket-4 ?
plugins-bullmq_cassandra_cookie ?
plugins-cookie-parser_crypto_dd-trace-api 52.31% <ø> (-0.05%) ⬇️
plugins-fetch_fs_generic-pool 54.45% <ø> (-0.05%) ⬇️
plugins-google-cloud-pubsub_grpc_handlebars 59.84% <ø> (-0.05%) ⬇️
plugins-hapi_hono_ioredis 55.84% <ø> (-0.05%) ⬇️
plugins-jest_knex_langgraph 51.66% <ø> (-0.05%) ⬇️
plugins-ldapjs_light-my-request_limitd-client 53.43% <ø> (-0.03%) ⬇️
plugins-lodash_mariadb_memcached 54.20% <ø> (-0.05%) ⬇️
plugins-moleculer_mongodb_mongodb-core 57.28% <ø> (-0.05%) ⬇️
plugins-mongoose_multer_mysql 54.69% <ø> (-0.05%) ⬇️
plugins-mysql2_nats_node-serialize 56.19% <ø> (-0.05%) ⬇️
plugins-opensearch_passport-http_pino 55.04% <ø> (-0.05%) ⬇️
plugins-postgres_process_pug 54.28% <ø> (-0.05%) ⬇️
plugins-redis_router_sequelize 57.01% <ø> (-0.05%) ⬇️
plugins-test-and-upstream-rhea_undici_url 57.01% <ø> (-0.03%) ⬇️
plugins-valkey_vm_winston 53.92% <ø> (+0.03%) ⬆️
plugins-ws 54.78% <ø> (-0.05%) ⬇️
profiling 58.20% <ø> (-0.04%) ⬇️
serverless-aws-sdk-aws-sdk 50.66% <ø> (-0.04%) ⬇️
serverless-aws-sdk-bedrockruntime 50.68% <ø> (-0.05%) ⬇️
serverless-aws-sdk-client 51.93% <ø> (-0.05%) ⬇️
serverless-aws-sdk-dynamodb 51.77% <ø> (-0.02%) ⬇️
serverless-aws-sdk-eventbridge 46.22% <ø> (-0.05%) ⬇️
serverless-aws-sdk-kinesis 54.70% <ø> (-0.05%) ⬇️
serverless-aws-sdk-lambda 52.78% <ø> (-0.05%) ⬇️
serverless-aws-sdk-s3 51.53% <ø> (-0.05%) ⬇️
serverless-aws-sdk-serverless-peer-service 54.71% <ø> (-0.05%) ⬇️
serverless-aws-sdk-sns 55.47% <ø> (-0.05%) ⬇️
serverless-aws-sdk-sqs 55.90% <ø> (-0.05%) ⬇️
serverless-aws-sdk-stepfunctions 51.25% <ø> (-0.05%) ⬇️
serverless-aws-sdk-util 48.43% <ø> (-0.05%) ⬇️
serverless-bucket-0 55.17% <ø> (ø)
serverless-bucket-1 56.00% <ø> (-0.05%) ⬇️
test-optimization-cucumber 72.96% <85.18%> (+0.05%) ⬆️
test-optimization-cypress 66.29% <ø> (+0.05%) ⬆️
test-optimization-jest 74.28% <92.59%> (+0.02%) ⬆️
test-optimization-mocha 74.67% <81.48%> (+0.07%) ⬆️
test-optimization-playwright-playwright-atr 61.53% <70.37%> (+0.03%) ⬆️
test-optimization-playwright-playwright-efd 61.72% <70.37%> (+0.03%) ⬆️
test-optimization-playwright-playwright-final-status 61.70% <70.37%> (+0.03%) ⬆️
test-optimization-playwright-playwright-impacted-tests 61.42% <70.37%> (+0.04%) ⬆️
test-optimization-playwright-playwright-reporting 61.37% <70.37%> (+0.10%) ⬆️
test-optimization-playwright-playwright-test-management 62.27% <70.37%> (-0.25%) ⬇️
test-optimization-playwright-playwright-test-span 61.45% <70.37%> (-0.02%) ⬇️
test-optimization-selenium 60.63% <22.22%> (-0.15%) ⬇️
test-optimization-testopt 59.13% <70.37%> (+0.08%) ⬆️
test-optimization-vitest 71.47% <100.00%> (+0.05%) ⬆️

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.

@BridgeAR
BridgeAR merged commit 513e737 into master Jul 14, 2026
806 of 808 checks passed
@BridgeAR
BridgeAR deleted the BridgeAR/2026-07-14-fix-test-worker-flush branch July 14, 2026 18:54
This was referenced Jul 15, 2026
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
This prevents coverage, logs, or telemetry payloads from being lost when traces flush before their IPC sends complete.
juan-fernandez pushed a commit that referenced this pull request Jul 16, 2026
This prevents coverage, logs, or telemetry payloads from being lost when traces flush before their IPC sends complete.
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