Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/datadog-serverless-compat/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub async fn main() {
.with_thread_ids(false)
.with_line_number(false)
.with_file(false)
.with_target(false)
.with_target(true)
.without_time()
.finish();

Expand Down
4 changes: 2 additions & 2 deletions crates/datadog-trace-agent/src/mini_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl MiniAgent {
request: hyper_migration::HttpRequest,
proxy_tx: Sender<ProxyRequest>,
) -> http::Result<hyper_migration::HttpResponse> {
debug!("Trace Agent | Received profiling request");
debug!("Received profiling request");

// Extract headers and body
let (parts, body) = request.into_parts();
Expand Down Expand Up @@ -269,7 +269,7 @@ impl MiniAgent {
};

debug!(
"Trace Agent | Sending profiling request to channel, target: {}",
"Sending profiling request to channel, target: {}",
proxy_request.target_url
);

Expand Down
28 changes: 11 additions & 17 deletions crates/datadog-trace-agent/src/proxy_flusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct ProxyFlusher {
impl ProxyFlusher {
pub fn new(config: Arc<Config>) -> Self {
debug!(
"Proxy Flusher | Creating new proxy flusher with target URL: {}",
"Creating new proxy flusher with target URL: {}",
config.profiling_intake.url
);
let client = build_client(
Expand All @@ -58,15 +58,15 @@ impl ProxyFlusher {
/// Starts the proxy flusher that listens for proxy payloads from the channel and forwards them to Datadog
pub async fn start_proxy_flusher(&self, mut rx: Receiver<ProxyRequest>) {
let Some(api_key) = self.config.profiling_intake.api_key.as_ref() else {
error!("Proxy Flusher | No API key configured, cannot start");
error!("No API key configured, cannot start");
return;
};

debug!("Proxy Flusher | Started, listening for requests");
debug!("Started, listening for requests");

while let Some(proxy_payload) = rx.recv().await {
debug!(
"Proxy Flusher | Received request from channel, body size: {} bytes",
"Received request from channel, body size: {} bytes",
proxy_payload.body.len()
);
self.send_request(proxy_payload, api_key).await;
Expand Down Expand Up @@ -132,15 +132,12 @@ impl ProxyFlusher {
let request_builder = match self.create_request(&request, api_key).await {
Ok(builder) => builder,
Err(e) => {
error!("Proxy Flusher | {}", e);
error!("{}", e);
return;
}
};

debug!(
"Proxy Flusher | Sending request (attempt {}/{})",
attempts, max_retries
);
debug!("Sending request (attempt {}/{})", attempts, max_retries);

let time = std::time::Instant::now();
let response = request_builder.send().await;
Expand All @@ -153,31 +150,28 @@ impl ProxyFlusher {
let body = r.text().await;
if status == 202 {
debug!(
"Proxy Flusher | Successfully sent request in {} ms to {url}",
"Successfully sent request in {} ms to {url}",
elapsed.as_millis()
);
} else {
error!("Proxy Flusher | Request failed with status {status}: {body:?}");
error!("Request failed with status {status}: {body:?}");
}
return;
}
Err(e) => {
// Only retry on network errors
error!(
"Proxy Flusher | Network error (attempt {}): {:?}",
attempts, e
);
error!("Network error (attempt {}): {:?}", attempts, e);
if attempts >= max_retries {
error!(
"Proxy Flusher | Failed to send request after {} attempts: {:?}",
"Failed to send request after {} attempts: {:?}",
attempts, e
);
return;
}
// Exponential backoff before retry
let backoff_ms =
self.config.proxy_request_retry_backoff_base_ms * (2_u64.pow(attempts - 1));
debug!("Proxy Flusher | Retrying after {}ms backoff", backoff_ms);
debug!("Retrying after {}ms backoff", backoff_ms);
tokio::time::sleep(Duration::from_millis(backoff_ms)).await;
}
}
Expand Down
Loading