Always log Runner and Environment ID.
Systematically log the runner id and the environment id by adding the information at the findRunnerMiddleware.
This commit is contained in:
@ -132,10 +132,10 @@ func (nc *nomadAPIClient) Execute(runnerID string,
|
||||
case err == nil:
|
||||
return exitCode, nil
|
||||
case websocket.IsCloseError(errors.Unwrap(err), websocket.CloseNormalClosure):
|
||||
log.WithContext(ctx).WithField("runnerID", runnerID).WithError(err).Info("The exit code could not be received.")
|
||||
log.WithContext(ctx).WithError(err).Info("The exit code could not be received.")
|
||||
return 0, nil
|
||||
case errors.Is(err, context.Canceled):
|
||||
log.WithContext(ctx).WithField("runnerID", runnerID).Debug("Execution canceled by context")
|
||||
log.WithContext(ctx).Debug("Execution canceled by context")
|
||||
return 0, nil
|
||||
default:
|
||||
return 1, fmt.Errorf("error executing command in allocation: %w", err)
|
||||
|
@ -596,7 +596,7 @@ func (a *APIClient) executeCommandInteractivelyWithStderr(allocationID string, c
|
||||
exit, err := a.Execute(allocationID, ctx, prepareCommandTTYStdErr(currentNanoTime, privilegedExecution), true,
|
||||
nullio.Reader{Ctx: readingContext}, stderr, io.Discard)
|
||||
if err != nil {
|
||||
log.WithContext(ctx).WithError(err).WithField("runner", allocationID).Warn("Stderr task finished with error")
|
||||
log.WithContext(ctx).WithError(err).Warn("Stderr task finished with error")
|
||||
}
|
||||
stderrExitChan <- exit
|
||||
})
|
||||
|
Reference in New Issue
Block a user