Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug log for check-in miss #5348

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/component/runtime/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ type procState struct {

// commandRuntime provides the command runtime for running a component as a subprocess.
type commandRuntime struct {
log *logger.Logger
logStd *logWriter
logErr *logWriter

Expand Down Expand Up @@ -108,6 +109,7 @@ type commandRuntime struct {
// newCommandRuntime creates a new command runtime for the provided component.
func newCommandRuntime(comp component.Component, log *logger.Logger, monitor MonitoringManager) (*commandRuntime, error) {
c := &commandRuntime{
log: log,
current: comp,
monitor: monitor,
ch: make(chan ComponentState),
Expand Down Expand Up @@ -238,6 +240,7 @@ func (c *commandRuntime) Run(ctx context.Context, comm Communicator) error {
c.missedCheckins = 0
} else {
c.missedCheckins++
c.log.Debugf("Last check-in was: %s, now is: %s. The diff %s is higher than allowed %s.", c.lastCheckin.Format(time.RFC3339Nano), now.Format(time.RFC3339Nano), now.Sub(c.lastCheckin), checkinPeriod)
}
if c.missedCheckins == 0 {
c.compState(client.UnitStateHealthy)
Expand Down