diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 23633a1af..a49e1b385 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -977,6 +977,9 @@ type AllocMetric struct { // ClassExhausted is the number of nodes exhausted by class ClassExhausted map[string]int + // DimensionExhaused provides the count by dimension or reason + DimensionExhaused map[string]int + // Scores is the scores of the final few nodes remaining // for placement. The top score is typically selected. Scores map[string]float64 @@ -1012,7 +1015,7 @@ func (a *AllocMetric) FilterNode(node *Node, constraint string) { } } -func (a *AllocMetric) ExhaustedNode(node *Node) { +func (a *AllocMetric) ExhaustedNode(node *Node, dimension string) { a.NodesExhausted += 1 if node != nil && node.NodeClass != "" { if a.ClassExhausted == nil { @@ -1020,6 +1023,12 @@ func (a *AllocMetric) ExhaustedNode(node *Node) { } a.ClassExhausted[node.NodeClass] += 1 } + if dimension != "" { + if a.DimensionExhaused == nil { + a.DimensionExhaused = make(map[string]int) + } + a.DimensionExhaused[dimension] += 1 + } } func (a *AllocMetric) ScoreNode(node *Node, name string, score float64) { diff --git a/scheduler/rank.go b/scheduler/rank.go index aabcafc41..e9f65e098 100644 --- a/scheduler/rank.go +++ b/scheduler/rank.go @@ -191,8 +191,8 @@ OUTER: ask := taskResources.Networks[0] offer, err := netIdx.AssignNetwork(ask) if offer == nil { - iter.ctx.Metrics().FilterNode(option.Node, - fmt.Sprintf("failed network offer: %s", err)) + iter.ctx.Metrics().ExhaustedNode(option.Node, + fmt.Sprintf("network: %s", err)) continue OUTER } @@ -216,7 +216,7 @@ OUTER: // Check if these allocations fit, if they do not, simply skip this node fit, util, _ := structs.AllocsFit(option.Node, proposed, netIdx) if !fit { - iter.ctx.Metrics().ExhaustedNode(option.Node) + iter.ctx.Metrics().ExhaustedNode(option.Node, "resources") continue }