← Back to Pull requests

fix(test-optimization): gzip test-cycle payloads #11441

Closed
unknown closed this pull request without merging on Nov 27, 2026 12:44 UTC
View on GitHub
unknown unknown commented on Nov 25, 2026 11:37 UTC
Author

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 with Content-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.requests is tagged rq_compressed:true for compressed bodies.

  • A rejected payload reports ERR_DD_TEST_OPTIMIZATION_BURST_TOO_LARGE when the payloads of its own synchronous run, including the rejected one, would hold more of the queue than earlier requests, and ERR_DD_TEST_OPTIMIZATION_QUEUE_FULL otherwise.
  • 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/v4 in the same change that started forwarding Content-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; master spends 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). The ci-visibility and exporters specs pass with scripts/mocha-parallel-files.js (1137 passing), and integration-tests/ci-visibility/test-api-manual.spec.js passes (3 passing). ESLint and npm run type:check:ci are clean. Not run: Node 18 and npm run lint:editorconfig.

    Diff: 372 lines (+279 / -93) across 4 files Reviewer: juan-fernandez Review duration: 2947m
    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
    0.66
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 66.0% (HIGH) · Higher = larger blast radius
    66.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.1% · Safe to merge
    26.1%