Skip to content

Commit

Permalink
clientconn: add channel ID to some idleness logs (#6459)
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars authored Jul 21, 2023
1 parent 9bb44fb commit f1fc2ca
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions clientconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func (cc *ClientConn) exitIdleMode() error {
}
if cc.idlenessState != ccIdlenessStateIdle {
cc.mu.Unlock()
logger.Info("ClientConn asked to exit idle mode when not in idle mode")
channelz.Infof(logger, cc.channelzID, "ClientConn asked to exit idle mode, current mode is %v", cc.idlenessState)
return nil
}

Expand Down Expand Up @@ -396,7 +396,7 @@ func (cc *ClientConn) enterIdleMode() error {
return ErrClientConnClosing
}
if cc.idlenessState != ccIdlenessStateActive {
logger.Error("ClientConn asked to enter idle mode when not active")
channelz.Errorf(logger, cc.channelzID, "ClientConn asked to enter idle mode, current mode is %v", cc.idlenessState)
return nil
}

Expand Down Expand Up @@ -667,6 +667,19 @@ const (
ccIdlenessStateExitingIdle
)

func (s ccIdlenessState) String() string {
switch s {
case ccIdlenessStateActive:
return "active"
case ccIdlenessStateIdle:
return "idle"
case ccIdlenessStateExitingIdle:
return "exitingIdle"
default:
return "unknown"
}
}

// WaitForStateChange waits until the connectivity.State of ClientConn changes from sourceState or
// ctx expires. A true value is returned in former case and false in latter.
//
Expand Down

0 comments on commit f1fc2ca

Please sign in to comment.