nomad: adding AllocMetric to track allocation metrics

This commit is contained in:
Armon Dadgar
2015-07-03 17:37:01 -07:00
parent f3347a6030
commit 50c81f7047
2 changed files with 45 additions and 1 deletions

View File

@@ -114,7 +114,7 @@ func jobTableSchema() *memdb.TableSchema {
// This table is used to store all the task groups belonging to a job.
func taskGroupTableSchema() *memdb.TableSchema {
return &memdb.TableSchema{
Name: "taskGroups",
Name: "groups",
Indexes: map[string]*memdb.IndexSchema{
// Primary index is compount of {Job, Name}
"id": &memdb.IndexSchema{

View File

@@ -169,6 +169,10 @@ type Node struct {
// client. This is opaque to Nomad.
Meta map[string]string
// NodeClass is an opaque identifier used to group nodes
// together for the purpose of determining scheduling pressure.
NodeClass string
// Status of this node
Status string
}
@@ -346,10 +350,50 @@ type Allocation struct {
// of this allocation of the task group.
Resources *Resources
// Metrics associated with this allocation
Metrics *AllocMetric
// Status of the allocation
Status string
}
// AllocMetric is used to track various metrics while attempting
// to make an allocation. These are used to debug a job, or to better
// understand the pressure within the system.
type AllocMetric struct {
// NodesEvaluated is the number of nodes that were evaluated
NodesEvaluated int
// NodesFiltered is the number of nodes filtered due to
// a hard constraint
NodesFiltered int
// ClassFiltered is the number of nodes filtered by class
ClassFiltered map[string]int
// ConstraintFiltered is the number of failures caused by constraint
ConstraintFiltered map[string]int
// NodesExhausted is the nubmer of nodes skipped due to being
// exhausted of at least one resource
NodesExhausted int
// ClassExhausted is the number of nodes exhausted by class
ClassExhausted map[string]int
// Preemptions is the number of preemptions considered.
// This indicates a relatively busy fleet if high.
Preemptions int
// Scores is the scores of the final few nodes remaining
// for placement. The top score is typically selected.
Scores map[string]int
// AllocationTime is a measure of how long the allocation
// attempt took. This can affect performance and SLAs.
AllocationTime time.Duration
}
// msgpackHandle is a shared handle for encoding/decoding of structs
var msgpackHandle = &codec.MsgpackHandle{}