Skip to content

Commit

Permalink
Port client portion of #4392 to new taskrunner
Browse files Browse the repository at this point in the history
PR #4392 was merged to master *after* allocrunnerv2 was branched, so the
client-specific portions must be ported from master to arv2.
  • Loading branch information
schmichael committed Oct 15, 2018
1 parent 4d6925b commit d63300d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions client/allocrunner/taskrunner/task_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -277,6 +278,25 @@ func (tr *TaskRunner) initLabels() {
Value: tr.taskName,
},
}

if tr.alloc.Job.ParentID != "" {
tr.baseLabels = append(tr.baseLabels, metrics.Label{
Name: "parent_id",
Value: tr.alloc.Job.ParentID,
})
if strings.Contains(tr.alloc.Job.Name, "/dispatch-") {
tr.baseLabels = append(tr.baseLabels, metrics.Label{
Name: "dispatch_id",
Value: strings.Split(tr.alloc.Job.Name, "/dispatch-")[1],
})
}
if strings.Contains(tr.alloc.Job.Name, "/periodic-") {
tr.baseLabels = append(tr.baseLabels, metrics.Label{
Name: "periodic_id",
Value: strings.Split(tr.alloc.Job.Name, "/periodic-")[1],
})
}
}
}

func (tr *TaskRunner) Run() {
Expand Down

0 comments on commit d63300d

Please sign in to comment.