Skip to content

Commit

Permalink
Reduce heartbeat logging (openzfs#496)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Dagnelie <[email protected]>
  • Loading branch information
pcd1193182 authored Oct 14, 2021
1 parent 63941f0 commit 3257254
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions cmd/zfs_object_agent/zettaobject/src/heartbeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl HeartbeatPhys {
timeout: Option<Duration>,
) -> Result<rusoto_s3::PutObjectOutput, OAError<rusoto_s3::PutObjectError>> {
maybe_die_with(|| format!("before putting {:#?}", self));
debug!("putting {:#?}", self);
trace!("putting {:#?}", self);
let buf = serde_json::to_vec(&self).unwrap();
object_access
.put_object_timed(Self::key(self.id), buf, timeout)
Expand Down Expand Up @@ -151,8 +151,8 @@ pub async fn start_heartbeat(object_access: Arc<ObjectAccess>, id: Uuid) -> Hear
interval.tick().await;
if let Some(time) = last_heartbeat {
let since = Instant::now().duration_since(time);
if since > 2 * *HEARTBEAT_INTERVAL {
debug!("Heartbeat interval significantly over: {:?}", since);
if since > *LEASE_DURATION {
warn!("Heartbeat interval significantly over: {:?}", since);
} else if since > *HEARTBEAT_INTERVAL {
trace!("Heartbeat interval slightly over: {:?}", since);
}
Expand All @@ -177,8 +177,8 @@ pub async fn start_heartbeat(object_access: Arc<ObjectAccess>, id: Uuid) -> Hear
}
if let Some(time) = last_heartbeat {
let since = Instant::now().duration_since(time);
if since > 2 * *HEARTBEAT_INTERVAL {
debug!("Heartbeat locking significantly over: {:?}", since);
if since > *LEASE_DURATION {
warn!("Heartbeat locking significantly over: {:?}", since);
} else if since > *HEARTBEAT_INTERVAL {
trace!("Heartbeat locking slightly over: {:?}", since);
}
Expand Down Expand Up @@ -211,12 +211,10 @@ fn lease_timed_out(last_heartbeat: Option<Instant>) -> bool {
match last_heartbeat {
Some(time) => {
let since = Instant::now().duration_since(time);
if since > 2 * *LEASE_DURATION / 3 {
if since > *LEASE_DURATION {
warn!("Extreme heartbeat delay: {:?}", since);
} else if since > *LEASE_DURATION / 3 {
info!("Long heartbeat delay: {:?}", since);
} else {
debug!("Short heartbeat delay: {:?}", since);
trace!("Short heartbeat delay: {:?}", since);
}
since >= *LEASE_DURATION
}
Expand Down

0 comments on commit 3257254

Please sign in to comment.