Skip to content

Commit 1cdcc3f

Browse files
committed
Merge remote-tracking branch 'origin/main' into ci/update-agent-version-7.80.2
# Conflicts: # .datadog-agent-version # .gitlab-ci.yml # docker/Dockerfile.datadog-agent
2 parents d5599ea + 2a95db2 commit 1cdcc3f

139 files changed

Lines changed: 1802 additions & 8140 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/slapr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
run_slapr:
11-
if: github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.repo.full_name == github.repository
11+
if: github.event.pull_request.head.repo.full_name == github.repository
1212
runs-on: ubuntu-latest
1313
permissions:
1414
id-token: write

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test/build/
66
test/ddprof
77
test/lading
88
test/one-off/__pycache__
9+
test/antithesis/scratchbook/
910
dhat-heap.json
1011
.DS_Store
1112
dist/

.vale/styles/config/vocabularies/technical/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ launchd
235235
Wireshark
236236
testsupport
237237
callee
238+
Bazel
238239
trivy
239240
Erlang
240241
OTP

Cargo.lock

Lines changed: 19 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ endif
3838
export ADP_STANDALONE_IPC_CERT_FILE := /tmp/adp-ipc-cert.pem
3939

4040
# macOS integration-test settings.
41-
MACOS_TEST_AGENT_VERSION ?= 7.78.0
41+
MACOS_TEST_AGENT_VERSION ?= 7.80.1
4242
MACOS_TEST_AGENT_DMG_DIR ?= /tmp/saluki-dda-dmg-cache
4343
MACOS_TEST_AGENT_DMG_URL ?= https://s3.amazonaws.com/dd-agent/datadog-agent-$(MACOS_TEST_AGENT_VERSION)-1.$(shell uname -m).dmg
4444
MACOS_TEST_AGENT_INSTALL_DIR ?= /tmp/saluki-dda/datadog-agent
@@ -75,7 +75,7 @@ export WINDOWS_CROSS_LLVM_BIN ?= /opt/homebrew/opt/llvm/bin
7575
export WINDOWS_CROSS_CARGO_ARGS ?= --package agent-data-plane
7676

7777
# Version of source repositories (Git tag) for vendored Protocol Buffers definitions.
78-
export PROTOBUF_SRC_REPO_DD_AGENT ?= 7.73.x
78+
export PROTOBUF_SRC_REPO_DD_AGENT ?= 7.80.x
7979
export PROTOBUF_SRC_REPO_AGENT_PAYLOAD ?= v5.0.164
8080
export PROTOBUF_SRC_REPO_CONTAINERD ?= v2.2.0
8181
export PROTOBUF_SRC_REPO_SKETCHES_GO ?= v1.4.7

bin/agent-data-plane/src/components/host_tags/mod.rs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,28 @@ impl HostTagsConfiguration {
4343
#[async_trait]
4444
impl SynchronousTransformBuilder for HostTagsConfiguration {
4545
async fn build(&self, _context: ComponentContext) -> Result<Box<dyn SynchronousTransform + Send>, GenericError> {
46-
// Make an initial request of the host tags from the Datadog Agent.
47-
//
48-
// We only pay attention to the "system" tags, as the "google_cloud_platform" tags are not relevant here.
49-
let host_tags_reply = self.client.get_host_tags().await?.into_inner();
50-
let host_tags = host_tags_reply
51-
.system
52-
.into_iter()
53-
.map(|s| Arc::from(s.as_str()))
54-
.map(MetaString::from)
55-
.map(Tag::from)
56-
.collect::<SharedTagSet>();
46+
// Only fetch host tags when enrichment is enabled (`expected_tags_duration > 0`), matching the Core
47+
// Agent; at the default of 0 the tags are discarded immediately. Fetching always would block `build()`
48+
// on the Core Agent's slow `GetHostTags` RPC, delaying DogStatsD draining and starving origin detection.
49+
let host_tags = if self.expected_tags_duration > Duration::ZERO {
50+
// We only pay attention to the "system" tags, as the "google_cloud_platform" tags are not relevant here.
51+
let host_tags_reply = self.client.get_host_tags().await?.into_inner();
52+
let host_tags = host_tags_reply
53+
.system
54+
.into_iter()
55+
.map(|s| Arc::from(s.as_str()))
56+
.map(MetaString::from)
57+
.map(Tag::from)
58+
.collect::<SharedTagSet>();
59+
Some(host_tags)
60+
} else {
61+
None
62+
};
5763

5864
Ok(Box::new(HostTagsEnrichment {
5965
start: Instant::now(),
6066
expected_tags_duration: self.expected_tags_duration,
61-
host_tags: Some(host_tags),
67+
host_tags,
6268
}))
6369
}
6470
}

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

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
#![deny(warnings)]
77
#![deny(missing_docs)]
8+
use std::path::Path;
89
use std::time::Instant;
910

1011
// Pull in the Antithesis coverage-instrumentation runtime shim only when
@@ -45,10 +46,8 @@ static ALLOC: resource_accounting::TrackingAllocator<std::alloc::System> =
4546
async fn main() -> Result<(), GenericError> {
4647
let started = Instant::now();
4748

48-
// Initialize the Antithesis SDK as early as possible so assertions and lifecycle hooks register
49-
// their catalog before any are evaluated. No-op outside Antithesis and absent in production builds.
5049
#[cfg(feature = "antithesis")]
51-
antithesis_sdk::antithesis_init();
50+
initialize_antithesis();
5251

5352
let cli: Cli = argh::from_env();
5453

@@ -61,14 +60,7 @@ async fn main() -> Result<(), GenericError> {
6160
// Load our "bootstrap" configuration -- static configuration on disk or from environment variables -- so we can
6261
// initialize basic subsystems before executing the given subcommand.
6362
let bootstrap_config_path = cli.config_file.unwrap_or_else(PlatformSettings::get_config_file_path);
64-
let bootstrap_config = ConfigurationLoader::default()
65-
.with_key_aliases(KEY_ALIASES)
66-
.from_yaml(&bootstrap_config_path)
67-
.error_context("Failed to load Datadog Agent configuration file during bootstrap.")?
68-
.add_providers([DatadogRemapper::new()])
69-
.from_environment(PlatformSettings::get_env_var_prefix())
70-
.error_context("Environment variable prefix should not be empty.")?
71-
.bootstrap_generic();
63+
let bootstrap_config = load_bootstrap_config(&bootstrap_config_path)?.bootstrap_generic();
7264

7365
// Translate the bootstrap configuration into ADP's logging configuration, applying ADP-specific rules
7466
// (per-subagent log file key, never sharing a file with the Core Agent).
@@ -122,6 +114,52 @@ async fn main() -> Result<(), GenericError> {
122114
Ok(())
123115
}
124116

117+
/// Initializes the Antithesis SDK and installs a panic-reporting hook. Set
118+
/// ideally before any panics are possible.
119+
#[cfg(feature = "antithesis")]
120+
fn initialize_antithesis() {
121+
antithesis_sdk::antithesis_init();
122+
123+
let default_hook = std::panic::take_hook();
124+
std::panic::set_hook(Box::new(move |info| {
125+
let location = info.location().map_or_else(String::new, |l| l.to_string());
126+
let payload = info.payload();
127+
let message = payload
128+
.downcast_ref::<&str>()
129+
.map(|s| (*s).to_string())
130+
.or_else(|| payload.downcast_ref::<String>().cloned())
131+
.unwrap_or_else(|| "<non-string panic payload>".to_string());
132+
antithesis_sdk::assert_unreachable!(
133+
"agent-data-plane panicked",
134+
&serde_json::json!({ "message": message, "location": location })
135+
);
136+
default_hook(info);
137+
}));
138+
}
139+
140+
/// Loads bootstrap configuration from the on-disk file and environment
141+
/// variables.
142+
fn load_bootstrap_config(bootstrap_config_path: &Path) -> Result<ConfigurationLoader, GenericError> {
143+
let loaded = ConfigurationLoader::default()
144+
.with_key_aliases(KEY_ALIASES)
145+
.from_yaml(bootstrap_config_path)
146+
.error_context("Failed to load Datadog Agent configuration file during bootstrap.")
147+
.and_then(|loader| {
148+
loader
149+
.add_providers([DatadogRemapper::new()])
150+
.from_environment(PlatformSettings::get_env_var_prefix())
151+
.error_context("Environment variable prefix should not be empty.")
152+
});
153+
// A graceful config rejection exits 1 rather than crashing; classify that against a clean boot.
154+
#[cfg(feature = "antithesis")]
155+
antithesis_sdk::assert_always_or_unreachable!(
156+
loaded.is_ok(),
157+
"agent-data-plane boots under sampled config",
158+
&serde_json::json!({ "phase": "config_load", "error": loaded.as_ref().err().map(|e| format!("{e:?}")) })
159+
);
160+
loaded
161+
}
162+
125163
fn parse_metrics_level(config: &GenericConfiguration) -> Result<Level, GenericError> {
126164
let raw = config
127165
.try_get_typed::<String>("metrics_level")
@@ -157,6 +195,13 @@ async fn run_inner(
157195
}
158196
Err(e) => {
159197
error!("{:?}", e);
198+
// Same boot property as the config-load gate, distinguished by `phase` in the details.
199+
#[cfg(feature = "antithesis")]
200+
antithesis_sdk::assert_always_or_unreachable!(
201+
false,
202+
"agent-data-plane boots under sampled config",
203+
&serde_json::json!({ "phase": "run_setup", "error": format!("{e:?}") })
204+
);
160205
Some(1)
161206
}
162207
};

0 commit comments

Comments
 (0)