Repository navigation
[SVLS-8713] test(logs): contract tests, fake logs intake and benchmark for the logs pipeline - #1448
Draft
litianningdatadog wants to merge 1 commit into
Draft
litianningdatadog wants to merge 1 commit into
litianningdatadog wants to merge 1 commit into
Conversation
This was referenced Oct 21, 2026
Draft
Draft
Draft
|
🔗 Commit SHA: 31214a0 | Docs | View more details | Give us feedback! |
…r the logs pipeline
Why: we are about to replace the logs aggregator and flusher with the shared
datadog-logs-agent crate, and Lambda users must not notice. These changes
record exactly what bottlecap does today, so any change in what it sends
shows up as a failing test instead of a surprise in production, and give a
performance baseline to compare against.
What:
- refactor: the code that creates the logs aggregator, agent and flusher
moves from main.rs into build_logs_pipeline() in the library, so tests run
exactly the production wiring. main.rs still starts the agent in the
background; runtime behavior is unchanged. A unit test checks that a log
sent into the pipeline reaches the aggregator.
- fake logs intake: a test server that accepts log requests over HTTP or
HTTPS (self-signed test certificate), records each request (method, URL,
headers, body), decompresses zstd bodies, and answers with status codes
chosen by the test or hangs on purpose. It has its own tests.
- contract tests (tests/logs_contract_test.rs) through the real pipeline:
- every log field by field: START/END/REPORT lines, plain and JSON
function logs, logs that arrive before START, Managed Instance mode,
processing rules, OOM lines and durable execution logs;
- the URL path, API key, headers, method and compression of each request
for the Datadog intake (compressed and not), Observability Pipelines
Worker, two additional HTTPS endpoints, and a custom intake URL with a
path;
- retry, redrive and drop rules: 403 dropped with no retry; 400, 401,
413, 429 and 500 tried three times, handed back and resent once more;
a redrive resends only the failed request; timeouts and refused
connections are handed back; additional-endpoint failures are resent
only to that endpoint; a missing API key drops the primary's logs with
an error while additional endpoints still get them;
- batching (2,500 small logs and three 2 MiB logs arrive exactly once
within the per-request limits) and oversized logs (a 2 MiB log is sent
with one warning);
- how many warning and error lines the pipeline writes.
Two tests record known bugs on purpose (OPW applied to additional
endpoints; one log over 5 MiB blocking the queue); the next changes fix
them and update those tests.
- benchmark (benches/logs_pipeline.rs): turning Lambda telemetry events into
batched logs, and flushing 1,000 varied logs to a local fake intake with
zero or two additional endpoints, using the extension's allocator. Adds
criterion as a dev-dependency only; the extension binary is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
litianningdatadog
force-pushed
the
tianning.li/logs-bc-0-contract-tests
branch
from
October 21, 2026 19:53
3aefa30 to
31214a0
Compare
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Part of SVLS-8713: bottlecap is replacing its own logs aggregator and flusher with the shared
datadog-logs-agentcrate from serverless-components. Lambda users must not notice the swap, so the plan is: pin today's behavior with tests (this stack), fix two real bugs first so the swap stays a pure refactor (this stack), then swap the aggregator and the flusher (bc-1 and bc-2, which will be opened after the serverless-components PRs merge).Pins what the logs pipeline does today so the coming swap to
datadog-logs-agentcan be shown to change nothing for users. Almost all of it is tests; the only production change is a small refactor.main.rsintobuild_logs_pipeline()in the library, so tests run exactly the production wiring. Runtime behavior is unchanged.tests/logs_contract_test.rs) through the real pipeline: every log field by field (START/END/REPORT, plain and JSON logs, logs before START, Managed Instance, processing rules, OOM, durable execution); URL, headers, method and compression per destination (Datadog, OPW, two additional endpoints, custom intake URL with a path); retries, redrive and drops for 400/401/403/413/429/500, timeouts and refused connections; batching; oversized logs; and warning/error line counts.benches/logs_pipeline.rs, criterion dev-dependency): process-and-batch and flush, used as the baseline for the swap.Two contract tests record known bugs on purpose (OPW + additional endpoints; one log over 5 MiB blocking the queue); the next two PRs fix them and update those tests.
Testing
755 tests pass (lib + contract + integration). clippy (
-D warnings) and fmt clean. Every commit compiles. The benchmark only adds a dev-dependency; the extension binary is 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-agentoptions; merge first)maindefault/fipsfeaturesretry()+FlushPolicydatadog-lambda-extension (bottlecap)
main🤖 Generated with Claude Code