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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2667,9 +2667,9 @@ dependencies = [

[[package]]
name = "linkerd2-proxy-api"
version = "0.18.0"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba9e3b341ca4992feaf43a4d2bdbfe2081aa3e2b9a503753544ce55242af6342"
checksum = "de4e1c9b974df0a6c27e436310aecdbe6686ee911100deb44ac6343e206a9f0c"
dependencies = [
"h2",
"http",
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ default-features = false
features = ["tokio", "tracing"]

[workspace.dependencies.linkerd2-proxy-api]
version = "0.18.0"
version = "0.20.0"

[workspace.dependencies.rand]
version = "0.9"
Expand Down
3 changes: 3 additions & 0 deletions linkerd/exp-backoff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use thiserror::Error;
use tokio::time;

/// A jittered exponential backoff strategy.
//
// TODO(kate): add respect_retry_after_hint field here.
#[derive(Copy, Clone, Debug, Default)]
pub struct ExponentialBackoff {
/// The minimum amount of time to wait before resuming an operation.
Expand Down Expand Up @@ -52,6 +54,7 @@ impl ExponentialBackoff {
min: time::Duration,
max: time::Duration,
jitter: f64,
// TODO(kate): add respect_retry_after_hint parameter here.
) -> Result<Self, InvalidBackoff> {
if min > max {
return Err(InvalidBackoff("maximum must not be less than minimum"));
Expand Down
14 changes: 14 additions & 0 deletions linkerd/proxy/client-policy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ pub enum BackendDispatcher {
Forward(SocketAddr, Arc<EndpointMetadata>),
BalanceP2c(Load, EndpointDiscovery),
Fail { message: Arc<str> },
// TODO(kate): add a `PenaltyPeakEwma` variant here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and as the description notes, i've left some TODO(kate) comments here and elsewhere to leave breadcrumbs for when we wire this up.

}

#[derive(Clone, Debug, Eq, Hash, PartialEq)]
Expand Down Expand Up @@ -135,6 +136,7 @@ pub enum FailureAccrual {
/// Backoff for probing the endpoint when it is in a failed state.
backoff: linkerd_exp_backoff::ExponentialBackoff,
},
// TODO(kate): add a `Unified` variant here.
}

// === impl ClientPolicy ===
Expand Down Expand Up @@ -394,6 +396,9 @@ pub mod proto {

#[error("invalid backend metadata: {0}")]
Meta(#[from] InvalidMeta),

#[error("penalty peak ewma mode is not yet supported")]
PenaltyPeakEwmaUnsupported,
Comment on lines +399 to +401

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you can see, i've added error variants where we have a new protobuf variant that is not yet supported. support for this will be introduced in #4537, #4546, etc.

at that point, we can remove these variants.

}

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -423,6 +428,8 @@ pub mod proto {
Backoff(#[from] InvalidBackoff),
#[error("missing {0}")]
Missing(&'static str),
#[error("unified failure accrual is not yet supported")]
UnifiedUnsupported,
}

#[derive(Debug, thiserror::Error)]
Expand Down Expand Up @@ -667,6 +674,10 @@ pub mod proto {
default_rtt: duration("peak EWMA default RTT", default_rtt)?,
decay: duration("peak EWMA decay", decay)?,
}),
balance_p2c::Load::PenaltyPeakEwma(_) => {
// TODO(kate): marshal `PenaltyPeakEwma` here.
return Err(InvalidBackend::PenaltyPeakEwmaUnsupported);
}
};
BackendDispatcher::BalanceP2c(load, discovery)
}
Expand Down Expand Up @@ -733,6 +744,8 @@ pub mod proto {
InvalidFailureAccrual::Missing("consecutive failures backoff"),
)?,
}),
// TODO(kate): marshal `Unified` here.
failure_accrual::Kind::Unified(_) => Err(InvalidFailureAccrual::UnifiedUnsupported),
}
}
}
Expand All @@ -751,6 +764,7 @@ pub mod proto {
min_backoff,
max_backoff,
jitter_ratio,
respect_retry_after_hint: _, // TODO(kate): use respect_retry_after_hint
}: outbound::ExponentialBackoff,
) -> Result<linkerd_exp_backoff::ExponentialBackoff, InvalidBackoff> {
let min = min_backoff
Expand Down
Loading