Skip to content

Configuration system ​

This page explains the architecture of the configuration system and inventory, and the workflows for changing them. Read it before working on lib/agent-data-plane-config*, lib/datadog-agent/config*, schema_overlay.yaml, SalukiConfiguration, DatadogConfiguration, or typed configuration migrations.

Saluki configures its runtime through a typed boundary. An alternate method of reading configuration, GenericConfiguration, exists in saluki-config for external clients who may want a raw map view, but agent-data-plane doesn't use it. Don't delete it as dead code: it's library code that other projects may depend on.

Paths and type names can move. If you find this page out of date, update it in the same change.

Why this system exists ​

GenericConfiguration previously leaked source-language details into components, such as serde names, aliases, parsing, and defaults. The typed system places a translation boundary between configuration sources and runtime code:

text
 Datadog schema config ──> DatadogConfiguration ──> witness drive ──┐
                                                                    │
 Saluki-only config ───────────────> SalukiOnly ───────> seed ──────┤
                                                                    v
                                                SalukiConfiguration
                                                { control, shared, domains }
                                                                    │
                      binary adapters: component values and Live<T> │
                                                                    v
                                                         runtime components

A generated witness trait creates a compile-time obligation to translate every supported Datadog key into SalukiConfiguration.

Architecture map ​

ResponsibilityCanonical location
Source-agnostic typed modellib/agent-data-plane-config/
Live<T>, a live view of a shared value, and the channel that publishes itlib/saluki-common/src/sync/live.rs
Adapters from the model to component inputsbin/agent-data-plane/src/component_inputs/
Loading, translation, authority, updates, compatibilitylib/agent-data-plane-config-system/
Datadog source model, witness, classifier, environment decodinglib/datadog-agent/config/
Hand-edited ADP support inventory for Datadog schema keyslib/datadog-agent/config/schema/schema_overlay.yaml
Vendored Datadog JSON schema, written in YAMLlib/datadog-agent/config/schema/core/
Overlay types, validation, SALUKI_KEYSlib/datadog-agent/config-overlay-model/
Documentation generationlib/datadog-agent/config-docs/
Raw map and loader: a general-purpose library, unused by ADPlib/saluki-config/
Hand-written Datadog witness implementationlib/agent-data-plane-config-system/src/translators/datadog_translator.rs
Saluki-only source model and seedlib/agent-data-plane-config-system/src/saluki_only.rs
Saluki-only defaultslib/agent-data-plane-config/src/defaults.rs
Runtime loading and authority selectionlib/agent-data-plane-config-system/src/loaded.rs
Translation gate and update looplib/agent-data-plane-config-system/src/system.rs
Datadog environment readerlib/datadog-agent/config/src/env_reader.rs
Saluki-only environment reader (by convention, with no table)lib/agent-data-plane-config-system/src/saluki_env_overlay.rs
Merged sources with per-value provenancelib/agent-data-plane-config-system/src/source.rs

Use ConfigValue<T> in SalukiConfiguration when a default must be detectable, as Provenance::Default versus Provenance::Explicit. See dd_url and site for examples.

Dependency boundaries ​

  • agent-data-plane-config is a pure data model that does not depend on any other workspace crates.
  • agent-data-plane-config-system bridges sources to the model and constructs no components.
  • saluki-components and bin/agent-data-plane/src/components/ never depend on agent-data-plane-config, not even in tests.
  • The rest of bin/agent-data-plane adapts the model into the inputs each component defines.

Component inputs ​

Components define their inputs: concrete values, component-owned types, or a Live<T> of a component-owned T. They MUST NOT name model types, in production code or tests.

The binary converts the model with free functions in bin/agent-data-plane/src/component_inputs/, because the orphan rule forbids From implementations between the two crates' types. An adapter copies fields and calls model methods that resolve provenance, such as Endpoints::primary_endpoint and Compression::effective_zstd_level, so components receive effective values and never see ConfigValue<T>. Adapters add no defaults, parsing, or validation. Test each adapter with a distinct value in every field, so that a swapped field fails the test.

Datadog versus Saluki keys ​

A key in the Datadog schema is a Datadog key; a key absent from the overlay is Saluki-only. Names are no help: data_plane.foo can belong to either class.

Datadog inventory and generated code ​

The vendored schema and overlay have different jobs:

  • schema/core/*.yaml defines Datadog keys. It MUST stay a pristine upstream copy, never edited by hand. Raise any proposed or existing hand edits with the change's author.
  • schema_overlay.yaml classifies every schema leaf for ADP. ADP defines its shape.

Code generated in-tree from the schema and overlay carries @generated and DO NOT EDIT warnings. Regenerate it with:

shell
make build-schema-overlay

Support classifications ​

Under inventory, support is full, partial, none, or unknown. excluded is a separate section:

  • full: ADP reads the key and matches the Agent's behavior.
  • partial: ADP reads the key, but differs in some cases. Describe those differences.
  • none: ADP doesn't support the key. Choose a severity based on the effect on users, and state whether support is planned. Link an issue when work should be tracked.
  • unknown: compatibility hasn't been established. Record what still needs investigation.
  • excluded: ADP silently ignores the key and omits it from compatibility documentation. Use this for features ADP doesn't currently support, not to hide gaps that need tracking.

An investigation toward intended support is planned: true. A documentation-only issue doesn't mean support is planned.

Date exclusion notes and name the feature: YYYY-MM-DD: ADP does not currently support <feature>. Avoid generic reasons such as "Core Agent-only" or claims that support can never be added.

Keys set to their default value ​

At startup, the compatibility check reports a classified key only when an input sets it explicitly to a value other than its schema default. A key set to its default gets the behavior ADP has when nobody sets it, so the check skips it. The check reports a value that the default comparison can't match, such as a duration in an unexpected form.

The check trusts the schema default, and assumes that the Agent reads the key's value. When you classify a key as none, check how the Agent reads it:

  • When the Agent's behavior depends on whether the key is set, for example through IsConfigured or IsSet, set presence_matters: true on the entry. The check then reports the key at its default value too. Keys without a schema default are always treated this way, because any value makes them present in the Agent's configuration.
  • When the key's effective default depends on the platform or is computed, check that its schema default matches the Agent's effective default. Otherwise, the check can skip a value that changes behavior.

Environment variables and key shape ​

The Datadog Agent doesn't derive a variable's name from its key path: DD_PROXY_HTTP reaches proxy.http, while DD_DOGSTATSD_PORT reaches the flat dogstatsd_port. No separator convention reproduces this. Datadog keys read the environment through the generated tables, and Saluki-only keys are derived through a serde workaround. The environment is read by apply_datadog_env_vars and by the Saluki-only reader.

A modeled key arrives in the Agent's canonical shape. A source model MUST read that shape: don't add a #[serde(rename)] or #[serde(alias)]. Unmodeled environment variables aren't read.

Deprecated key names ​

A schema setting can list former names under renamed_from, each with the Agent version that deprecated it. ADP reads former names as the Agent does:

  • Environment: for a setting without explicit env_vars, each former name's derived variable is read before the current one, oldest deprecation first. DD_STATSD_METRIC_BLOCKLIST therefore beats DD_METRIC_FILTERLIST, and is decoded as metric_filterlist.
  • datadog.yaml: a former name resolves like any other leaf, including its case and dotted spellings. Once the file is read, its value replaces the current name's and the former name is dropped, so the former name wins when both are written. A null former name clears the current one. datadog_yaml.rs documents the details.
  • Configuration stream: an Agent older than the rename streams the former name as a separate setting. overlay_agent_layer in system.rs resolves it as that Agent does. A test fails if a renamed setting has no rule there.

Precedence between sources applies across names: a current name in the environment beats a former name in the file. Former names never reach the sources that the compatibility check, /config, and the flare read. Once logging starts, ADP logs a warning for each former name the file or environment used. A no-env setting has no former names, because the Agent's codegen declares it with SetDefault.

Code generation emits the derived variables into DATADOG_ENV_KEYS and the former paths into datadog_renamed_keys. It fails the build if a former name overlaps a schema path or another former name, or if a modeled setting has both explicit env_vars and former names. env_var_names and former_names in the overlay model's schema_gen hold these rules.

A new rename needs config recorder cases: renamed_settings_have_recorder_cases in datadog-agent-config-corpus fails until renamed-key-* cases record the setting and its former names, by env and by YAML.

Scalar leaf coercion ​

DatadogConfiguration scalar leaves accept what the Agent's permissive casting accepts. Code generation attaches a cast_de.rs coercion to each schema type. For example, dogstatsd_port: "8125.0" is valid and coerced to the integer 8125, and 1 or "T" is coerced to a bool.

Documented enum settings ​

A string setting whose schema documentation names a closed set of values becomes an enum in agent-data-plane-config with #[default] and FromStr. Match the Agent's behavior: warn and fall back, or record a TranslateError. Serialize using the FromStr spelling.

Saluki-only values ​

Values absent from the Datadog schema reach SalukiConfiguration through the SalukiOnly source model. Its field hierarchy matches the source path exactly: don't add serde aliases.

A SalukiOnly field and a DatadogConfiguration field that map to the same destination is a bug. Keep the authoritative Datadog path and delete the duplicate Saluki-only path.

Defaults ​

Defaults belong in the configuration layer, and exactly one layer owns each default:

Source classModel typeDefault ownerTranslation behavior
Saluki-onlyOption<T>No defaultseed preserves None
Saluki-onlyTagent-data-plane-config/src/defaults.rsseed assigns the resolved value
WitnessedTGenerated Datadog schema defaultdrive always writes it
WitnessedOption<T>No defaultdrive preserves None

Define each Saluki-only default once in lib/agent-data-plane-config/src/defaults.rs. Source and model defaults must reference that definition, rather than restating its value. If the component requires a value, model it as T: use Option<T> only when absence is meaningful, not to defer a default.

Push source parsing, defaults, and input validation to the configuration boundary. Components keep only validation that is business logic.

Merged sources and the raw view ​

SourceTree is the merged configuration: every value an input supplied, each with the provenance of the input that supplied it. ConfigurationSystem retains the tree it translated from, which is what the startup compatibility gate, the privileged /config route, and the runtime_config_dump.yaml flare artifact read. Those readers need the keys that the typed model doesn't carry, so they read the sources rather than the model.

Runtime updates ​

Startup translation is strict. Live updates are translated against tentative state. On success, the update task replaces the retained sources and publishes the typed model before releasing the sources lock. Separate reads of the model and the sources can still observe different versions; they don't form a combined snapshot. On failure, the task keeps the last-known-good model and leaves the sources as they were.

ConfigurationSystem holds the read-only LiveSource of a live::channel, and the update task owns its only LivePublisher. Tests that need a changing value create their own channel and publish replacements through it.

Workflows ​

For changes to the configuration system, read docs/development/configuration-system.md and .agents/skills/config-system/SKILL.md as reference, and apply the "Review checklist" in that page.

Add or change a witnessed key ​

  1. Confirm its schema_overlay.yaml classification. If support becomes full or partial, provide the required metadata, and expect a new witness method after generation.
  2. Add or refine its destination in control, shared, or domains, based on who consumes it.
  3. Run make build-schema-overlay.
  4. Implement the generated consume_<key> in DatadogTranslator, and find the right home for it in SalukiConfiguration.

A support change needs only these steps. Do not record the corpus or add replay bookkeeping for it: the corpus decides which replay checks exist, and a newly supported key gets value comparisons once a later recording includes it. A replay check that fails after a support change means a recorded outcome changed: fix ADP, or edit the matching expectation deliberately. Removing support from a key the baseline case recorded fails coverage and may leave value-check expectations unused; handle that as deliberate corpus maintenance.

An inventory key marked none or unknown, or a key under excluded, is absent from the witnessed model.

Add or change a Saluki-only key ​

  1. Verify that the key is absent from schema_overlay.yaml.
  2. Add its destination to the correct SalukiConfiguration slice.
  3. If it has a default, define it once in agent-data-plane-config/src/defaults.rs, and reference it from the model and source defaults.
  4. Add the exact source hierarchy and a reliable parsing type to SalukiOnly. A nested key requires this: the Saluki-only environment reader discovers paths from SalukiOnly, so without a field, the key is unreachable from the environment.
  5. Add one seed assignment to the destination.
  6. Keep SALUKI_KEYS consistent with the source key and default.

Migrate a raw consumer ​

  1. List every key the consumer reads, including serde fields, flattened structs, aliases, direct accessors, watches, and stored raw maps.
  2. Record current parsing, validation, fallback, normalization, default, and update behavior before deleting source code.
  3. Classify each key by schema membership, and check for a duplicate between witnessed and Saluki-only paths.
  4. Search all consumers. Put a value in domains when one domain owns it, and in shared when multiple domains consume it. Components don't read control.
  5. Add any missing model, witness, or seed path with the workflows above.
  6. Delete from_configuration, and pick its replacement by the shape of the *Configuration struct:
    • Count every value the caller supplies, including runtime wiring the caller can't read out of configuration.
    • Fewer than four values: new(...) taking concrete values, with private fields. Existing with_* wiring methods stay.
    • Four or more values: make the fields pub and let the caller build the struct by field, with no constructor. Wiring becomes a pub field too: see aggregate_context_snapshot_channel and AggregateConfiguration::context_snapshot_receiver. Avoid introducing a new arguments or settings struct, and don't implement Default or Deserialize on the configuration struct.
    • With pub fields, compute derived values and run input handling in build() or a private accessor, once per build. Keep a with_* method only when it does more than set one field.
    • Keep a constructor, whatever the count, when it does more than assign fields: it builds private types, compiles or validates input, or decides which endpoints apply. Name it for what it builds.
    • Values that change at runtime: pass a Live<T> of a component-owned T, and rebuild the reactive state after changed(). Use project when the model value already has the right type, map when it must convert, and into_stream for a stream of changed values without an initial value. Values that must change together belong in one Live<T>: separate views advance independently.
  7. Remove source serde, Datadog key names, raw-map access, key watches, parsing, configuration defaults, and code made unused by the cutover. #[allow(dead_code)] isn't an acceptable way to keep migration residue.
  8. Update topology call sites and tests. Preserve behavior tests by using typed inputs, and remove tests only when they tested legacy deserialization and nothing else.
  9. Test higher-risk cutovers with correctness or integration tests that exercise the affected configurations.

A cutover should be behaviorally transparent. If the old behavior conflicts with the source schema or the typed system's invariants, surface the conflict rather than silently choosing one. Don't leave deserialization artifacts behind after a cutover: for example, drop derive(Deserialize), and collapse a held Option<SomeType> to a held SomeType where possible.

Update the vendored schema ​

Use the config-schema-update skill, which walks through comparing, vendoring, and classifying a new upstream schema.

Review checklist ​

For any configuration change, check the risks:

  • Reachability: every formerly configurable value still has a path from source to model to consumer.
  • Defaults: the effective default is unchanged, and is stated once in the configuration layer.
  • Input handling: parsing, coercion, normalization, and validation moved to the configuration layer.
  • Model boundary: components receive component-owned values, never model slices.
  • Dynamic behavior: startup and update paths construct the same reactive state from typed input.
  • Test preservation: deleting legacy deserialization coverage didn't delete behavioral coverage.
  • Replay coverage: a change to a deserializer, the environment reader, translation, or a key's support runs the replay tests, cargo nextest run --lib -p agent-data-plane-config-system corpus_replay. A failing check means a recorded outcome changed. Update production code, or the matching typed expectation in lib/agent-data-plane-config-system/src/corpus_replay/ deliberately, in the same change; never regenerate the corpus to make an agent-data-plane change pass.

Check your work ​

The Makefile is authoritative:

shell
make build-schema-overlay       # regenerate code
make fmt                        # use this, not cargo fmt
cargo check --workspace --tests # quick compilation check
make check-all                  # required to pass CI