mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
use labels.FromMap
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
parent
e8e639dbc9
commit
68fa39880e
|
@ -18,7 +18,6 @@ import (
|
|||
"hash/fnv"
|
||||
"net"
|
||||
"net/url"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -534,16 +533,7 @@ func buildTargetLabels(targetLSet, targetGroupLSet model.LabelSet, cfg *config.S
|
|||
set(labelsMap, model.ParamLabelPrefix+k, v[0])
|
||||
}
|
||||
}
|
||||
return buildLabels(labelsMap)
|
||||
}
|
||||
|
||||
func buildLabels(ls map[string]string) labels.Labels {
|
||||
var result labels.Labels = make([]labels.Label, 0, len(ls))
|
||||
for k, v := range ls {
|
||||
result = append(result, labels.Label{Name: k, Value: v})
|
||||
}
|
||||
sort.Sort(result)
|
||||
return result
|
||||
return labels.FromMap(labelsMap)
|
||||
}
|
||||
|
||||
func set(ls map[string]string, k, v string) {
|
||||
|
|
Loading…
Reference in a new issue