Unverified Commit 8de254c5 authored by Nick Ethier's avatar Nick Ethier
Browse files

nomad: lookup job instead of adding Dispatched to summary

parent af3f535f
Showing with 8 additions and 9 deletions
+8 -9
...@@ -624,7 +624,11 @@ func (s *Server) publishJobSummaryMetrics(stopCh chan struct{}) { ...@@ -624,7 +624,11 @@ func (s *Server) publishJobSummaryMetrics(stopCh chan struct{}) {
break break
} }
summary := raw.(*structs.JobSummary) 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 continue
} }
s.iterateJobSummaryMetrics(summary) s.iterateJobSummaryMetrics(summary)
......
...@@ -3050,10 +3050,9 @@ func (s *StateStore) ReconcileJobSummaries(index uint64) error { ...@@ -3050,10 +3050,9 @@ func (s *StateStore) ReconcileJobSummaries(index uint64) error {
// Create a job summary for the job // Create a job summary for the job
summary := &structs.JobSummary{ summary := &structs.JobSummary{
JobID: job.ID, JobID: job.ID,
Namespace: job.Namespace, Namespace: job.Namespace,
Summary: make(map[string]structs.TaskGroupSummary), Summary: make(map[string]structs.TaskGroupSummary),
Dispatched: job.Dispatched,
} }
for _, tg := range job.TaskGroups { for _, tg := range job.TaskGroups {
summary.Summary[tg.Name] = structs.TaskGroupSummary{} summary.Summary[tg.Name] = structs.TaskGroupSummary{}
...@@ -3350,7 +3349,6 @@ func (s *StateStore) updateSummaryWithJob(index uint64, job *structs.Job, ...@@ -3350,7 +3349,6 @@ func (s *StateStore) updateSummaryWithJob(index uint64, job *structs.Job,
Summary: make(map[string]structs.TaskGroupSummary), Summary: make(map[string]structs.TaskGroupSummary),
Children: new(structs.JobChildrenSummary), Children: new(structs.JobChildrenSummary),
CreateIndex: index, CreateIndex: index,
Dispatched: job.Dispatched,
} }
hasSummaryChanged = true hasSummaryChanged = true
} }
......
...@@ -3593,9 +3593,6 @@ type JobSummary struct { ...@@ -3593,9 +3593,6 @@ type JobSummary struct {
// Children contains a summary for the children of this job. // Children contains a summary for the children of this job.
Children *JobChildrenSummary Children *JobChildrenSummary
// Dispatched is true if this job is dispatched from a parameterized job
Dispatched bool
// Raft Indexes // Raft Indexes
CreateIndex uint64 CreateIndex uint64
ModifyIndex uint64 ModifyIndex uint64
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment