fix(config): accept the wider additional_endpoints input forms - #1994
Merged
Conversation
Migrating the metrics encoder and forwarder to the typed model dropped the
component serde on additional_endpoints, whose PickFirst<DisplayFromStr> and
OneOrMany used to accept two shapes the generated HashMap<String, Vec<String>>
deserializer rejects:
- the whole map as a JSON string, which is how an env var arrives
(DD_ADDITIONAL_ENDPOINTS='{"https://app.datadoghq.com":["key"]}'), and
- a bare string in place of a one-element key list for a host.
Either shape now fails deserialization outright, so a dual-shipping deployment
configured through the environment fails to start. Restore both in
normalize_datadog_input_forms, alongside the existing dogstatsd coercions: parse
the JSON-string form into an object, then wrap any bare-string host value into a
one-element array.
1 task
There was a problem hiding this comment.
Pull request overview
Fixes a regression in config deserialization by re-introducing legacy additional_endpoints input shapes during the Datadog config normalization step, ensuring environment-variable–sourced configurations continue to load correctly in dual-shipping deployments.
Changes:
- Extend
normalize_datadog_input_formsto acceptadditional_endpointsas either a JSON string (env-var form) or a map whose values may be scalar strings (wrapped into a 1-element list). - Add a focused async test covering JSON-string map, JSON-string-with-scalar, native map-with-scalar, and native map-of-lists shapes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
webern
added a commit
that referenced
this pull request
Jul 8, 2026
## 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`
webern
added a commit
that referenced
this pull request
Jul 13, 2026
## 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`
webern
added a commit
that referenced
this pull request
Jul 13, 2026
## 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`
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.
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_endpointsinput shapes that were lost when the metrics encoder andforwarder moved off the component serde onto the typed model.
The old
AdditionalEndpointsserde usedPickFirst<(DisplayFromStr, _)>plusOneOrMany, so itaccepted:
DD_ADDITIONAL_ENDPOINTS='{"https://app.datadoghq.com":["key"]}', andThe generated
DatadogConfigurationdeserializesadditional_endpointsas a plainHashMap<String, Vec<String>>, and the env overlay only materializes scalar/space-separated-listenv 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_endpointscase tonormalize_datadog_input_forms(the same pass thatalready restores the
dogstatsd_eol_requiredanddogstatsd_mapper_profilesenv-var forms): parsethe 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
How did you test this PR?
cargo nextest run -p agent-data-plane-config-system(addedadditional_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 withinvalid type: string ..., expected a map).make fmtReferences
m/pr5-cutover