Skip to content

Commit

Permalink
Reduce logging: downgrade resource state transition logs to DEBUG (#4118
Browse files Browse the repository at this point in the history
)
  • Loading branch information
maximpertsov authored Jun 21, 2024
1 parent c3fcbe7 commit 425ff35
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions resource/graph_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,17 +462,13 @@ func (w *GraphNode) canTransitionTo(state NodeState) bool {
// if the state transition is not expected. This method is not thread-safe and must be
// called while holding a write lock on `mu` if accessed concurrently.
func (w *GraphNode) transitionTo(state NodeState) {
if w.state == state {
if w.logger != nil {
w.logger.Warnf("unexpected self-transition from %s", w.state.String())
}
if w.state == state && w.logger != nil {
w.logger.Debugw("resource state self-transition", "state", w.state.String())
return
}

if !w.canTransitionTo(state) {
if w.logger != nil {
w.logger.Warnf("unexpected transition %s -> %s", w.state.String(), state.String())
}
if !w.canTransitionTo(state) && w.logger != nil {
w.logger.Warnw("unexpected resource state transition", "from", w.state.String(), "to", state.String())
}

w.state = state
Expand Down

0 comments on commit 425ff35

Please sign in to comment.