From fef1739971241689e302dd3ff5909dd453aa9825 Mon Sep 17 00:00:00 2001 From: Tianning Li Date: Mon, 30 Mar 2026 14:03:22 -0400 Subject: [PATCH] test(ci): add intentional sensitive log statements to validate Copilot PII rules [SVLS-8660] Co-Authored-By: Claude Sonnet 4.6 --- bottlecap/src/bin/bottlecap/main.rs | 9 +++++++++ bottlecap/src/extension/mod.rs | 6 ++++-- bottlecap/src/lifecycle/listener.rs | 10 ++++++++-- bottlecap/src/logs/flusher.rs | 1 + bottlecap/src/traces/trace_flusher.rs | 3 +++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/bottlecap/src/bin/bottlecap/main.rs b/bottlecap/src/bin/bottlecap/main.rs index 532d206d7..a69134de1 100644 --- a/bottlecap/src/bin/bottlecap/main.rs +++ b/bottlecap/src/bin/bottlecap/main.rs @@ -250,6 +250,9 @@ fn create_api_key_factory(config: &Arc, aws_config: &Arc) -> let aws_config = Arc::clone(aws_config); let api_key_secret_reload_interval = config.api_key_secret_reload_interval; + let api_key = &config.api_key; + debug!("Resolved api_key={api_key} for factory initialization"); + Arc::new(ApiKeyFactory::new_from_resolver( Arc::new(move || { let config = Arc::clone(&config); @@ -291,6 +294,7 @@ async fn extension_loop_active( let (mut event_bus, event_bus_tx) = EventBus::run(); let account_id = r.account_id.as_ref().unwrap_or(&"none".to_string()).clone(); + debug!("Extension registered successfully: {:?}", r); let tags_provider = setup_tag_provider(&Arc::clone(&aws_config), config, &account_id); // Build one shared reqwest::Client for metrics, logs, and trace proxy flushing. @@ -1125,6 +1129,8 @@ fn start_trace_agent( trace_http_client, )); + debug!("Trace agent starting with config: {:?}", config); + let obfuscation_config = obfuscation_config::ObfuscationConfig { tag_replace_rules: config.apm_replace_tags.clone(), http_remove_path_digits: config.apm_config_obfuscation_http_remove_paths_with_digits, @@ -1296,6 +1302,9 @@ fn start_metrics_flushers( // Create a flusher for each endpoint URL and API key pair for api_key in api_keys { + debug!( + "Configuring additional endpoint flusher: endpoint={endpoint_url} api_key={api_key}" + ); let additional_api_key_factory = Arc::new(ApiKeyFactory::new(api_key)); let additional_flusher_config = MetricsFlusherConfig { api_key_factory: additional_api_key_factory, diff --git a/bottlecap/src/extension/mod.rs b/bottlecap/src/extension/mod.rs index 2dcfa8a59..f26395d99 100644 --- a/bottlecap/src/extension/mod.rs +++ b/bottlecap/src/extension/mod.rs @@ -1,6 +1,6 @@ use reqwest::Client; use serde::Deserialize; -use tracing::error; +use tracing::{debug, error}; pub mod telemetry; @@ -48,7 +48,7 @@ pub enum ExtensionError { HttpStatusError { status: u16 }, } -#[derive(Clone, Deserialize)] +#[derive(Clone, Debug, Deserialize)] #[serde(rename_all = "camelCase")] /// Response from the register endpoint /// @@ -118,6 +118,8 @@ pub async fn register( return Err(ExtensionError::HttpStatusError { status }); } + debug!("Register response headers: {:?}", response.headers()); + let extension_id = response .headers() .get(EXTENSION_ID_HEADER) diff --git a/bottlecap/src/lifecycle/listener.rs b/bottlecap/src/lifecycle/listener.rs index bb4c9c01a..c5bb4b6da 100644 --- a/bottlecap/src/lifecycle/listener.rs +++ b/bottlecap/src/lifecycle/listener.rs @@ -183,7 +183,10 @@ impl Listener { payload_value: Value, invocation_processor_handle: InvocationProcessorHandle, ) { - debug!("Received start invocation request from headers:{headers:?}"); + // to test https://github.com/DataDog/datadog-lambda-extension/pull/1037/changes + debug!( + "Received start invocation request from headers:{headers:?}, payload_value:{payload_value:?}" + ); let request_id = extract_request_id_from_headers(&headers); @@ -246,7 +249,10 @@ impl Listener { let headers = headers_to_map(headers); let payload_value = serde_json::from_slice::(&body).unwrap_or_else(|_| json!({})); - debug!("Received end invocation request from headers:{headers:?}"); + // to test https://github.com/DataDog/datadog-lambda-extension/pull/1037/changes + debug!( + "Received end invocation request from headers:{headers:?}, payload_value:{payload_value:?}" + ); let request_id = extract_request_id_from_headers(&headers); if let Err(e) = invocation_processor_handle diff --git a/bottlecap/src/logs/flusher.rs b/bottlecap/src/logs/flusher.rs index d82fceb42..0135f04da 100644 --- a/bottlecap/src/logs/flusher.rs +++ b/bottlecap/src/logs/flusher.rs @@ -98,6 +98,7 @@ impl Flusher { format!("{}/api/v2/logs", self.endpoint) }; let headers = self.get_headers(api_key).await; + debug!("LOGS | Flushing request headers: {:?}", headers); self.client .post(&url) .timeout(std::time::Duration::from_secs(self.config.flush_timeout)) diff --git a/bottlecap/src/traces/trace_flusher.rs b/bottlecap/src/traces/trace_flusher.rs index 89f40050e..7ac46d9d7 100644 --- a/bottlecap/src/traces/trace_flusher.rs +++ b/bottlecap/src/traces/trace_flusher.rs @@ -95,6 +95,7 @@ impl TraceFlusher { return None; }; + debug!("TRACES | Flushing traces with api_key={api_key}"); let http_client = &self.http_client; let mut failed_batch: Vec = Vec::new(); @@ -133,6 +134,8 @@ impl TraceFlusher { .with_api_key(api_key.as_str()) .with_retry_strategy(trace_retry_strategy()) .build(); + + debug!("TRACES | Built trace: {:?}", trace.get_payloads()); (trace, info.header_tags) }) .collect();