From bf460ef4d271b03f2ee62063d538d1f481f898ac Mon Sep 17 00:00:00 2001 From: Lyon Hill Date: Fri, 12 Jul 2019 10:10:11 -0600 Subject: [PATCH] fix(tasks): Add a log message for run transition clairity (#14321) * fix(tasks): Add a log message for run transition clairity We on occasion will see a run in chronograf with missing run data. We need to find out if we are submitting incomplete data or if we submit full data and somethinge else is happening --- appveyor.yml | 2 +- task/backend/analytical_storage.go | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6a852e173e..5b400bbd12 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ environment: # Scripts that run after cloning repository install: - - choco install bzr # Needed to install go modules +# - choco install bzr # Needed to install go modules - set PATH=%GOROOT%\bin;%GOPATH%\bin;C:\Program Files (x86)\Bazaar\;%PATH% - echo %PATH% - echo %GOPATH% diff --git a/task/backend/analytical_storage.go b/task/backend/analytical_storage.go index 38f84daa79..f55d639e62 100644 --- a/task/backend/analytical_storage.go +++ b/task/backend/analytical_storage.go @@ -67,6 +67,15 @@ func (as *AnalyticalStorage) FinishRun(ctx context.Context, taskID, runID influx models.NewTag([]byte(statusField), []byte(run.Status)), } + // log an error if we have incomplete data on finish + if !run.ID.Valid() || + run.ScheduledFor == "" || + run.StartedAt == "" || + run.FinishedAt == "" || + run.Status == "" { + as.logger.Error("Run missing critical fields", zap.String("run", fmt.Sprintf("%+v", run)), zap.String("runID", run.ID.String())) + } + fields := map[string]interface{}{} fields[statusField] = run.Status fields[runIDField] = run.ID.String()