Repository navigation
[SVLS-9883] feat: add datadog-serverless-logging crate for DD_LOG_LEVEL_BY_TARGET - #180
Merged
Merged
Conversation
…EL_BY_TARGET Adds a crate with the DD_LOG_LEVEL_BY_TARGET name and build_env_filter, which adds each valid `target=level` entry to an agent's base filter and returns the invalid entries. The Lambda extension will use it, and datadog-serverless-compat can use it later. Each agent keeps its own subscriber and log format. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt variable Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…agent Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lym953
added a commit
to DataDog/datadog-lambda-extension
that referenced
this pull request
Oct 9, 2026
The parsing and the variable name move to the new crate in serverless-components (DataDog/serverless-components#180), so that other serverless agents can share them. Points all five serverless-components dependencies at the head of #180. Its other changes since the current revision are docs and a lock file bump that the extension does not use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lym953
added a commit
to DataDog/datadog-lambda-extension
that referenced
this pull request
Oct 9, 2026
The parsing and the variable name move to the new crate in serverless-components (DataDog/serverless-components#180), so that other serverless agents can share them. Points all five serverless-components dependencies at the head of #180. Its other changes since the current revision are docs and a lock file bump that the extension does not use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lym953
marked this pull request as ready for review
October 9, 2026 19:04
lym953
requested review from
Lewis-E and
clifordshelton
and
a balanced review from Copilot
and removed request for
a team
October 9, 2026 19:04
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation is focused, validated, documented, and adequately tested.
0 open findings
What changed in this PR
Adds reusable target-specific tracing filter support for serverless agents.
Changes:
- Builds filters from validated
<target>=<level>directives. - Returns invalid directives for caller warnings.
- Documents usage and adds unit coverage.
| File | Description |
|---|---|
crates/datadog-serverless-logging/src/lib.rs |
Implements filtering and tests. |
crates/datadog-serverless-logging/README.md |
Documents configuration and targets. |
crates/datadog-serverless-logging/Cargo.toml |
Defines the new crate. |
Cargo.lock |
Records the workspace package. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Lewis-E
approved these changes
Oct 9, 2026
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?
Adds the crate
datadog-serverless-logging. It lets a user set the log level of one target of a serverless agent with the environment variableDD_LOG_LEVEL_BY_TARGET. For example:DD_LOG_LEVEL_BY_TARGETcold_start_duration=debug,dogstatsd=debugWith this value, the agent logs debug messages with the custom target
cold_start_duration, and debug messages from thedogstatsdcrate. The other targets keep the agent's default level. The README lists the kinds of targets.The agent calls
build_env_filter(base, levels_by_target)when it sets up logging. It adds each valid<target>=<level>entry to the agent's base filter, such ash2=off,info, and returns the entries that are not valid. The agent then logs a warning for those entries. A bare level such asdebug, an unknown level, and a span filter such as[span]=debugare not valid.Motivation
DataDog/datadog-lambda-extension#1413 uses this crate, so that a user can see the cold start step durations without all the debug logs. The code is in this repository so that other serverless agents, such as
datadog-serverless-compat, can use the same variable.Additional Notes
This PR does not change
datadog-serverless-compat.Describe how to test/QA your changes
I tested the crate through #1413 on a real Lambda function, with an arm64 build of #1413 at
4a71d023, which uses this crate ate5524046. I forced 2 cold starts for each row and counted the extension's log lines in CloudWatch. Each cold start logs 11 cold start duration lines.DD_LOG_LEVELDD_LOG_LEVEL_BY_TARGETinfocold_start_duration=debugdebugcold_start_duration=offinfodebug,cold_start_duration=verbose,cold_start_duration=debuginfodogstatsd=debugcold_start_duration=debugIn the third row, the extension ignored
debugandcold_start_duration=verbosewith a warning. In the fourth row, all the debug messages come from thedogstatsdcrate.🤖 Generated with Claude Code