Skip to content

Commit f191eac

Browse files
authored
control: Avoid logging warnings on reconnect (#2593)
When stream limits cause a graceful stream end, we should not log a warning.
1 parent 6aaafcb commit f191eac

File tree

3 files changed

+41
-24
lines changed

3 files changed

+41
-24
lines changed

linkerd/app/inbound/src/policy/api.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,23 @@ impl Recover<tonic::Status> for GrpcRecover {
114114
type Backoff = ExponentialBackoffStream;
115115

116116
fn recover(&self, status: tonic::Status) -> Result<Self::Backoff, tonic::Status> {
117-
if status.code() == tonic::Code::InvalidArgument
118-
|| status.code() == tonic::Code::FailedPrecondition
119-
{
120-
return Err(status);
117+
match status.code() {
118+
tonic::Code::InvalidArgument | tonic::Code::FailedPrecondition => Err(status),
119+
tonic::Code::Ok => {
120+
tracing::debug!(
121+
grpc.message = status.message(),
122+
"Completed; retrying with a backoff",
123+
);
124+
Ok(self.0.stream())
125+
}
126+
code => {
127+
tracing::warn!(
128+
grpc.status = %code,
129+
grpc.message = status.message(),
130+
"Unexpected policy controller response; retrying with a backoff",
131+
);
132+
Ok(self.0.stream())
133+
}
121134
}
122-
123-
tracing::warn!(
124-
grpc.status = %status.code(),
125-
grpc.message = status.message(),
126-
"Unexpected policy controller response; retrying with a backoff",
127-
);
128-
Ok(self.0.stream())
129135
}
130136
}

linkerd/app/outbound/src/policy/api.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ impl Recover<tonic::Status> for GrpcRecover {
124124
tonic::Code::InvalidArgument | tonic::Code::FailedPrecondition => Err(status),
125125
// Indicates no policy for this target
126126
tonic::Code::NotFound | tonic::Code::Unimplemented => Err(status),
127+
tonic::Code::Ok => {
128+
tracing::debug!(
129+
grpc.message = status.message(),
130+
"Completed; retrying with a backoff",
131+
);
132+
Ok(self.0.stream())
133+
}
127134
code => {
128135
tracing::warn!(
129136
grpc.status = %code,

linkerd/app/src/dst.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,23 @@ impl Recover<tonic::Status> for BackoffUnlessInvalidArgument {
9797
type Backoff = ExponentialBackoffStream;
9898

9999
fn recover(&self, status: tonic::Status) -> Result<Self::Backoff, tonic::Status> {
100-
// Address is not resolvable
101-
if status.code() == tonic::Code::InvalidArgument
102-
// Unexpected cluster state
103-
|| status.code() == tonic::Code::FailedPrecondition
104-
{
105-
return Err(status);
100+
match status.code() {
101+
tonic::Code::InvalidArgument | tonic::Code::FailedPrecondition => Err(status),
102+
tonic::Code::Ok => {
103+
tracing::debug!(
104+
grpc.message = status.message(),
105+
"Completed; retrying with a backoff",
106+
);
107+
Ok(self.0.stream())
108+
}
109+
code => {
110+
tracing::warn!(
111+
grpc.status = %code,
112+
grpc.message = status.message(),
113+
"Unexpected policy controller response; retrying with a backoff",
114+
);
115+
Ok(self.0.stream())
116+
}
106117
}
107-
108-
tracing::warn!(
109-
grpc.status = %status.code(),
110-
grpc.message = status.message(),
111-
"Unexpected destination controller response; retrying with a backoff",
112-
);
113-
Ok(self.0.stream())
114118
}
115119
}

0 commit comments

Comments
 (0)