chore(config): generate datadog config deserializer#1863
Conversation
This comment has been minimized.
This comment has been minimized.
Binary Size Analysis (Agent Data Plane)Baseline: 9c1abde · Comparison: 0b4737b · 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 (35)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 ( |
239555c to
b4e40b9
Compare
b4e40b9 to
5a9e285
Compare
5a9e285 to
101a99e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2aa1e33820
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// Generated at build time from `core_schema.yaml` plus `schema_overlay.yaml`. Contains only keys | ||
| /// inventoried as `support: full` or `support: partial`. Mostly unused until the configuration | ||
| /// translator consumes it. | ||
| pub mod datadog_configuration; |
There was a problem hiding this comment.
We might just want to call this module generated to really highlight that it's generated code.
2aa1e33 to
0b4737b
Compare

Human Summary
This PR introduces a deserialization structure (nested) for Datadog configuration, generated from the specification. It isn't wired into the configuration system yet so at the moment it is inert bagage. Later it will be placed in front of ADP's access to Datadog Agent configuration to prevent the leakage of
GenericConfigurationthroughout the system (stay tuned).AI Summary
Generates a public, typed
DatadogConfigurationdeserializer indatadog-agent-configfor theDatadog Agent config keys ADP actually supports (
support: full/support: partialin theoverlay), and frees up that name by renaming the forwarder's struct first.
This is the first PR of the mapless Configuration Translation System. The generated type is a typed
input surface for supported Agent config. It is expected to be mostly unused until the
translator PR (PR 3) — it is intentionally dead code for now, not an accidental leftover.
What it does:
DatadogConfiguration→DatadogForwarderConfiguration(
saluki-componentsforwarders + the two call sites inagent-data-plane) so the generated typecan own the
DatadogConfigurationname.config/build/datadog_config_gen.rs) that:nesting (132 leaves across 93 top-level keys), and
typifyto generate a nested struct tree (
DatadogConfiguration,DatadogConfigurationApmConfig, ...; 31 structs).datadog_agent_config::DatadogConfiguration(re-exported at the crate root).Design notes:
drives the key selection via the pruning step; typify does the mechanical schema→Rust generation.
The Datadog schema types all numerics as
number, so ports/sizes/timeouts surface asf64.Semantic refinement (e.g. port →
u16) belongs in the downstream translator, where theoverlay/semantic knowledge already lives — not in this mirror. typify has no per-field type knob
(its conversions match by schema shape, and these keys share an identical
{type: number}schema), so honoring "no ugly schema manipulation" means accepting
f64here.non-null
defaultbecomes a non-optional field with#[serde(default = "...")]; a key with nodefault (or a null default) becomes
Option<T>. Object sections without a default are thereforeOption<Section>.additional_endpointsbecomesHashMap<String, Vec<String>>.New build-dependencies on
datadog-agent-config(all permissive licenses):typify(Apache-2.0),schemars(MIT),prettyplease,syn(plus transitiveregress,dyn-clone,schemars_derive,serde_derive_internals,typify-impl, recorded inLICENSE-3rdparty.csv). The generatedsrc/datadog_configuration.rsis checked in with a// @generatedheader (same pattern asclassifier_data.rs) and is rustfmt-canonicalized by the generator so it stays stable acrossregenerations.
The generator post-processes typify's output for readability: strips the embedded
<details>...```json```...</details>schema blocks; converts multi-line/** */doc blocks to///lines and normalizes leading spaces (on the syn AST); shortens fully qualified prelude paths(
::std::option::Option->Option,::std::collections::HashMap->HashMap+ ause, etc.) viaa syn
VisitMut(serde derives and the boilerplateerrormodule's::std::fmt/Cowpaths areleft qualified to avoid a
fmt::Resultvs preludeResultcollision); and inserts blank linesbetween fields and between top-level items. Because the generated doc comments are verbatim schema
prose (identifiers, units, etc.), the file is exempted from the Vale prose linter via the
check-docsglob in theMakefile.Change Type
How did you test this PR?
make check-allpasses (fmt +cargo sort, clippy, docs/Vale, deny, licenses, unused-deps,api-docs, features) and
make test-allpasses. (The generator shells the output through rustfmt,which auto-discovers the repo
rustfmt.toml; the lone nightly-only optiongroup_importsis ano-op since the generated file has no
useimports.)cargo build -p saluki-components -p agent-data-planecompiles after the rename; the renamedforwarder unit test passes.
Overlay-driven generation proof (local only): temporarily changed
aggregator_buffer_sizefrom
support: nonetosupport: fullinschema_overlay.yaml, ranmake build-schema-overlay, and verified the regeneratedDatadogConfigurationgainedpub aggregator_buffer_size: f64plus its schema default function. The same run moved the keyfrom unsupported to supported generated registry/docs outputs. Reverted the temporary overlay and
generated-file changes afterward.
Supported-key audit: parsed the generated
DatadogConfigurationstruct tree and compared leafpaths against the overlay. Result: 132 generated leaf fields == 132
support: full/support: partialoverlay keys; 0 generated leaves outside that set; 0 missing supported keys; 0unsupported or excluded keys present.
DROPME proof against a real Datadog Agent (removed before merge): a temporary block in
run.rs(at the config-check point, where the Core Agent's authoritative config-stream config isin hand) deserializes the generated
DatadogConfigurationand logs the result. A Panoramicintegration case (
test/integration/cases/adp-datadog-config-deserialize) runs ADP inside thebundled image alongside the real Datadog Agent (non-standalone, RAR registration, new config
stream endpoint) and asserts the OK line. Run with
panoramic run --tests adp-datadog-config-deserialize --runtime linux. Result: PASS. Observed logsequence:
i.e. the generated type deserializes the config the real Agent actually delivers over the config
stream, and ADP stays stable with no panics afterward. The DROPME runtime block and the test case
are removed before review.
References