From 7d5724ab9c872d7c107498b798b085795794111f Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 28 Jun 2024 14:39:46 -0700 Subject: [PATCH] Add more context on statemanager logs (#1189) Ensure we always know what workload we are talking about --- src/inpod/statemanager.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/inpod/statemanager.rs b/src/inpod/statemanager.rs index 0e84ef54b..9cf42ffac 100644 --- a/src/inpod/statemanager.rs +++ b/src/inpod/statemanager.rs @@ -109,8 +109,18 @@ impl WorkloadProxyManagerState { match msg { WorkloadMessage::AddWorkload(poddata) => { info!( - "pod {:?} received netns, starting proxy", - poddata.workload_uid + uid = poddata.workload_uid.0, + name = poddata + .workload_info + .as_ref() + .map(|w| w.name.as_str()) + .unwrap_or_default(), + namespace = poddata + .workload_info + .as_ref() + .map(|w| w.namespace.as_str()) + .unwrap_or_default(), + "pod received, starting proxy", ); if !self.snapshot_received { self.snapshot_names.insert(poddata.workload_uid.clone()); @@ -127,7 +137,10 @@ impl WorkloadProxyManagerState { .map_err(Error::ProxyError) } WorkloadMessage::KeepWorkload(workload_uid) => { - info!("pod keep received. will not delete it when snapshot is sent"); + info!( + uid = workload_uid.0, + "pod keep received. will not delete it when snapshot is sent" + ); if self.snapshot_received { // this can only happen before snapshot is received. return Err(Error::ProtocolError( @@ -138,7 +151,7 @@ impl WorkloadProxyManagerState { Ok(()) } WorkloadMessage::DelWorkload(workload_uid) => { - info!("pod delete request, draining proxy"); + info!(uid = workload_uid.0, "pod delete request, draining proxy"); if !self.snapshot_received { // TODO: consider if this is an error. if not, do this instead: // self.snapshot_names.remove(&workload_uid)