Skip to content
Open
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 lading/src/generator/file_gen/logrotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ impl Child {
&self.labels).await?;
}
Err(err) => {
error!("Throttle request of {} is larger than throttle capacity. Block will be discarded. Error: {}", total_bytes, err);
error!("Discarding block due to throttle error: {err}");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/file_gen/traditional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ impl Child {
}
}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}");
error!("Discarding block due to throttle error: {err}");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl Http {

}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}");
error!("Discarding block due to throttle error: {err}");
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/splunk_hec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl SplunkHec {
tokio::spawn(send_hec_request(permit, block_length, labels, channel, client, request, request_shutdown.clone(), uri_clone));
}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}");
error!("Discarding block due to throttle error: {err}");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl TcpWorker {
}
}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}");
error!("Discarding block due to throttle error: {err}");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/trace_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl TraceAgent {
});
}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}", total_bytes = total_bytes);
error!("Discarding block due to throttle error: {err}");
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl UdpWorker {
}
}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}");
error!("Discarding block due to throttle error: {err}");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/unix_datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ impl Child {
}
}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}");
error!("Discarding block due to throttle error: {err}");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lading/src/generator/unix_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ impl Child {
}
}
Err(err) => {
error!("Throttle request of {total_bytes} is larger than throttle capacity. Block will be discarded. Error: {err}");
error!("Discarding block due to throttle error: {err}");
}
}
}
Expand Down
14 changes: 11 additions & 3 deletions lading_throttle/src/linear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ use super::{Clock, RealClock};
#[derive(thiserror::Error, Debug, Clone, Copy)]
pub enum Error {
/// Requested capacity is greater than maximum allowed capacity.
#[error("Capacity")]
Capacity,
#[error("capacity request {requested} exceeds maximum {maximum}")]
Capacity {
/// The requested capacity that exceeded the maximum.
requested: u32,
/// The maximum capacity permitted by the throttle.
maximum: u32,
},
}

#[derive(Debug)]
Expand Down Expand Up @@ -133,7 +138,10 @@ impl Valve {
// ticker if the caller makes a zero request. It's strange but it's a
// valid thing to do.
if capacity_request > self.maximum_capacity {
return Err(Error::Capacity);
return Err(Error::Capacity {
requested: capacity_request,
maximum: self.maximum_capacity,
});
}

let current_interval = ticks_elapsed / INTERVAL_TICKS;
Expand Down
19 changes: 15 additions & 4 deletions lading_throttle/src/stable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ use super::{Clock, INTERVAL_TICKS, RealClock};
#[derive(thiserror::Error, Debug, Clone, Copy, PartialEq)]
pub enum Error {
/// Requested capacity is greater than maximum allowed capacity.
#[error("Capacity")]
Capacity,
#[error("capacity request {requested} exceeds throttle's maximum {maximum}")]
Capacity {
/// The requested capacity that exceeded the maximum.
requested: u32,
/// The maximum capacity permitted by the throttle.
maximum: u32,
},
}

#[derive(Debug)]
Expand Down Expand Up @@ -144,7 +149,10 @@ impl Valve {
// ticker if the caller makes a zero request. It's strange but it's a
// valid thing to do.
if capacity_request > self.maximum_capacity {
return Err(Error::Capacity);
return Err(Error::Capacity {
requested: capacity_request,
maximum: self.maximum_capacity,
});
}

let current_interval = tick_to_interval(ticks_elapsed);
Expand Down Expand Up @@ -353,7 +361,10 @@ mod verification {
capacity_request: u32,
) -> Result<u64, super::Error> {
if capacity_request > self.maximum_capacity {
return Err(super::Error::Capacity);
return Err(super::Error::Capacity {
requested: capacity_request,
maximum: self.maximum_capacity,
});
}

let current_interval = tick_to_interval(ticks_elapsed);
Expand Down
Loading