mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 08:23:34 +01:00
lib/promscrape: pre-allocate space for a map in mergeLabels
This should reduce the number of memory allocations when discovering big number of targets
This commit is contained in:
parent
ac5c47a9f5
commit
3fbe2bf1c8
@ -893,7 +893,7 @@ func getParamsFromLabels(labels []prompbmarshal.Label, paramsOrig map[string][]s
|
||||
|
||||
func mergeLabels(job, scheme, target, metricsPath string, extraLabels, externalLabels, metaLabels map[string]string, params map[string][]string) []prompbmarshal.Label {
|
||||
// See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
|
||||
m := make(map[string]string)
|
||||
m := make(map[string]string, 4 + len(externalLabels) + len(params) + len(extraLabels) + len(metaLabels))
|
||||
for k, v := range externalLabels {
|
||||
m[k] = v
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user