Commit 8047571
authored
fix(config): accept the wider additional_endpoints input forms (#1994)
## Human Summary
Caught by AI when reviewing #1993, it looks like this was a regression
in the environment variable path only, which *should not* have affected
customers anyway, but it looks like now we handle JSON in environment
variable correctly if we happen to ever read that.
## AI Summary
Restores the wider `additional_endpoints` input shapes that were lost
when the metrics encoder and
forwarder moved off the component serde onto the typed model.
The old `AdditionalEndpoints` serde used `PickFirst<(DisplayFromStr,
_)>` plus `OneOrMany`, so it
accepted:
- the whole map as a JSON string — the form an environment variable
produces, e.g.
`DD_ADDITIONAL_ENDPOINTS='{"https://app.datadoghq.com":["key"]}'`, and
- a bare string in place of a one-element key list for a host.
The generated `DatadogConfiguration` deserializes `additional_endpoints`
as a plain
`HashMap<String, Vec<String>>`, and the env overlay only materializes
scalar/space-separated-list
env values, so neither shape survives. Both now fail deserialization
outright — a dual-shipping
deployment configured through the environment fails to start.
This adds an `additional_endpoints` case to
`normalize_datadog_input_forms` (the same pass that
already restores the `dogstatsd_eol_required` and
`dogstatsd_mapper_profiles` env-var forms): parse
the JSON-string form into an object, then wrap any bare-string host
value into a one-element array.
Invalid JSON is left in place so the downstream deserializer still
surfaces the error.
## Change Type
- [x] Bug fix
## How did you test this PR?
- `cargo nextest run -p agent-data-plane-config-system` (added
`additional_endpoints_accepts_json_string_scalar_or_map`, covering the
JSON-string, JSON-string-with-scalar, native-scalar, and native-list
shapes; confirmed it fails without the fix with `invalid type: string
..., expected a map`).
- `make fmt`
## References
- Merges into `m/pr5-cutover`1 parent dbdba58 commit 8047571
1 file changed
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
259 | 281 | | |
260 | 282 | | |
261 | 283 | | |
| |||
558 | 580 | | |
559 | 581 | | |
560 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
561 | 612 | | |
562 | 613 | | |
563 | 614 | | |
| |||
0 commit comments