From f44a44921e74254269cb20a0d81c7047ec70deff Mon Sep 17 00:00:00 2001 From: Tolga Ceylan Date: Thu, 29 Nov 2018 16:08:48 -0800 Subject: [PATCH] fn: status call failures should be logged (#1331) Added logging for status call failures. --- api/agent/pure_runner.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/api/agent/pure_runner.go b/api/agent/pure_runner.go index 175b3a949..9aaa39a11 100644 --- a/api/agent/pure_runner.go +++ b/api/agent/pure_runner.go @@ -767,8 +767,9 @@ func (pr *pureRunner) runStatusCall(ctx context.Context) *runner.RunnerStatus { // more configurable. c.ID = id.New().String() c.Image = pr.status.imageName - c.Type = "sync" + c.Type = models.TypeSync c.TmpFsSize = 0 + // IMPORTANT: mem/cpu set to zero. This means status containers cannot be evicted. c.Memory = 0 c.CPUs = models.MilliCPUs(0) c.URL = "/" @@ -832,15 +833,15 @@ func (pr *pureRunner) runStatusCall(ctx context.Context) *runner.RunnerStatus { body, _ := ioutil.ReadAll(resp.Body) resp.Body.Close() - // Clamp the log output to 256 bytes if output is too large for logging. - dLen := len(body) - if dLen > 256 { - dLen = 256 - } - log.Debugf("Status call with id=%v result=%+v body[0:%v]=%v", c.ID, result, dLen, string(body[:dLen])) - result.Details = string(body) result.Id = c.ID + + if result.Failed { + log.Errorf("Status call failure id=%v result=%+v", c.ID, result) + } else { + log.Debugf("Status call success id=%v result=%+v", c.ID, result) + } + return result }