nomad: lookup job instead of adding Dispatched to summary

This commit is contained in:
Nick Ethier 2018-11-14 15:42:35 -05:00
parent b81e4e18f0
commit 8ac69f440d
No known key found for this signature in database
GPG key ID: 07C1A3ECED90D24A
3 changed files with 8 additions and 9 deletions

View file

@ -624,7 +624,11 @@ func (s *Server) publishJobSummaryMetrics(stopCh chan struct{}) {
break
}
summary := raw.(*structs.JobSummary)
if s.config.DisableDispatchedJobSummaryMetrics && summary.Dispatched {
job, err := state.JobByID(ws, summary.Namespace, summary.JobID)
if err != nil {
s.logger.Printf("[ERR] nomad: failed to lookup job for summary: %v", err)
}
if s.config.DisableDispatchedJobSummaryMetrics && job.Dispatched {
continue
}
s.iterateJobSummaryMetrics(summary)

View file

@ -3050,10 +3050,9 @@ func (s *StateStore) ReconcileJobSummaries(index uint64) error {
// Create a job summary for the job
summary := &structs.JobSummary{
JobID: job.ID,
Namespace: job.Namespace,
Summary: make(map[string]structs.TaskGroupSummary),
Dispatched: job.Dispatched,
JobID: job.ID,
Namespace: job.Namespace,
Summary: make(map[string]structs.TaskGroupSummary),
}
for _, tg := range job.TaskGroups {
summary.Summary[tg.Name] = structs.TaskGroupSummary{}
@ -3350,7 +3349,6 @@ func (s *StateStore) updateSummaryWithJob(index uint64, job *structs.Job,
Summary: make(map[string]structs.TaskGroupSummary),
Children: new(structs.JobChildrenSummary),
CreateIndex: index,
Dispatched: job.Dispatched,
}
hasSummaryChanged = true
}

View file

@ -3593,9 +3593,6 @@ type JobSummary struct {
// Children contains a summary for the children of this job.
Children *JobChildrenSummary
// Dispatched is true if this job is dispatched from a parameterized job
Dispatched bool
// Raft Indexes
CreateIndex uint64
ModifyIndex uint64