Repository navigation
Conversation
This was referenced Oct 7, 2026
Contributor
Author
|
Clippy errors are irrelevant. They will be fixed in #179. |
lym953
marked this pull request as ready for review
October 7, 2026 20:15
lym953
requested review from
apiarian-datadog and
litianningdatadog
and removed request for
a team
October 7, 2026 20:15
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change matches the stated behavior, includes relevant tests, and has no identified blocking issues.
0 open findings
What changed in this PR
Updates datadog-agent-config to accept filter directives in DD_LOG_LEVEL, avoiding false errors when used with the Lambda extension.
Changes:
- Uses the last plain level in a directive list, defaulting to warn.
- Preserves existing plain-level and invalid-value behavior.
- Adds four focused deserialization tests.
| File | Description |
|---|---|
crates/datadog-agent-config/src/deserializers/log_level.rs |
Accepts directive lists and tests level selection and fallbacks. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A value such as `info,cold_start_duration=debug` is a RUST_LOG-style directive list, which the Lambda extension and datadog-serverless-compat pass to their log filter. Take the level from its entry with no target, or info if there is none, and do not log "Invalid log level" for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matches the fallback for an invalid value, so the crate uses one default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lym953
force-pushed
the
yiming.luo/log-level-directives
branch
from
October 8, 2026 16:34
77adbb7 to
254e9bd
Compare
lym953
requested
a balanced review from Copilot
and removed request for
a team,
apiarian-datadog and
litianningdatadog
October 8, 2026 18:58
lym953
marked this pull request as draft
October 9, 2026 15:50
Contributor
Author
|
Closing. Will use a new env var |
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.
What does this PR do?
The
DD_LOG_LEVELdeserializer indatadog-agent-configaccepts aRUST_LOG-style directive list, such asinfo,cold_start_duration=debug, without an error. The parsed level is the last entry that has no target, or warn if no entry is a plain level. Warn is also the fallback for an invalid value. A plain level and an invalid value, such asverbose, behave the same as before.Motivation
What is true today: this crate parses
DD_LOG_LEVELas one level, such asdebug. For any other value, it logsInvalid log level: '<value>'at ERROR and uses warn. No code reads the parsedlog_levelfield.What DataDog/datadog-lambda-extension#1413 adds: the Lambda extension accepts a list of filter directives in
DD_LOG_LEVEL, such asinfo,cold_start_duration=debug. With it, a user can turn on debug logs for one tracing target only. This follows two existing Datadog components:DataDog/saluki, accepts directives inDD_LOG_LEVEL.datadog-serverless-compat, in this repository, gives theDD_LOG_LEVELvalue to its log filter, so directives work there too.The problem: the extension also loads this crate. So with #1413, a directive list makes this crate log the ERROR at each cold start, although the extension uses the value correctly. This PR removes that false ERROR.
Additional Notes
The parser does not check the directives. The extension parses them with
tracing-subscriberand logs a warning for each entry that does not parse.Describe how to test/QA your changes
cargo test -p datadog-agent-config --lib log_level. The four new unit tests and the existingtest_parse_log_levelpass.serverless-componentsrevision. Run 2 cold starts for each value below.DD_LOG_LEVELinfo,cold_start_duration=debugdebug,cold_start_duration=offdebugcargo test --lockedfails onmainbefore this change, becauseCargo.lockneeds an update. I ran the tests without--lockedand did not commit the lock file changes.🤖 Generated with Claude Code