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
pull/14322/head^2
Lyon Hill 2019-07-12 10:10:11 -06:00 committed by GitHub
parent c40f0ec60e
commit bf460ef4d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -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%

View File

@ -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()