Skip to content

Commit 51d3177

Browse files
committed
chore(antithesis): Generate configs for scenario purposes
ADP and Datadog Agent support an intersection of datadog.yaml config options but ADP has distinct configuration from Datadog Agent and vice versa. Some of that is temporary, some is a permanent state.
1 parent df6e5a1 commit 51d3177

3 files changed

Lines changed: 424 additions & 4 deletions

File tree

test/antithesis/harness/src/bin/first_sample_config/main.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
//! Antithesis `first_` command: sample this timeline's `datadog.yaml` and release ADP.
22
//!
33
//! Runs once per execution path after `setup_complete`, so the sample (see
4-
//! [`config`], Antithesis SDK randomness) is a post-snapshot, per-timeline
4+
//! [`harness::config`], Antithesis SDK randomness) is a post-snapshot, per-timeline
55
//! decision Antithesis branches. Writes the config to the shared `agent-config`
66
//! volume then a `ready` sentinel the blocked ADP entrypoint waits on; running
77
//! upstream of ADP's boot is what makes each timeline boot under its own config.
88
//! Deployment fields come from the environment (see [`Cli`]).
99
10-
mod config;
11-
1210
use std::fs;
1311
use std::path::PathBuf;
1412

1513
use antithesis_sdk::prelude::*;
1614
use antithesis_sdk::random::AntithesisRng;
1715
use anyhow::Context as _;
1816
use clap::Parser;
19-
use config::DatadogConfig;
17+
use harness::config::{ConfigProfile, DatadogConfig};
2018
use rand::rand_core::UnwrapErr;
2119
use serde_json::json;
2220

@@ -28,6 +26,11 @@ struct Cli {
2826
/// `agent-config` volume; the ADP container reads it).
2927
#[arg(long, env = "CONFIG_DIR", default_value = "/agent-config")]
3028
config_dir: PathBuf,
29+
/// Which `datadog.yaml` variation to sample. The differential scenario sets
30+
/// `CONFIG_PROFILE=differential` so both targets share a config they can both
31+
/// honor; ADP-only scenarios keep the default full feral surface.
32+
#[arg(long, env = "CONFIG_PROFILE", value_enum, default_value_t = ConfigProfile::General)]
33+
profile: ConfigProfile,
3134
/// Agent hostname written into the config. (`DD_HOSTNAME`, not the ambient
3235
/// `HOSTNAME`, so a container's own hostname does not leak in.)
3336
#[arg(long, env = "DD_HOSTNAME", default_value = "antithesis-adp")]
@@ -57,6 +60,7 @@ fn main() -> anyhow::Result<()> {
5760
&cli.api_key,
5861
&cli.dd_url,
5962
&cli.dogstatsd_socket,
63+
cli.profile,
6064
);
6165

6266
let yaml_path = cli.config_dir.join("datadog.yaml");

0 commit comments

Comments
 (0)