Repository navigation
[APMSVLS-499] test infra: use shared datadog-mock-intake crate and add standalone mock-intake binary - #1392
[APMSVLS-499] test infra: use shared datadog-mock-intake crate and add standalone mock-intake binary#1392lucaspimentel wants to merge 19 commits into
datadog-mock-intake crate and add standalone mock-intake binary#1392Conversation
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 2 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: 99c5fb9 | Docs | View more details | Give us feedback! |
datadog-mock-intake crate and add standalone fake-intake binary
|
Note to self: rename |
|
@DataDog review |
datadog-mock-intake crate and add standalone fake-intake binarydatadog-mock-intake crate and add standalone mock-intake binary
b1d9813 to
86483e6
Compare
Codex Review Summary: ✅ CompletedThis 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. |
datadog-mock-intake crate and add standalone mock-intake binarydatadog-mock-intake crate and add standalone mock-intake binary
|
@DataDog review |
There was a problem hiding this comment.
More details
The completed static review found that the shared intake preserves existing integration-test assertions and the standalone binary remains gated behind the opt-in mock-intake feature. No actionable regressions were identified.
🤖 Bits Code Review · Commit 86483e6
There was a problem hiding this comment.
🟡 Changes recommended
The standalone intake retains traffic without bounds and silently treats SIGINT-handler errors as successful shutdowns.
2 open issues
What changed in this PR
Replaces Bottlecap’s test-local intake fixture with the shared datadog-mock-intake crate and adds a feature-gated binary for local APM debugging.
Changes:
- Migrates APM and DSM integration tests to the shared crate without feature-gating the tests.
- Adds a standalone intake with request summaries, stats failure injection, JSON dumps, and usage documentation.
- Updates dependency metadata and CI lint coverage for the new binary.
| File | Description |
|---|---|
bottlecap/tests/dsm_integration_test.rs |
Uses the shared intake for DSM payload tests. |
bottlecap/tests/common/mod.rs |
Removes the obsolete common-module file. |
bottlecap/tests/common/fake_intake.rs |
Deletes the test-local intake implementation. |
bottlecap/tests/apm_integration_test.rs |
Migrates APM tests and helpers to MockIntake. |
bottlecap/src/bin/mock-intake/README.md |
Documents configuration, endpoints, and the smoke workflow. |
bottlecap/src/bin/mock-intake/main.rs |
Adds the standalone intake launcher and signal handling. |
bottlecap/README.md |
Introduces local debugging and links detailed instructions. |
bottlecap/LICENSE-3rdparty.csv |
Records the shared crate’s license. |
bottlecap/Cargo.toml |
Declares the dependency, feature, and binary target. |
bottlecap/Cargo.lock |
Locks the shared crate and updates dependency references. |
.gitlab/templates/pipeline.yaml.tpl |
Lints all targets and includes the new feature. |
.github/workflows/rs_ci.yml |
Includes the new feature in Clippy coverage. |
Review effort: Balanced
3435d00 to
68e033e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68e033eee6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
datadog-mock-intake crate and add standalone mock-intake binarydatadog-mock-intake crate and add standalone mock-intake binary
a511e00 to
76d25cf
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 17c8f262c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
cc6e68d to
a1b16a3
Compare
…inary Replace the test-local APM intake fixture with the datadog-mock-intake crate from serverless-components (pinned to its first published revision). The APM and DSM integration tests use it as an ungated dev-dependency and run in every test build; the previous fixture is deleted. Add a standalone fake-intake binary behind a new fake-intake feature for local APM debugging: it runs the shared crate with request summaries, stats failure injection (FAKE_INTAKE_FAIL_STATS_FIRST_N), and JSON dumps (FAKE_INTAKE_DUMP_DIR). CI clippy now compiles the feature so the binary stays checked.
The standalone binary is now mock-intake, gated by the mock-intake feature, configured with MOCK_INTAKE_PORT, MOCK_INTAKE_FAIL_STATS_FIRST_N, and MOCK_INTAKE_DUMP_DIR. This aligns the binary with the datadog-mock-intake crate it wraps, whose summaries already used the mock-intake prefix. The mock-intake crate is now a git dependency, so LICENSE-3rdparty.csv gains its first-party record.
Dedupe the duplicated env-var parsing in the mock-intake binary into a generic parse_env_or helper with identical error messages, and drop the rmp-serde/flate2 dev-dependencies left over from when the harness decoded stats payloads itself; the shared datadog-mock-intake crate handles that now.
a1b16a3 to
d763a38
Compare

Overview
Consumes the
datadog-mock-intakecrate fromDataDog/serverless-components(#174)tests/common/fake_intake.rs) is deleted.mock-intakebinary behind a newmock-intakefeature for local APM debugging: it runs the shared crate with request summaries, stats failure injection (MOCK_INTAKE_FAIL_STATS_FIRST_N), and JSON dumps (MOCK_INTAKE_DUMP_DIR). Seebottlecap/src/bin/mock-intake/README.mdfor the workflow. The smoke procedure uses thebottlecap-test-modebinary from [APMSVLS-501] feat(bottlecap): addbottlecap-test-modebinary #1216.mock-intakefeature so the binary stays checked, and GitLab clippy now lints all targets (matching GitHub CI). Test runs are unchanged: the integration tests run in every feature set, as before.Supersedes #1385, which introduced the intake as a bottlecap library module; that implementation now lives in the shared crate.
Testing
cargo test -p bottlecap(default): suite passes, includingapm_integration_testanddsm_integration_test.cargo build -p bottlecap --features mock-intake: clean.cargo clippy --workspace --all-targetsacross default / fips / mock-intake feature sets: no lint warnings.dd-rust-license-tool check: passes (no new third-party dependencies; the crate is first-party).mock-intakebinary with failure injection and a dump directory, POSTed a gzip msgpackStatsPayloadto/api/v0.2/stats: 202 Accepted,mock-intake:summary line with grouped hits and normalized aggregation key, and a JSON dump containing the decoded payload; SIGINT shutdown clean.APMSVLS-499