Skip to content

[APMSVLS-674] Support space-separated DD_APM_FEATURES and delimited strings in apm_config.features - #186

Open
lucaspimentel wants to merge 4 commits into
mainfrom
lpimentel/apm-features-deserializer
Open

lucaspimentel wants to merge 4 commits into
mainfrom
lpimentel/apm-features-deserializer

Conversation

@lucaspimentel

@lucaspimentel lucaspimentel commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Parses DD_APM_FEATURES and the apm_config.features YAML setting with comma-then-space delimiter selection, matching the Go agent's comma_then_space_separated env parser: if the value contains a comma, commas are the delimiter; otherwise spaces are. Entries are trimmed and empty entries dropped, so a docs-style value like this now enables both features instead of one unmatchable entry:

DD_APM_FEATURES="error_rare_sample_tracer_drop enable_otlp_compute_top_level_by_span_kind"
  • Env: new deserialize_comma_then_space_separated_string helper; DD_PROXY_NO_PROXY keeps comma-only splitting, with the divergence from the Go agent's comma+space NO_PROXY parsing documented at the field.
  • YAML: apm_config.features previously rejected delimited strings entirely (silently falling back to an empty list). A new dual-shape deserializer accepts native lists as before, and splits delimited strings with the same comma-then-space rules. A native list with a non-string element is dropped entirely (with a warning), matching the Go agent's GetStringSlice all-or-nothing behavior. Other shapes fall back to an empty list with a warning.

Motivation

The public docs show space-separated DD_APM_FEATURES values, but the env source split on commas only, so space-separated feature lists silently failed exact-match consumers. First consumer is the upcoming bottlecap error_rare_sample_tracer_drop gate in DataDog/datadog-lambda-extension#1427

Additional Notes

  • Deliberate divergence from Go, documented in the helper doc comments: Go's env parser keeps empty entries and its YAML path does not comma-split strings for this setting; this crate trims and drops empties on both paths.
  • Note on the divergences: fixing them later would be breaking changes. Existing configurations that rely on this crate's current parsing could resolve to different feature lists after an alignment: for example, matching Go's empty-entry behavior would start emitting empty feature names, and aligning the YAML or DD_PROXY_NO_PROXY paths with Go's splitting (or non-splitting) rules could change which entries existing users' configs produce, silently enabling or disabling features. Any alignment therefore needs its own breaking-change consideration rather than a drop-in fix.
  • Go reference: pkg/config/helper/env.go (ParseEnvSplitCommaThenSpace) and pkg/config/schema/yaml/apm_config.yaml (env_parser: comma_then_space_separated) in DataDog/datadog-agent.

Describe how to test/QA your changes

Suite passes. New figment Jail tests cover: space-separated and comma-separated values, mixed separators (comma wins, space stays inside the entry), trimming and empty-entry dropping, blank values, tab staying inside an entry, the native YAML list shape, and env-over-YAML merge order. Existing list and wrong-type fallback tests for apm_config.features still pass.

APMSVLS-674.

Split DD_APM_FEATURES on commas, or on spaces when no comma is present,
matching the Go agent's comma_then_space_separated env parser. Entries
are trimmed and empty entries dropped, so a documented value like
'error_rare_sample_tracer_drop enable_otlp_compute_top_level_by_span_kind'
now enables both features instead of one unmatchable entry.

DD_PROXY_NO_PROXY keeps comma-only splitting; the divergence from the Go
agent's comma+space NO_PROXY parsing is documented at the field.
A string value in the YAML features setting was silently dropped to an
empty list. It is now split with the same comma-then-space rules as the
DD_APM_FEATURES env var (comma wins as delimiter when present, otherwise
spaces split; entries are trimmed and empties dropped). Native YAML
lists keep working as before, and non-string values still fall back to
an empty list with a warning.
@lucaspimentel lucaspimentel changed the title Support space-separated DD_APM_FEATURES and delimited strings in apm_config.features [APMSVLS-674] Support space-separated DD_APM_FEATURES and delimited strings in apm_config.features Oct 15, 2026
@lucaspimentel
lucaspimentel marked this pull request as ready for review October 15, 2026 21:59
@lucaspimentel
lucaspimentel requested review from a team as code owners October 15, 2026 21:59
@lucaspimentel
lucaspimentel requested review from Lewis-E and litianningdatadog and a balanced review from Copilot and removed request for a team and Copilot October 15, 2026 21:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T22:01:52.138242Z 15c69f8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lucaspimentel

Copy link
Copy Markdown
Member Author

@DataDog review

@datadog-datadog-us1-prod datadog-datadog-us1-prod Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The parsing paths consistently apply comma-first delimiter selection to environment and YAML strings while preserving native YAML lists and configuration merge behavior. The completed static review identified no reportable defects.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 15c69f8

@litianningdatadog litianningdatadog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comment.

Comment thread crates/datadog-agent-config/src/deserializers/helpers.rs Outdated
Copilot AI balanced review requested due to automatic review settings October 16, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Rejected configuration values can expose credentials in the new warning logs.

1 open finding
What changed in this PR

Adds comma-then-space parsing for APM feature settings in the agent configuration crate.

Changes:

  • Supports space-separated environment values and delimited YAML strings.
  • Adds parsing and precedence tests while retaining YAML list support.
  • Documents intentional differences from Go parsing.
File Description
crates/​datadog-agent-config/​src/​sources/​yaml.rs Enables string-or-list parsing and adds YAML tests.
crates/​datadog-agent-config/​src/​sources/​env.rs Updates feature parsing and tests; documents unchanged proxy parsing.
crates/​datadog-agent-config/​src/​deserializers/​helpers.rs Adds shared splitting and YAML deserialization helpers.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/datadog-agent-config/src/deserializers/helpers.rs Outdated
@lucaspimentel

Copy link
Copy Markdown
Member Author

@DataDog review

@datadog-datadog-us1-prod datadog-datadog-us1-prod Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

Delimiter selection matches the documented comma-precedence and literal-space rules. Static review found no actionable regression in YAML list handling or environment-over-YAML precedence.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 2b74360

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.

3 participants