Skip to content

[SVLS-8713] feat(logs-agent): accept pre-serialized logs and an oversize policy - #191

Draft
litianningdatadog wants to merge 1 commit into
tianning.li/logs-sc-1-fips-featuresfrom
tianning.li/logs-sc-2-aggregator-options
Draft

litianningdatadog wants to merge 1 commit into
tianning.li/logs-sc-1-fips-featuresfrom
tianning.li/logs-sc-2-aggregator-options

Conversation

@litianningdatadog

@litianningdatadog litianningdatadog commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

  • AggregatorHandle::insert_serialized_batch(Vec<String>): queues already-serialized JSON objects as-is, in the same queue as normal entries.
  • OversizePolicy on the aggregator and its service: Drop (default, today's behavior: entries over 1 MiB are dropped) or SendWithWarning (keep them with one warning, unless an entry is too big for any payload, len + 2 > 5 MiB, which is still dropped).
  • Also moves the flusher tests unchanged into src/flusher/tests.rs and a small test-only helper for counting log lines (flusher.rs was ~1,500 lines, mostly tests).

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.

bottlecap builds its own nested per-log JSON (message, Lambda context, tags) that IntakeEntry can't express; passing strings keeps the wire format byte-for-byte and avoids serializing twice. bottlecap also sends logs over 1 MiB with a warning instead of dropping them.

Additional Notes

Both are opt-in; defaults unchanged. The large diff is mostly the test-file move (the moved tests are unchanged). Squashed from two commits (the move, then the feature).

Describe how to test/QA your changes

91 tests pass (11 new: serialized inserts, mixed batching, both oversize policies and their warning counts, the too-big-for-any-payload cap). All sc-0 tests unchanged.

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

Why: bottlecap already turns each Lambda log into JSON in its own format,
which this crate's entry type cannot express, and it sends logs over 1 MiB
(with a warning) instead of dropping them. To use this crate without
changing what Lambda users see, the aggregator needs both, as options.

What:
- The aggregator handle gets insert_serialized_batch(), which queues JSON
  strings as-is in the same queue as normal entries.
- The aggregator and its service get an oversize policy: the default still
  drops entries over 1 MiB; the new "send with warning" option keeps them
  with one warning unless they are too big for any payload. Nothing changes
  for existing users.
- The flusher's test module moves unchanged to src/flusher/tests.rs (it had
  grown to about 1,500 lines, mostly tests), and the counter tests use to
  count warning and error lines moves to a small test-only helper so other
  test modules can use it too. Most of this change's diff is that move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@litianningdatadog
litianningdatadog force-pushed the tianning.li/logs-sc-2-aggregator-options branch from ab4758c to 179bcd8 Compare October 21, 2026 19:52

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