mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
web: group targets by job then instance (#4898)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
632626b553
commit
77ee41084f
|
@ -55,7 +55,6 @@ import (
|
||||||
|
|
||||||
"github.com/prometheus/prometheus/config"
|
"github.com/prometheus/prometheus/config"
|
||||||
"github.com/prometheus/prometheus/notifier"
|
"github.com/prometheus/prometheus/notifier"
|
||||||
"github.com/prometheus/prometheus/pkg/labels"
|
|
||||||
"github.com/prometheus/prometheus/promql"
|
"github.com/prometheus/prometheus/promql"
|
||||||
"github.com/prometheus/prometheus/rules"
|
"github.com/prometheus/prometheus/rules"
|
||||||
"github.com/prometheus/prometheus/scrape"
|
"github.com/prometheus/prometheus/scrape"
|
||||||
|
@ -709,7 +708,8 @@ 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(labels.InstanceName) < targets[j].Labels().Get(labels.InstanceName)
|
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)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue