fix(test-optimization): gzip test-cycle payloads #11441
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.66) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 372 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.354
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #11441"
general
weight: 0.35
juan-fernandez
What does this PR do?
Agentless and EVP v4+ test-cycle payloads of at least 1024 bytes are gzipped synchronously (
Z_BEST_SPEED) before entering the request queue, so the queue counts and retains only their compact compressed bytes and sends them withContent-Encoding: gzip. The 64 MiB cap is unchanged. Payloads smaller than 1024 bytes or payloads that do not shrink under gzip stay uncompressed.Telemetry:
endpoint_payload.requestsis taggedrq_compressed:truefor compressed bodies.ERR_DD_TEST_OPTIMIZATION_BURST_TOO_LARGEwhen the payloads of its own synchronous run, including the rejected one, would hold more of the queue than earlier requests, andERR_DD_TEST_OPTIMIZATION_QUEUE_FULLotherwise.Motivation
The queue holds each payload until the intake answers. When payloads are exported faster than that, uncompressed payloads fill the 64 MiB cap in ~32 payloads and the rest are dropped. Gzipping test-cycle payloads whenever the endpoint supports it, as the other Datadog Test Optimization libraries do, lets the 64 MiB cap hold compressed payloads and cuts upload bytes by about 8–18×, for a few milliseconds of CPU per 2 MiB payload at
Z_BEST_SPEED.Additional Notes
The agent added
/evp_proxy/v4in the same change that started forwardingContent-Encoding(DataDog/datadog-agent#22090), so agents without v4 still receive uncompressed payloads.With more payloads queued, more of them wait for one of the agent's 16 sockets. Since #11476, that wait no longer counts toward their 15-second attempt timeout.
Synthetic replay that exports all payloads of one report in one synchronous run (~2 MiB msgpack each, 230 ms intake latency,
maxSockets=16, Node 24, one trial per row except 187, which had three):| Payloads in one run | Dropped,
master| Dropped, this PR | Synchronous export,master| Synchronous export, this PR || --- | ---: | ---: | ---: | ---: |
| 47, random test names | 15 | 0 | 0.37 s | 0.51 s |
| 94, random test names | 62 | 0 | 0.77 s | 1.06 s |
| 187, random test names | 155 | 0 | 1.49 s | 2.15–2.20 s |
| 299, random test names | 267 | 56 | 2.37 s | 3.63 s |
| 300, realistic test names | 268 | 0 | 1.36 s | 2.23 s |
Gzipped payloads are about 268 KiB with random test names and 111 KiB with realistic ones. Gzip averages 3.5–4.6 ms per payload with random test names and 2.1 ms with realistic ones, with single calls up to ~200 ms. The extra synchronous export time is mostly gzip;
masterspends nothing on the payloads it drops.Changed specs (
request.spec.js,agentless/writer.spec.js,agent-proxy/agent-proxy.spec.js) pass on the current version and v5 (115 passing). Theci-visibilityandexportersspecs pass withscripts/mocha-parallel-files.js(1137 passing), andintegration-tests/ci-visibility/test-api-manual.spec.jspasses (3 passing). ESLint andnpm run type:check:ciare clean. Not run: Node 18 andnpm run lint:editorconfig.