Browse Source

Fix bug from #4898 (#5161)

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
pull/5163/head
Ganesh Vernekar 6 years ago committed by Goutham Veeramachaneni
parent
commit
10ae00ab9d
  1. 8
      web/web.go

8
web/web.go

@ -695,8 +695,12 @@ func (h *Handler) targets(w http.ResponseWriter, r *http.Request) {
tps := h.scrapeManager.TargetsActive()
for _, targets := range tps {
sort.Slice(targets, func(i, j int) bool {
return targets[i].Labels().Get(model.JobLabel) < targets[j].Labels().Get(model.JobLabel) ||
targets[i].Labels().Get(model.InstanceLabel) < targets[j].Labels().Get(model.InstanceLabel)
iJobLabel := targets[i].Labels().Get(model.JobLabel)
jJobLabel := targets[j].Labels().Get(model.JobLabel)
if iJobLabel == jJobLabel {
return targets[i].Labels().Get(model.InstanceLabel) < targets[j].Labels().Get(model.InstanceLabel)
}
return iJobLabel < jJobLabel
})
}

Loading…
Cancel
Save