Skip to content

Commit 28d2967

Browse files
committed
feat(http/retry): is_end_stream() traces
this commit introduces some trace-level diagnostics tracking how the replay body has determined whether or not it has reached the end of the stream. Signed-off-by: katelyn martin <kate@buoyant.io>
1 parent 5a926d4 commit 28d2967

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

linkerd/http/retry/src/replay.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,23 +277,37 @@ where
277277
Poll::Ready(Ok(None))
278278
}
279279

280+
#[tracing::instrument(
281+
skip_all,
282+
level = "trace",
283+
fields(
284+
state.is_some = %self.state.is_some(),
285+
replay_trailers = %self.replay_trailers,
286+
replay_body = %self.replay_body,
287+
is_completed = ?self.state.as_ref().map(|s| s.is_completed),
288+
)
289+
)]
280290
fn is_end_stream(&self) -> bool {
281291
// If the initial body was empty as soon as it was wrapped, then we are finished.
282292
if self.shared.was_empty {
293+
tracing::trace!("initial body was empty, stream has ended");
283294
return true;
284295
}
285296

286297
let Some(state) = self.state.as_ref() else {
287298
// This body is not currently the "active" replay being polled.
299+
tracing::trace!("inactive replay body is not complete");
288300
return false;
289301
};
290302

291303
// if this body has data or trailers remaining to play back, it
292304
// is not EOS
293-
!self.replay_body && !self.replay_trailers
305+
let eos = !self.replay_body && !self.replay_trailers
294306
// if we have replayed everything, the initial body may
295307
// still have data remaining, so ask it
296-
&& state.rest.is_end_stream()
308+
&& state.rest.is_end_stream();
309+
tracing::trace!(%eos, "checked replay body end-of-stream");
310+
eos
297311
}
298312

299313
#[inline]

0 commit comments

Comments
 (0)