nomad: lookup job instead of adding Dispatched to summary
This commit is contained in:
parent
b81e4e18f0
commit
8ac69f440d
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue