Skip to content

Commit

Permalink
smallish logging tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Aug 20, 2024
1 parent cb608b6 commit 592baf6
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions gateway/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,21 @@ impl SpPoller {
match self.poll(sp).await {
// No sense cluttering the ringbuffer with empty vecs...
Ok(samples) if samples.is_empty() => {
slog::trace!(&self.log, "polled SP, no samples returned"; "num_samples" => 0usize);
slog::trace!(
&self.log,
"polled SP, no samples returned";
"num_samples" => 0usize
);
}
Ok(samples) => {
slog::trace!(&self.log, "polled SP successfully"; "num_samples" => samples.len());
slog::trace!(
&self.log,
"polled SP successfully";
"num_samples" => samples.len(),
);

if let Err(_) = self.sample_tx.send(samples) {
slog::info!(
slog::debug!(
&self.log,
"all sample receiver handles have been dropped! \
presumably we are shutting down...";
Expand All @@ -569,6 +577,11 @@ impl SpPoller {
// a sled added to it in the future. So, let's wait until it
// changes.
Err(CommunicationError::NoSpDiscovered) => {
slog::info!(
&self.log,
"no SP is present for this slot. waiting for a \
little buddy to appear...";
);
let mut watch = sp.sp_addr_watch().clone();
loop {
if let Some((addr, port)) = *watch.borrow_and_update() {
Expand All @@ -582,13 +595,8 @@ impl SpPoller {
break;
}

slog::info!(
&self.log,
"no SP is present for this slot. waiting for a \
little buddy to appear...";
);

// Wait for an address to be discovered.
slog::debug!(&self.log, "waiting for a SP to appear.");
if watch.changed().await.is_err() {
slog::debug!(
&self.log,
Expand Down

0 comments on commit 592baf6

Please sign in to comment.