Skip to content

APMSVLS-494: add a standalone fake intake for local APM debugging - #1385

Closed
lucaspimentel wants to merge 1 commit into
mainfrom
lpimentel/fake-intake-bin
Closed

lucaspimentel wants to merge 1 commit into
mainfrom
lpimentel/fake-intake-bin

Conversation

@lucaspimentel

Copy link
Copy Markdown
Member

Overview

Promotes the test-only fake-intake fixture into the bottlecap library behind a new fake-intake feature and adds a standalone fake-intake binary for local APM debugging (APMSVLS-494 phase 2).

The new binary accepts the same APM endpoints the extension flushes to (/api/v0.2/stats msgpack, /api/v0.2/traces protobuf, /api/v0.1/pipeline_stats DSM msgpack), decodes payloads on arrival, and reports them locally. It supports:

  • Request summaries: one stderr line per handled request with identity, endpoint, encoding, status, and payload count; stats requests additionally group hits by the full aggregation key (client env/version/origin context plus all grouped dimensions, deterministic ordering).
  • Failure injection: FAKE_INTAKE_FAIL_STATS_FIRST_N returns HTTP 500 for the first N stats attempts (still decoded, summarized, and dumped, but not captured) so rejection/retry behavior can be exercised locally.
  • JSON dumps: FAKE_INTAKE_DUMP_DIR writes one collision-proof envelope per decoded request, including rejected stats attempts.

The fake-intake feature is never enabled in default or fips. The APM and DSM integration tests now use the library module and are gated on the feature via required-features, so default/FIPS test runs skip them cleanly. Existing test bodies are unchanged. fake_intake.rs is self-contained for later extraction into apm-agent-parity-rs.

Local workflow (feature-gated builds, env vars, smoke procedure against bottlecap-test-mode) is documented in bottlecap/README.md.

Testing

  • cargo nextest run --workspace --features fake-intake: 708/708 passed (includes the APM/DSM integration tests and new fake-intake unit tests for grouping, failure injection, concurrency, dumps, and config errors); default-feature run: 670 passed with the gated targets skipped.
  • cargo clippy --workspace --all-targets -- -D warnings passes for default, default,test-mode,fake-intake, and fips.
  • Manual smoke against the bottlecap-test-mode binary: trace POST accepted, /flush 204, stats hits 2/1 for GET /a/GET /b verified in summaries and JSON dumps; with FAKE_INTAKE_FAIL_STATS_FIRST_N=1 the stats request returned 500 then 202 on retry, both attempts dumped.
  • GitLab pipeline template rendered with gomplate; new cargo test job and extended clippy line verified.

Promote the test-only fake_intake fixture into the bottlecap library
behind a new fake-intake feature, and add a thin fake-intake binary
that runs it with request summaries, stats failure injection, and JSON
dumps for local debugging against a live tracer or the test-mode trace
processor. The APM and DSM integration tests now use the library module
and are skipped by default-feature and FIPS builds.
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Pipelines

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

@lucaspimentel

Copy link
Copy Markdown
Member Author

Superseded by #1392, which consumes the intake as the shared datadog-mock-intake crate from DataDog/serverless-components#174 instead of a bottlecap library module. The standalone fake-intake binary, failure injection, summaries, and JSON dumps carry over unchanged; the APM/DSM integration tests now run in every feature set via the shared crate.

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