Skip to content

Commit 1d0f918

Browse files
authored
chore(antithesis): Generate configs for scenario purposes (#1938)
## Summary <!-- Please provide a brief summary about what this PR does. This should help the reviewers give feedback faster and with higher quality. --> 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. This PR adapts the config generator to produce intersection datadog.yaml instances. ## Change Type - [ ] Bug fix - [ ] New feature - [x] Non-functional (chore, refactoring, docs) - [ ] Performance ## How did you test this PR? <!-- Please how you tested these changes here --> ## References <!-- Please list any issues closed by this PR. --> <!-- - Closes: <issue link> --> <!-- Any other issues or PRs relevant to this PR? Feel free to list them here. -->
1 parent 54d3177 commit 1d0f918

3 files changed

Lines changed: 433 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)