From 2a97a9b9de9d11920b80a882b793bb72aa282b1d Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Wed, 1 Nov 2017 15:52:55 -0700 Subject: [PATCH] Incrementing the start counter when we are actually starting a container --- client/alloc_runner.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/alloc_runner.go b/client/alloc_runner.go index ae25f94c125..16197ce156d 100644 --- a/client/alloc_runner.go +++ b/client/alloc_runner.go @@ -679,7 +679,6 @@ func (r *AllocRunner) setTaskState(taskName, state string, event *structs.TaskEv case structs.TaskStateDead: // Capture the finished time. If it has never started there is no finish // time - metrics.IncrCounter([]string{"client", "allocs", r.alloc.Job.Name, r.alloc.TaskGroup, taskName, "dead"}, 1) if !taskState.StartedAt.IsZero() { taskState.FinishedAt = time.Now().UTC() } @@ -754,9 +753,6 @@ func (r *AllocRunner) Run() { defer close(r.waitCh) go r.dirtySyncState() - // Increment alloc runner start counter. Incr'd even when restoring existing tasks so 1 start != 1 task execution - metrics.IncrCounter([]string{"client", "allocs", r.alloc.Job.Name, r.alloc.TaskGroup, "start"}, 1) - // Find the task group to run in the allocation alloc := r.Alloc() tg := alloc.Job.LookupTaskGroup(alloc.TaskGroup) @@ -811,6 +807,9 @@ func (r *AllocRunner) Run() { return } + // Increment alloc runner start counter. Incr'd even when restoring existing tasks so 1 start != 1 task execution + metrics.IncrCounter([]string{"client", "allocs", r.alloc.Job.Name, r.alloc.TaskGroup, "start"}, 1) + // Start the watcher wCtx, watcherCancel := context.WithCancel(r.ctx) go r.watchHealth(wCtx)