Skip to content

Commit

Permalink
control: Avoid logging warnings on reconnect (#2593)
Browse files Browse the repository at this point in the history
When stream limits cause a graceful stream end, we should not log a
warning.
  • Loading branch information
olix0r authored Dec 27, 2023
1 parent 6aaafcb commit f191eac
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 24 deletions.
28 changes: 17 additions & 11 deletions linkerd/app/inbound/src/policy/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,23 @@ impl Recover<tonic::Status> for GrpcRecover {
type Backoff = ExponentialBackoffStream;

fn recover(&self, status: tonic::Status) -> Result<Self::Backoff, tonic::Status> {
if status.code() == tonic::Code::InvalidArgument
|| status.code() == tonic::Code::FailedPrecondition
{
return Err(status);
match status.code() {
tonic::Code::InvalidArgument | tonic::Code::FailedPrecondition => Err(status),
tonic::Code::Ok => {
tracing::debug!(
grpc.message = status.message(),
"Completed; retrying with a backoff",
);
Ok(self.0.stream())
}
code => {
tracing::warn!(
grpc.status = %code,
grpc.message = status.message(),
"Unexpected policy controller response; retrying with a backoff",
);
Ok(self.0.stream())
}
}

tracing::warn!(
grpc.status = %status.code(),
grpc.message = status.message(),
"Unexpected policy controller response; retrying with a backoff",
);
Ok(self.0.stream())
}
}
7 changes: 7 additions & 0 deletions linkerd/app/outbound/src/policy/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ impl Recover<tonic::Status> for GrpcRecover {
tonic::Code::InvalidArgument | tonic::Code::FailedPrecondition => Err(status),
// Indicates no policy for this target
tonic::Code::NotFound | tonic::Code::Unimplemented => Err(status),
tonic::Code::Ok => {
tracing::debug!(
grpc.message = status.message(),
"Completed; retrying with a backoff",
);
Ok(self.0.stream())
}
code => {
tracing::warn!(
grpc.status = %code,
Expand Down
30 changes: 17 additions & 13 deletions linkerd/app/src/dst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,23 @@ impl Recover<tonic::Status> for BackoffUnlessInvalidArgument {
type Backoff = ExponentialBackoffStream;

fn recover(&self, status: tonic::Status) -> Result<Self::Backoff, tonic::Status> {
// Address is not resolvable
if status.code() == tonic::Code::InvalidArgument
// Unexpected cluster state
|| status.code() == tonic::Code::FailedPrecondition
{
return Err(status);
match status.code() {
tonic::Code::InvalidArgument | tonic::Code::FailedPrecondition => Err(status),
tonic::Code::Ok => {
tracing::debug!(
grpc.message = status.message(),
"Completed; retrying with a backoff",
);
Ok(self.0.stream())
}
code => {
tracing::warn!(
grpc.status = %code,
grpc.message = status.message(),
"Unexpected policy controller response; retrying with a backoff",
);
Ok(self.0.stream())
}
}

tracing::warn!(
grpc.status = %status.code(),
grpc.message = status.message(),
"Unexpected destination controller response; retrying with a backoff",
);
Ok(self.0.stream())
}
}

0 comments on commit f191eac

Please sign in to comment.