Skip to content

Use shared datadog-mock-intake crate and add standalone mock-intake binary - #1392

Draft
lucaspimentel wants to merge 10 commits into
mainfrom
lpimentel/mock-intake-consume
Draft

lucaspimentel wants to merge 10 commits into
mainfrom
lpimentel/mock-intake-consume

Conversation

@lucaspimentel

@lucaspimentel lucaspimentel commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Overview

Consumes the new datadog-mock-intake crate from DataDog/serverless-components (#174, pinned to rev 37f5b32a853f82a00523051827af074662f3e8fa):

  • The APM and DSM integration tests now use the shared crate as an ungated dev-dependency; the 317-line test-local intake fixture (tests/common/fake_intake.rs) is deleted.
  • Adds a standalone mock-intake binary behind a new mock-intake feature 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). See bottlecap/src/bin/mock-intake/README.md for the workflow. The smoke procedure uses the bottlecap-test-mode binary from [APMSVLS-501] feat(bottlecap): add bottlecap-test-mode binary #1216 (not yet merged).
  • CI clippy now compiles the mock-intake feature 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.

Stacked on serverless-components#174: this PR's dependency pins rev 37f5b32a853f82a00523051827af074662f3e8fa, the head of that PR's branch (re-pinned to its current head after the mock-intake rename commit). Merge #174 first, then re-pin to the merged commit on main.

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, including apm_integration_test and dsm_integration_test.
  • cargo build -p bottlecap --features mock-intake: clean. cargo clippy --workspace --all-targets across 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).
  • Manual smoke: ran the mock-intake binary with failure injection and a dump directory, POSTed a gzip msgpack StatsPayload to /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.

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Pipelines

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 1 Pipeline job failed

DataDog/datadog-lambda-extension | e2e-test-status (amd64)

View more details · View in GitLab

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: eba0bba | Docs | View more details | Give us feedback!

@lucaspimentel lucaspimentel changed the title Use shared datadog-mock-intake crate and add standalone fake-intake binary Use shared datadog-mock-intake crate and add standalone fake-intake binary Sep 25, 2026
@lucaspimentel

Copy link
Copy Markdown
Member Author

Note to self: rename fake-intake to mock-intake

@lucaspimentel

Copy link
Copy Markdown
Member Author

@DataDog review

@datadog-prod-us1-3 datadog-prod-us1-3 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.

Bits Code Review: PASS

More details

The shared intake preserves the migrated integration-test contract, and the standalone binary remains gated from production builds.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 6826b1f · @DataDog review to ask questions

@lucaspimentel lucaspimentel changed the title Use shared datadog-mock-intake crate and add standalone fake-intake binary Use shared datadog-mock-intake crate and add standalone mock-intake binary Sep 29, 2026
…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.
@lucaspimentel
lucaspimentel force-pushed the lpimentel/mock-intake-consume branch from 603b72a to b186890 Compare October 19, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant