Skip to content

feat(agent-config): allow extensible configuration via ConfigExtension trait#111

Open
duncanista wants to merge 4 commits intomainfrom
jordan.gonzalez/config/allow-extensible-configuration
Open

feat(agent-config): allow extensible configuration via ConfigExtension trait#111
duncanista wants to merge 4 commits intomainfrom
jordan.gonzalez/config/allow-extensible-configuration

Conversation

@duncanista
Copy link
Copy Markdown
Contributor

Summary

  • Introduces a generic Config<E: ConfigExtension = NoExtension> type that lets consumers define additional configuration fields without modifying or copy-pasting the core crate
  • Adds a unified Source type for dual extraction from both env vars and YAML, and a merge_fields! macro to reduce merge boilerplate
  • Moves Lambda-specific fields out of the core Config struct so non-Lambda consumers don't carry unused fields
  • Restructures the crate to use a conventional src/ layout and adds a README documenting the extension API

Test plan

  • All 71 existing + new unit tests pass (cargo test -p datadog-agent-config)
  • Clippy passes with -D warnings on lib and tests
  • Full workspace build passes (cargo build --workspace)
  • Extension mechanism tested: NoExtension works, extension receives env/yaml fields, env overrides yaml, defaults when not set, extension does not interfere with core fields

Copilot AI review requested due to automatic review settings April 2, 2026 20:00
@duncanista duncanista requested review from a team as code owners April 2, 2026 20:00
@duncanista duncanista requested review from Lewis-E and jchrostek-dd and removed request for a team April 2, 2026 20:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 12 changed files in this pull request and generated no comments.

…n trait

Introduces a generic `Config<E: ConfigExtension>` type that lets consumers
define additional configuration fields without modifying or copy-pasting the
core crate. Includes a unified `Source` type for dual extraction from both
env vars and YAML, a `merge_fields!` macro to reduce merge boilerplate, and
moves Lambda-specific fields out of the core Config struct.

Also restructures the crate to use a conventional `src/` layout and adds a
README documenting the extension API.
…s/ modules

Move config source implementations (env, yaml) into `src/sources/` and
type definitions with custom deserialization into `src/deserializers/`.
Re-exports at the crate root preserve all existing import paths.
…zers/helpers.rs

Extracts all generic deserializer functions (deserialize_optional_string,
deserialize_with_default, duration parsers, key-value parsers, etc.) from
lib.rs into src/deserializers/helpers.rs. Re-exported at the crate root
so all existing import paths continue to work.
Reorganize lib.rs so an engineer opening the file immediately sees the
Config struct and its fields, followed by the loading entry points, then
the extension trait, builder, and macros. Sections are separated with
headers for quick scanning.
@duncanista duncanista force-pushed the jordan.gonzalez/config/allow-extensible-configuration branch from 9fe85fb to 7c6eb51 Compare April 2, 2026 20:26
@Lewis-E Lewis-E requested a review from duncanpharvey April 2, 2026 21:12
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.

2 participants