Skip to content

Commit

Permalink
remove node from scheduler metrics (#3788)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Martin <chris@cmartinit.co.uk>
Co-authored-by: Chris Martin <chris@cmartinit.co.uk>
Co-authored-by: robertdavidsmith <34475852+robertdavidsmith@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 14, 2024
1 parent 49c7c91 commit f805c58
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions internal/scheduler/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,34 +390,27 @@ func (m *Metrics) indexOfFirstMatchingRegexFromErrorMessage(message string) (int
}

func appendLabelsFromJob(labels []string, job *jobdb.Job) []string {
executor, nodeName := executorAndNodeNameFromRun(job.LatestRun())
executor := executorNameFromRun(job.LatestRun())
labels = append(labels, job.Queue())
labels = append(labels, executor)
labels = append(labels, "") // No nodeType.
labels = append(labels, nodeName)
return labels
}

func appendLabelsFromJobSchedulingContext(labels []string, jctx *schedulercontext.JobSchedulingContext) []string {
job := jctx.Job
executor, nodeName := executorAndNodeNameFromRun(job.LatestRun())
executor := executorNameFromRun(job.LatestRun())
labels = append(labels, job.Queue())
labels = append(labels, executor)
wellKnownNodeType := ""
if pctx := jctx.PodSchedulingContext; pctx != nil {
wellKnownNodeType = pctx.WellKnownNodeTypeName
}
labels = append(labels, wellKnownNodeType)
labels = append(labels, nodeName)
return labels
}

func executorAndNodeNameFromRun(run *jobdb.JobRun) (string, string) {
func executorNameFromRun(run *jobdb.JobRun) string {
if run == nil {
// This case covers, e.g., jobs failing that have never been scheduled.
return "", ""
return ""
}
return run.Executor(), run.NodeName()
return run.Executor()
}

func errorTypeAndMessageFromError(ctx *armadacontext.Context, err *armadaevents.Error) (string, string) {
Expand Down

0 comments on commit f805c58

Please sign in to comment.