mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
all: consistently clear prompbmarshal.Label by assigning an empty struct instead of zeroing Name and Value individually
This commit is contained in:
parent
90768aa418
commit
12f2c5679b
4 changed files with 5 additions and 13 deletions
|
@ -592,9 +592,7 @@ func GetLabelByName(labels []prompbmarshal.Label, name string) *prompbmarshal.La
|
||||||
// This should help GC cleaning up label.Name and label.Value strings.
|
// This should help GC cleaning up label.Name and label.Value strings.
|
||||||
func CleanLabels(labels []prompbmarshal.Label) {
|
func CleanLabels(labels []prompbmarshal.Label) {
|
||||||
for i := range labels {
|
for i := range labels {
|
||||||
label := &labels[i]
|
labels[i] = prompbmarshal.Label{}
|
||||||
label.Name = ""
|
|
||||||
label.Value = ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -736,11 +736,9 @@ func (wc *writeRequestCtx) resetNoRows() {
|
||||||
|
|
||||||
labels := wc.labels
|
labels := wc.labels
|
||||||
for i := range labels {
|
for i := range labels {
|
||||||
label := &labels[i]
|
labels[i] = prompbmarshal.Label{}
|
||||||
label.Name = ""
|
|
||||||
label.Value = ""
|
|
||||||
}
|
}
|
||||||
wc.labels = wc.labels[:0]
|
wc.labels = labels[:0]
|
||||||
|
|
||||||
wc.samples = wc.samples[:0]
|
wc.samples = wc.samples[:0]
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,9 +282,7 @@ func (x *Labels) RemoveLabelsWithDoubleUnderscorePrefix() {
|
||||||
|
|
||||||
func cleanLabels(labels []prompbmarshal.Label) {
|
func cleanLabels(labels []prompbmarshal.Label) {
|
||||||
for i := range labels {
|
for i := range labels {
|
||||||
label := &labels[i]
|
labels[i] = prompbmarshal.Label{}
|
||||||
label.Name = ""
|
|
||||||
label.Value = ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,9 +252,7 @@ func (wr *writeContext) reset() {
|
||||||
|
|
||||||
func resetLabels(labels []prompbmarshal.Label) []prompbmarshal.Label {
|
func resetLabels(labels []prompbmarshal.Label) []prompbmarshal.Label {
|
||||||
for i := range labels {
|
for i := range labels {
|
||||||
label := &labels[i]
|
labels[i] = prompbmarshal.Label{}
|
||||||
label.Name = ""
|
|
||||||
label.Value = ""
|
|
||||||
}
|
}
|
||||||
return labels[:0]
|
return labels[:0]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue