Repository navigation
feat(mock-intake): add option to disable captures - #201
lucaspimentel wants to merge 2 commits into
Conversation
|
@DataDog review |
There was a problem hiding this comment.
More details
The capture flag gates raw-request construction and capture storage while preserving decoding, failure injection, response handling, and JSON dumps. The static reviewer identified no actionable defects.
🤖 Bits Code Review · Commit fc89cb1
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟢 Approval recommended
The opt-in capture-disable change has no active review issues.
No open issues 🎉
What changed in this PR
Adds an opt-in capture-disable mode to the shared mock intake, allowing long-running consumers to avoid accumulating captures in memory while preserving request processing and diagnostics.
Changes:
- Adds
MockIntakeOptions::disable_captures, defaulting tofalse. - Skips raw capture construction and capture storage when enabled.
- Adds coverage for unchanged response statuses, failure injection, JSON dumps, and empty capture queries.
Size: 10 added and 7 removed core-code lines, excluding documentation; 75 added test lines.
| File | Description |
|---|---|
crates/datadog-mock-intake/src/lib.rs |
Adds and documents the option, gates capture creation and storage, and tests disabled-capture behavior. |
Review effort: Balanced
What does this PR do?
Adds
MockIntakeOptions::disable_captures, off by default. When set, the mock intake keeps no captures in memory:stats_payloads(),trace_payloads(),pipeline_stats_payloads()andrequests_for_path()return nothing, and no rawCapturedRequestis built or stored.Everything else is unchanged: decoding, response status codes, request summaries, JSON dumps, request ids and stats failure injection all still happen.
Motivation
The standalone mock intake binary in
datadog-lambda-extension(bottlecap/src/bin/mock-intake/main.rs) never reads the captures, so its memory grows without limit while it runs. This gives that binary a way to turn captures off.Additional Notes
MockIntakeOptionsin a struct literal.datadog-lambda-extensiondoes this, so its pin bump must adddisable_captures: truein the same change, otherwise it stops compiling.Describe how to test/QA your changes
New test
disable_captures_keeps_responses_and_dumps_but_stores_nothingcovers the flag on: unchanged statuses (including failure injection), one JSON dump per decoded attempt, and empty results from all four query methods.cargo test -p datadog-mock-intakepasses, andcargo fmt --checkandcargo clippy -p datadog-mock-intake --all-targets -- -D warningsare clean.