Skip to content

fix(config): accept the wider additional_endpoints input forms - #1994

Merged
webern merged 1 commit into
m/pr5-cutoverfrom
m/additional-endpoints-source-forms
Jul 5, 2026
Merged

fix(config): accept the wider additional_endpoints input forms#1994
webern merged 1 commit into
m/pr5-cutoverfrom
m/additional-endpoints-source-forms

Conversation

@webern

@webern webern commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

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

  • 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

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.
Copilot AI review requested due to automatic review settings July 5, 2026 18:25
@webern
webern requested a review from a team as a code owner July 5, 2026 18:25

Copilot AI 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.

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_forms to accept additional_endpoints as 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
webern merged commit 8047571 into m/pr5-cutover Jul 5, 2026
41 of 52 checks passed
@webern
webern deleted the m/additional-endpoints-source-forms branch July 5, 2026 18:31
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`
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