Skip to content

[SVLS-8713] feat(logs-agent): optional API key resolver and Datadog intake URL override - #192

Draft
litianningdatadog wants to merge 1 commit into
tianning.li/logs-sc-2-aggregator-optionsfrom
tianning.li/logs-sc-3a-key-and-url
Draft

litianningdatadog wants to merge 1 commit into
tianning.li/logs-sc-2-aggregator-optionsfrom
tianning.li/logs-sc-3a-key-and-url

Conversation

@litianningdatadog

@litianningdatadog litianningdatadog commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Two optional builder methods on LogFlusher:

  • with_api_key_resolver(ApiKeyResolver): an async closure called for the primary key on every flush, so a reloaded key is used right away. If it returns no key, the primary is skipped for that flush with one error line; additional endpoints are still sent.
  • with_datadog_intake_url(url): replaces the default Datadog intake URL (keeps any path), Datadog mode only.

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's key can come from AWS Secrets Manager/KMS/SSM and can be reloaded (api_key_secret_reload_interval), and users can set DD_LOGS_CONFIG_LOGS_DD_URL. A closure instead of taking bottlecap's key factory type keeps dogstatsd (~38 crates) out of this crate.

Additional Notes

Without these methods the flusher behaves exactly as before. No new dependencies.

Describe how to test/QA your changes

98 tests pass (new: resolved key used, resolver called every flush, reloaded key used next flush, no-key path still sends extras, URL override used in Datadog mode and ignored for OPW).

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

…erride

Why: bottlecap gets its API key lazily (it may come from AWS Secrets Manager
and can be reloaded) and lets users point logs at a custom intake URL. This
crate only took a fixed key and a fixed URL, so bottlecap could not use it
without changing behavior for Lambda users.

What: the flusher gets two optional builder methods. with_api_key_resolver()
calls a key resolver for the primary key on every flush, so a reloaded key is
used right away; if no key comes back, the primary is skipped for that flush
with one error line and additional endpoints are still sent.
with_datadog_intake_url() replaces the default Datadog intake URL. Without them
the flusher behaves exactly as before, and no dependencies are added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@litianningdatadog
litianningdatadog force-pushed the tianning.li/logs-sc-3a-key-and-url branch from a107102 to 7105107 Compare October 21, 2026 19:52
@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