Skip to content

Commit

Permalink
Fix namespace label in kube metrics
Browse files Browse the repository at this point in the history
The bug leads to label job_namespace has value only when
`pj.Spec.Refs != nil`. Periodics hence have no such labels by
mistake.
  • Loading branch information
hongkailiu committed Oct 8, 2019
1 parent 4db0b31 commit 5f30635
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions prow/kube/metrics.go
Expand Up @@ -78,10 +78,9 @@ func getJobLabelMap(pjs []prowapi.ProwJob) map[jobLabel]float64 {
}

func getJobLabel(pj prowapi.ProwJob) jobLabel {
jl := jobLabel{jobName: pj.Spec.Job, jobType: string(pj.Spec.Type), state: string(pj.Status.State)}
jl := jobLabel{jobNamespace: pj.Namespace, jobName: pj.Spec.Job, jobType: string(pj.Spec.Type), state: string(pj.Status.State)}

if pj.Spec.Refs != nil {
jl.jobNamespace = pj.Namespace
jl.org = pj.Spec.Refs.Org
jl.repo = pj.Spec.Refs.Repo
jl.baseRef = pj.Spec.Refs.BaseRef
Expand Down

0 comments on commit 5f30635

Please sign in to comment.