Skip to content

Commit 5bcf318

Browse files
authored
chore(agent-data-plane): include bootstrap base configuration when using configstream from Core Agent (#1020)
1 parent cdfb92e commit 5bcf318

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

bin/agent-data-plane/src/cli/run.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::time::{Duration, Instant};
1+
use std::{
2+
path::PathBuf,
3+
time::{Duration, Instant},
4+
};
25

36
use memory_accounting::{ComponentBounds, ComponentRegistry};
47
use saluki_app::{
@@ -32,7 +35,9 @@ use tracing::{error, info, warn};
3235
use crate::env_provider::ADPEnvironmentProvider;
3336
use crate::internal::{spawn_control_plane, spawn_internal_observability_topology};
3437

35-
pub async fn run(started: Instant, bootstrap_config: GenericConfiguration) -> Result<(), GenericError> {
38+
pub async fn run(
39+
started: Instant, bootstrap_config_path: PathBuf, bootstrap_config: GenericConfiguration,
40+
) -> Result<(), GenericError> {
3641
let app_details = saluki_metadata::get_app_details();
3742
info!(
3843
version = app_details.version().raw(),
@@ -58,6 +63,8 @@ pub async fn run(started: Instant, bootstrap_config: GenericConfiguration) -> Re
5863
// configuration source, but with environment variables on top of that to allow for ADP-specific overriding: log
5964
// level, etc.
6065
let dynamic_config = ConfigurationLoader::default()
66+
.from_yaml(&bootstrap_config_path)
67+
.error_context("Failed to load Datadog Agent configuration file.")?
6168
.with_dynamic_configuration(config_updates_receiver)
6269
.from_environment(crate::internal::platform::DATADOG_AGENT_ENV_VAR_PREFIX)?
6370
.with_default_secrets_resolution()

bin/agent-data-plane/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ async fn main() -> Result<(), GenericError> {
4444

4545
// Load our "bootstrap" configuration -- static configuration on disk or from environment variables -- so we can
4646
// initialize basic subsystems before executing the given subcommand.
47+
let bootstrap_config_path = cli
48+
.config_file
49+
.unwrap_or_else(|| self::internal::platform::DATADOG_AGENT_CONF_YAML.into());
4750
let bootstrap_config = ConfigurationLoader::default()
48-
.from_yaml(
49-
cli.config_file
50-
.unwrap_or_else(|| self::internal::platform::DATADOG_AGENT_CONF_YAML.into()),
51-
)
51+
.from_yaml(&bootstrap_config_path)
5252
.error_context("Failed to load Datadog Agent configuration file.")?
5353
.from_environment(self::internal::platform::DATADOG_AGENT_ENV_VAR_PREFIX)
5454
.error_context("Environment variable prefix should not be empty.")?
@@ -81,7 +81,7 @@ async fn main() -> Result<(), GenericError> {
8181
}
8282
}
8383

84-
let exit_code = match run(started, bootstrap_config).await {
84+
let exit_code = match run(started, bootstrap_config_path, bootstrap_config).await {
8585
Ok(()) => {
8686
info!("Agent Data Plane stopped.");
8787
0

0 commit comments

Comments
 (0)