fix(config): accept scalar additional endpoint API keys - #2224
Conversation
There was a problem hiding this comment.
More details
The new boundary deserializer normalizes scalar and sequence endpoint API-key values into the same typed map, and the generated hook matches only the single relevant map field. No production behavioral regression or diff-only hazard was identified; Rust tests could not run because the sandbox lacks the pinned toolchain update and an uncached git dependency.
🤖 Datadog Autotest · Commit 6af2344 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
There was a problem hiding this comment.
Pull request overview
This PR fixes typed configuration compatibility for additional_endpoints by allowing each map value (API key) to be deserialized from either a scalar string or a sequence, normalizing both into Vec<String> at the configuration boundary to match Core Agent behavior.
Changes:
- Added a tolerant deserializer for
HashMap<String, Vec<String>>that accepts scalar-or-sequence values and normalizes scalars to one-element vectors. - Updated the config code generator to automatically apply this tolerant deserializer to
HashMap<String, Vec<String>>fields so the behavior survives regeneration. - Added regression tests to ensure
additional_endpointsaccepts both scalar and sequence API key shapes.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/datadog-agent/config/src/list_de.rs | Adds the new map-value tolerant deserializer and unit tests for scalar/sequence acceptance. |
| lib/datadog-agent/config/src/lib.rs | Adds regression tests that specifically cover DatadogConfiguration.additional_endpoints shape tolerance. |
| lib/datadog-agent/config/src/generated/datadog_configuration.rs | Applies the new deserializer to additional_endpoints in the generated typed config struct. |
| lib/datadog-agent/config/build/datadog_config_gen.rs | Extends generator logic to inject the tolerant deserializer for HashMap<String, Vec<String>> fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| //! Map values containing string lists have a similar compatibility shape: a single value can arrive | ||
| //! as a scalar string, while multiple values arrive as a sequence. Deserializing here keeps those | ||
| //! differences at the boundary, while downstream consumers always receive a `Vec<String>`. |
Binary Size Analysis (Agent Data Plane)Baseline: 032b9ac · Comparison: 93b30d8 · diff ✅ Binary size difference within thresholdChanges by Module
Detailed Symbol Changes |
Regression Detector (Agent Data Plane)Run ID: Optimization Goals: ✅ No significant changes detectedFine details of change detection per experiment (5)Experiments configured
Bounds Checks: ✅ Passed (5)
ExplanationA change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression ( |
|
Summary
The Core Agent accepts
additional_endpointsAPI keys as either a scalar string or a list. ADP’s typed configuration required every value to be a list, causing startup to fail withexpected a sequencewhen loading existing scalar configurations.Fix
Accept both forms at the typed configuration boundary:
Change Type
How did you test this PR?
References