Skip to content

fix(config): accept scalar additional endpoint API keys - #2224

Open
rayz wants to merge 2 commits into
mainfrom
rayz/fix-scalar-additional-endpoints
Open

fix(config): accept scalar additional endpoint API keys#2224
rayz wants to merge 2 commits into
mainfrom
rayz/fix-scalar-additional-endpoints

Conversation

@rayz

@rayz rayz commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The Core Agent accepts additional_endpoints API keys as either a scalar string or a list. ADP’s typed configuration required every value to be a list, causing startup to fail with expected a sequence when loading existing scalar configurations.

Fix

Accept both forms at the typed configuration boundary:

  • Normalize a scalar API key into a one-element list.
  • Preserve list values unchanged.
  • Generate the tolerant deserializer so it remains applied after schema regeneration.

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

How did you test this PR?

References

@rayz
rayz requested a review from a team as a code owner July 28, 2026 19:34
@rayz
rayz requested review from Copilot and removed request for a team July 28, 2026 19:34

@datadog-prod-us1-5 datadog-prod-us1-5 Bot 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.

Datadog Autotest: PASS

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.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Datadog Autotest · Commit 6af2344 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

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

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_endpoints accepts 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.

Comment on lines +8 to +10
//! 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>`.
@pr-commenter

pr-commenter Bot commented Jul 28, 2026

Copy link
Copy Markdown

Binary Size Analysis (Agent Data Plane)

Baseline: 032b9ac · Comparison: 93b30d8 · diff
Analysis Configuration: stripped binaries · Pass/Fail Threshold: +5%
Sizes: 40.83 MiB (baseline) vs 40.84 MiB (comparison)
Size Change: +6.20 KiB (+0.01%)

✅ Binary size difference within threshold

Changes by Module
Module File Size Symbols
otlp_protos::otlp_include::opentelemetry +69.44 KiB 102
core -56.78 KiB 2269
hyper +44.33 KiB 95
prost -44.27 KiB 118
hyper_util -43.38 KiB 18
figment -43.38 KiB 95
tokio +40.26 KiB 1017
tonic -18.35 KiB 89
axum -17.83 KiB 87
saluki_components::sources::dogstatsd -17.54 KiB 44
anon.46ec9389de8a8262a59051cea6062853.0.llvm.17460567552249571989 +17.45 KiB 1
anon.1c766fa05dd13eba06da95c69824d6af.995.llvm.16845278109024732812 -17.36 KiB 1
anon.1c766fa05dd13eba06da95c69824d6af.995.llvm.2183139281678763661 +17.36 KiB 1
anon.ad88aefe8160b8dedfdf5305e59f030a.513.llvm.6948463008055664385 -17.27 KiB 1
http_body_util +16.41 KiB 50
serde_core +15.72 KiB 160
piecemeal -15.59 KiB 27
[sections] +12.81 KiB 9
anon.70f75a32836431bce89ba07364dd775c.825.llvm.14811480363963650202 +12.29 KiB 1
anon.ad88aefe8160b8dedfdf5305e59f030a.665.llvm.6948463008055664385 -12.20 KiB 1
Detailed Symbol Changes
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [ = ]       0  +700% +1.75Mi    _rjem_je_arena_emap_global
  [NEW] +17.5Ki  [NEW]     +76    anon.46ec9389de8a8262a59051cea6062853.0.llvm.17460567552249571989
  [NEW] +17.4Ki  [NEW] +17.3Ki    anon.1c766fa05dd13eba06da95c69824d6af.995.llvm.2183139281678763661
  +247% +14.9Ki  +251% +14.9Ki    h2::proto::connection::DynConnection<B>::recv_frame::h0d14cf3b5c6935a8
 +54e2% +12.4Ki +92e2% +12.4Ki    std::sys::backtrace::__rust_begin_short_backtrace::h1911594c6b318dfd
  [NEW] +12.3Ki  [NEW]     +81    anon.70f75a32836431bce89ba07364dd775c.825.llvm.14811480363963650202
  [NEW] +11.1Ki  [NEW] +11.0Ki    _<hyper::proto::h2::server::Server<T,S,B,E> as core::future::future::Future>::poll::h810247edb4cb8699
  [NEW] +10.3Ki  [NEW] +10.1Ki    _<saluki_components::encoders::datadog::metrics::DatadogMetricsConfiguration as saluki_core::components::encoders::builder::EncoderBuilder>::build::_{{closure}}::h7bd57d735fa88af2
  [NEW] +9.59Ki  [NEW] +9.44Ki    _<hyper::proto::h2::server::Server<T,S,B,E> as core::future::future::Future>::poll::hed8f6134e46ff0e4
  [NEW] +9.57Ki  [NEW] +9.42Ki    _<hyper::proto::h2::server::Server<T,S,B,E> as core::future::future::Future>::poll::hd041a5d119d8ff92
 -87.3% -9.86Ki -88.0% -9.86Ki    std::sys::backtrace::__rust_begin_short_backtrace::h3d689d6ace8b6cf2
 -94.5% -11.2Ki -95.2% -11.2Ki    prost::message::Message::encode_to_vec::h6374245488921d75
  [DEL] -11.5Ki  [DEL] -11.4Ki    saluki_components::sources::dogstatsd::replay::writer::run_capture_loop::h3287ac3e9ae22a2f
  [DEL] -12.2Ki  [DEL]     -81    anon.ad88aefe8160b8dedfdf5305e59f030a.665.llvm.6948463008055664385
 -84.0% -13.7Ki -84.8% -13.7Ki    _<hyper_util::server::conn::auto::Connection<I,S,E> as core::future::future::Future>::poll::h5670434c8a709418
 -86.2% -13.8Ki -87.0% -13.8Ki    _<hyper_util::server::conn::auto::Connection<I,S,E> as core::future::future::Future>::poll::he89a2edaa7fcd54b
 -85.0% -14.7Ki -85.8% -14.7Ki    _<hyper_util::server::conn::auto::Connection<I,S,E> as core::future::future::Future>::poll::hca913f7324cfdd5b
 -97.1% -16.5Ki -97.5% -16.5Ki    prost::message::Message::encode::h28ad969e25341bd5
  [DEL] -17.3Ki  [DEL]     -76    anon.ad88aefe8160b8dedfdf5305e59f030a.513.llvm.6948463008055664385
  [DEL] -17.4Ki  [DEL] -17.3Ki    anon.1c766fa05dd13eba06da95c69824d6af.995.llvm.16845278109024732812
  +0.3% +29.3Ki  -0.5% -44.0Ki    [15048 Others]
  +0.0% +6.20Ki  +5.2% +1.68Mi    TOTAL

@pr-commenter

pr-commenter Bot commented Jul 28, 2026

Copy link
Copy Markdown

Regression Detector (Agent Data Plane)

Run ID: 8a6c3c45-c8ca-49e0-adf2-f81aa4ad18d4
Baseline: 032b9ac5 · Comparison: 93b30d80 · diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment (5)

Experiments configured erratic: true are tagged (ignored) and skipped when determining which experiments regressed or improved. Experiments which are detected as erratic at runtime are tagged (erratic) to flag that the run's sample dispersion was high, but their regression / improvement signal still counts.

experiment goal Δ mean % links
quality_gates_rss_idle memory ⚪ +0.46 metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory ⚪ +0.14 metrics profiles logs
quality_gates_rss_dsd_low memory ⚪ +0.11 metrics profiles logs
quality_gates_rss_dsd_medium memory ⚪ -0.07 metrics profiles logs
quality_gates_rss_dsd_heavy memory ⚪ -0.36 metrics profiles logs
Bounds Checks: ✅ Passed (5)
experiment check replicates observed links
quality_gates_rss_dsd_heavy memory_usage 10/10 ✅ 133 MiB ≤ 140 MiB metrics profiles logs
quality_gates_rss_dsd_low memory_usage 10/10 ✅ 45.6 MiB ≤ 50 MiB metrics profiles logs
quality_gates_rss_dsd_medium memory_usage 10/10 ✅ 67.2 MiB ≤ 75 MiB metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 ✅ 194 MiB ≤ 200 MiB metrics profiles logs
quality_gates_rss_idle memory_usage 10/10 ✅ 31.4 MiB ≤ 40 MiB metrics profiles logs
Explanation

A 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 (is_regression: true). Improvements use the matching criteria for the improving direction. Experiments configured erratic: true (tagged (ignored)) are skipped outright; experiments detected as erratic at runtime (tagged (erratic)) still count, since that flag describes sample dispersion rather than directional certainty. The Δ mean % cell is colored accordingly: 🟢 = improvement, 🔴 = regression, ⚪ = neutral. Reduction in CPU or memory is an improvement; reduction in ingress throughput is a regression.

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jul 28, 2026

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 22 Pipeline jobs failed

DataDog/saluki | build-adp-comparison-image   View in Datadog   GitLab

DataDog/saluki | build-panoramic-binary   View in Datadog   GitLab

DataDog/saluki | calculate-build-metadata   View in Datadog   GitLab

View all 22 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 93b30d8 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts dd-octo-sts Bot added area/components Sources, transforms, and destinations. encoder/datadog-metrics Datadog Metrics encoder. labels Jul 28, 2026

@tobz tobz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, assuming CI passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/components Sources, transforms, and destinations. encoder/datadog-metrics Datadog Metrics encoder.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants