Skip to main content

Crate datadog_agent_config_corpus

Crate datadog_agent_config_corpus 

Source
Expand description

Reads recorded Datadog Agent configuration for tests of Agent Data Plane (ADP) compatibility.

The Agent and ADP read configuration in Go and Rust respectively. Their conversions can differ: a value sent to ADP as a string may be read by the Agent as a map. These tests need examples from the Agent’s own code, not assumed values or copies of its conversion logic.

The config recorder, a Go program in lib/datadog-agent/config-recorder/, runs that code with specified inputs. For each test case, it records the values and sources sent over the Agent’s config stream, plus results from methods such as GetInt and GetStringMap. These methods are called getters. Their results show what Agent components read from configuration. The saved collection of cases is the corpus, checked in as config-recorder/corpus.jsonl.

This crate lets Rust tests use those recordings without running Go or Docker. read validates the file and returns a Corpus with typed inputs, stream settings, and getter results. It fills in omitted fields according to the format rules and reports invalid records as Violations. It does not run ADP or compare ADP’s behavior with the Agent’s.

The format is defined in config-recorder/docs/record.md, with input values in case.md and getter selection and result encoding in getter-map.md. The reader follows these documents independently of the Go writer, so a writer bug is not copied into both implementations. Unit tests also check that the saved recordings match the current schema and recorder inputs.

Structs§

Case
One case: its case line and its key lines (record.md §3, §5).
CliOverride
A startup CLI override (case.md §4.5).
Corpus
A whole corpus (record.md §1).
Event
A stream event (record.md §5.2).
GetterRead
One getter call’s result (record.md §5.3; getter-map.md §3).
Header
The header line (record.md §2). The reader accepts only format 1, so it is not kept.
Inputs
The case’s inputs as the case file gave them (record.md §3.1).
KeyLine
A key line (record.md §5).
KeySpec
An entry of inputs.keys (case.md §6).
Number
A number and the exact token the corpus wrote for it.
Read
The getter reads at one checkpoint (record.md §5.3).
Reads
A key line’s reads (record.md §5.3).
Setting
One streamed pb.ConfigSetting, without its key (record.md §5.1).
SideEffect
An element of side_effects (record.md §3.2).
Started
What a case that started recorded.
Update
A runtime update (case.md §5).
UpdateResult
The recorded outcome of one update (record.md §4.2).
Violation
A broken format rule.
Warning
A recorded warning (record.md §7).

Enums§

Getter
An Agent getter a read may call (getter-map.md §2).
GetterResult
The recorded return value of an Agent configuration method, decoded into the matching Rust type.
GoFloat
A Go float64: a float token, or one of the non-finite forms {"$float":...}.
GoValue
A generic Go value, as Get and GetStringMap return it.
Group
A case’s coverage group (case.md §3).
Level
A recorded warning’s slog level (record.md §7).
Outcome
How a case’s construction ended (record.md §3.3, §4.1).
Rule
Which family of format rules a violation breaks.
Source
A model.Source string (pkg/config/model/types.go:41-71 at the pin).
UpdateOp
A runtime update’s operation.

Constants§

BASELINE_CASE
The name of the baseline case, whose key lines are layer 1 of every first snapshot (record.md §3.2).
REVIEWED_AT_AGENT_COMMIT
The Agent commit these lists were last checked against.

Functions§

read
Reads a whole corpus (record.md), filling in every member a writer may omit.