Repository navigation
Conversation
build_env_filter takes a list of targets whose level no entry can change. An entry is not valid if its target starts with a locked target, or if a locked target starts with its target, because an entry also matches every target that starts with its text. The Lambda extension will lock h2, hyper, reqwest and rustls: it sends its own logs to Datadog, so the logs these libraries write for each request would add lines to each flush. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lym953
marked this pull request as ready for review
October 14, 2026 19:47
lym953
requested review from
duncanpharvey and
shreyamalpani
and
a balanced review from Copilot
and removed request for
a team
October 14, 2026 19:47
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The prefix checks implement the documented locking behavior, with focused tests and no identified blocking issues.
0 open findings
What changed in this PR
Adds agent-controlled target locks to prevent DD_LOG_LEVEL_BY_TARGET from overriding protected logging levels.
Changes:
- Adds a
locked_targetsargument and rejects overlapping target prefixes. - Tests exact, descendant, and ancestor matches while allowing unrelated targets.
- Documents locking behavior and updates usage examples.
| File | Description |
|---|---|
| crates/datadog-serverless-logging/src/lib.rs | Implements target locking and updates unit tests. |
| crates/datadog-serverless-logging/README.md | Documents locked targets and the updated API. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
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.
Problem
In the Lambda extension, the new variable
DD_LOG_LEVEL_BY_TARGETfrom DataDog/datadog-lambda-extension#1413 can turn on the logs of the HTTP librariesh2,hyper,reqwestandrustls. The extension sends its own logs to Datadog, and these libraries log each HTTP request, including the requests that send logs. So withhyper=debug, each flush adds lines to the next flush, and the customer pays for them. A review comment on #1413 asks to keep these four libraries off.This PR
With this PR, an agent can lock some targets, so that
DD_LOG_LEVEL_BY_TARGETcannot change their log level. The agent warns about an entry for a locked target and ignores it, as it does for a typo. For example, if the agent locksh2andhyper:DD_LOG_LEVEL_BY_TARGETentryh2=debughyper::proto=debughyperh=debugh2andhyperdogstatsd=debugThe third row matters because an entry matches every target that starts with its text.
In the code, the function that builds the log filter,
build_env_filter, takes the list of locked targets as a third argument. Its only caller is #1413. After this PR merges, #1413 will pass the four libraries and bump theserverless-componentsrevision.Testing
A new unit test checks the four entries in the table. The test on a Lambda function will be in #1413.
🤖 Generated with Claude Code