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
12 changes: 6 additions & 6 deletions crates/dogstatsd/src/aggregator_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ impl AggregatorHandle {
let (response_tx, response_rx) = oneshot::channel();
self.tx
.send(AggregatorCommand::Flush(response_tx))
.map_err(|e| format!("Failed to send flush command: {}", e))?;
.map_err(|e| format!("Failed to send flush command: {e}"))?;

response_rx
.await
.map_err(|e| format!("Failed to receive flush response: {}", e))
.map_err(|e| format!("Failed to receive flush response: {e}"))
}

pub async fn get_entry_by_id(
Expand All @@ -66,11 +66,11 @@ impl AggregatorHandle {
timestamp,
response_tx,
})
.map_err(|e| format!("Failed to send get_entry_by_id command: {}", e))?;
.map_err(|e| format!("Failed to send get_entry_by_id command: {e}"))?;

response_rx
.await
.map_err(|e| format!("Failed to receive get_entry_by_id response: {}", e))
.map_err(|e| format!("Failed to receive get_entry_by_id response: {e}"))
}

pub fn shutdown(&self) -> Result<(), mpsc::error::SendError<AggregatorCommand>> {
Expand Down Expand Up @@ -125,7 +125,7 @@ impl AggregatorService {
distributions,
};

if let Err(_) = response_tx.send(response) {
if response_tx.send(response).is_err() {
error!("Failed to send flush response - receiver dropped");
}
}
Expand All @@ -138,7 +138,7 @@ impl AggregatorService {
} => {
let entry = self.aggregator.get_entry_by_id(name, &tags, timestamp);
let response = entry.cloned();
if let Err(_) = response_tx.send(response) {
if response_tx.send(response).is_err() {
error!("Failed to send get_entry_by_id response - receiver dropped");
}
}
Expand Down
3 changes: 1 addition & 2 deletions crates/dogstatsd/src/datadog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ impl DdApi {
// handle if status code missing like timeout
return Err(ShippingError::Destination(
status,
format!("Failed to send request after {} attempts", max_attempts)
.to_string(),
format!("Failed to send request after {attempts} attempts").to_string(),
));
}
RetryStrategy::LinearBackoff(_, delay) => {
Expand Down
4 changes: 2 additions & 2 deletions crates/dogstatsd/src/flusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Flusher {
self.https_proxy.clone(),
self.timeout,
self.retry_strategy.clone(),
self.compression_level.clone(),
self.compression_level,
)),
None => {
error!("Failed to create dd_api: failed to get API key");
Expand Down Expand Up @@ -212,7 +212,7 @@ async fn should_try_next_batch(resp: Result<Response, ShippingError>) -> (bool,
Err(ShippingError::Destination(sc, msg)) => {
// Check if status code indicates a permanent error
let is_permanent_error =
sc.map_or(false, |code| code.as_u16() >= 400 && code.as_u16() < 500);
sc.is_some_and(|code| code.as_u16() >= 400 && code.as_u16() < 500);

error!("Error shipping data: {:?} {}", sc, msg);

Expand Down
Loading