Skip to content

Commit abed459

Browse files
committed
refactor: log agent state changes on config updates
Add state transition logs in AgentState::update_config and update_partial_config so enabled/disabled changes from config updates are visible with the same format used by other AgentState transitions.
1 parent fc8c974 commit abed459

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

agent/src/trident.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,12 @@ impl AgentState {
275275
return;
276276
}
277277
let mut sg = self.state.lock().unwrap();
278+
let old_state: State = sg.0.into();
278279
sg.0.enabled = config.user_config.global.common.enabled;
280+
let new_state: State = sg.0.into();
281+
if old_state != new_state {
282+
info!("Agent state changed from {old_state:?} to {new_state:?} (enabled: {} melted_down: {})", sg.0.enabled, sg.0.melted_down);
283+
}
279284
sg.1.replace(config);
280285
self.notifier.notify_one();
281286
}
@@ -287,7 +292,12 @@ impl AgentState {
287292
return;
288293
}
289294
let mut sg = self.state.lock().unwrap();
295+
let old_state: State = sg.0.into();
290296
sg.0.enabled = user_config.global.common.enabled;
297+
let new_state: State = sg.0.into();
298+
if old_state != new_state {
299+
info!("Agent state changed from {old_state:?} to {new_state:?} (enabled: {} melted_down: {})", sg.0.enabled, sg.0.melted_down);
300+
}
291301
if let Some(changed_config) = sg.1.as_mut() {
292302
changed_config.user_config = user_config;
293303
} else {

0 commit comments

Comments
 (0)