Skip to content

[SVLS-8713] test(logs-agent): pin current default behavior with characterization tests - #189

Draft
litianningdatadog wants to merge 1 commit into
mainfrom
tianning.li/logs-sc-0-characterization
Draft

litianningdatadog wants to merge 1 commit into
mainfrom
tianning.li/logs-sc-0-characterization

Conversation

@litianningdatadog

@litianningdatadog litianningdatadog commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds tests only (no production code) that pin what the crate does today with default settings:

  • retry rules: 400/401/404/413 dropped after one try; 408/425/429 and connection errors tried three times and handed back; a redriven request that fails again is handed back again
  • the default Datadog intake URL, headers and compression (on and off), and the 5 s request timeout
  • additional endpoints: called after the primary by default, receive identical compressed bytes, keep their own API key, and are still sent when the primary fails (only the primary is handed back)
  • how many warning lines are logged for each failure type, and that no error lines are written
  • every from_env() default, and the 1 MiB entry limit (exactly 1 MiB kept, one byte more rejected)

Adds tracing-subscriber as a dev-dependency to count log lines.

Motivation

Part of SVLS-8713: bottlecap (the Datadog Lambda Extension) is replacing its own logs aggregator and flusher with this crate. Two rules for the whole stack:

  • Nothing changes for existing users of this crate (for example serverless-compat): every new behavior is opt-in, defaults and public API stay the same (additions only), no new environment variables, no new dependencies.
  • Nothing changes for Lambda users: the options let bottlecap reproduce its current behavior exactly.

The next PRs in this stack add options for bottlecap. These tests make sure none of them changes the defaults that other users rely on: if one does, a test fails.

Additional Notes

One commit (squashed from six per-area commits); the list above follows the same areas.

Describe how to test/QA your changes

cargo test -p datadog-logs-agent: 80 tests pass. clippy (-D warnings) and fmt clean.

Stack

Each PR is nested under the PR it builds on (and targets). Review and merge from the top down.

serverless-components (datadog-logs-agent options; merge first)

datadog-lambda-extension (bottlecap)

🤖 Generated with Claude Code

…tests

Why: bottlecap is about to adopt this crate, and new opt-in options will be
added for it. Other users of the crate (for example serverless-compat) must
keep today's behavior exactly, so the current defaults need tests before
anything changes. If a later change alters a default, one of these fails.

What: tests only, no production code changes. They pin:
- retry rules: 400, 401, 404 and 413 are dropped after one try; 408, 425,
  429 and connection errors are tried three times and handed back; a resent
  request that fails again gets three more tries and is handed back again.
- the default request: https://http-intake.logs.<site>/api/v2/logs with the
  API key, DD-PROTOCOL and Content-Type headers, a zstd body with
  Content-Encoding when compression is on (plain body when off), and the
  5 second request timeout.
- additional endpoints: called only after the primary request finishes,
  each receives exactly the same compressed bytes (compressed at the
  configured level), keeps its own API key, and is still sent when the
  primary fails, in which case only the primary request is handed back.
- log volume: the number of warning lines for a request that keeps failing
  (server errors or dropped connections), a permanent error, a failing
  additional endpoint and each oversized entry, and that no error lines are
  written.
- from_env() defaults with no environment variables set, turning
  compression off, and Observability Pipelines Worker mode only when
  enabled; and the 1 MiB entry limit (exactly 1 MiB kept, one byte more
  rejected).

Adds tracing-subscriber as a test-only dependency to count log lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@litianningdatadog
litianningdatadog force-pushed the tianning.li/logs-sc-0-characterization branch from 8bf6920 to 2c0a3f9 Compare October 21, 2026 19:50

This branch has not been deployed

No deployments
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