Commit 10ae00ab authored by Ganesh Vernekar's avatar Ganesh Vernekar Committed by Goutham Veeramachaneni
Browse files

Fix bug from #4898 (#5161)


Signed-off-by: default avatarGanesh Vernekar <cs15btech11018@iith.ac.in>
parent 787eb1e9
...@@ -695,8 +695,12 @@ func (h *Handler) targets(w http.ResponseWriter, r *http.Request) { ...@@ -695,8 +695,12 @@ func (h *Handler) targets(w http.ResponseWriter, r *http.Request) {
tps := h.scrapeManager.TargetsActive() tps := h.scrapeManager.TargetsActive()
for _, targets := range tps { for _, targets := range tps {
sort.Slice(targets, func(i, j int) bool { sort.Slice(targets, func(i, j int) bool {
return targets[i].Labels().Get(model.JobLabel) < targets[j].Labels().Get(model.JobLabel) || iJobLabel := targets[i].Labels().Get(model.JobLabel)
targets[i].Labels().Get(model.InstanceLabel) < targets[j].Labels().Get(model.InstanceLabel) 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
}) })
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment