mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
fix build for stringlabels tag
Signed-off-by: Nicolás Pazos <npazosmendez@gmail.com>
This commit is contained in:
parent
fbdbf2ccbd
commit
04fe4bfb20
|
@ -819,11 +819,6 @@ func labelsToLabelRefsProto(lbls labels.Labels, pool *lookupPool, buf []prompb.L
|
||||||
|
|
||||||
func labelsToUint32Slice(lbls labels.Labels, symbolTable *rwSymbolTable, buf []uint32) []uint32 {
|
func labelsToUint32Slice(lbls labels.Labels, symbolTable *rwSymbolTable, buf []uint32) []uint32 {
|
||||||
result := buf[:0]
|
result := buf[:0]
|
||||||
// ensure slice capacity
|
|
||||||
if cap(result)-len(result) < len(lbls)*2 {
|
|
||||||
result = append(make([]uint32, 0, len(lbls)*2), result...)
|
|
||||||
}
|
|
||||||
|
|
||||||
lbls.Range(func(l labels.Label) {
|
lbls.Range(func(l labels.Label) {
|
||||||
result = append(result, symbolTable.Ref(l.Name))
|
result = append(result, symbolTable.Ref(l.Name))
|
||||||
result = append(result, symbolTable.Ref(l.Value))
|
result = append(result, symbolTable.Ref(l.Value))
|
||||||
|
@ -832,7 +827,7 @@ func labelsToUint32Slice(lbls labels.Labels, symbolTable *rwSymbolTable, buf []u
|
||||||
}
|
}
|
||||||
|
|
||||||
func Uint32RefToLabels(symbols string, minLabels []uint32) labels.Labels {
|
func Uint32RefToLabels(symbols string, minLabels []uint32) labels.Labels {
|
||||||
ls := make(labels.Labels, 0, len(minLabels)/2)
|
ls := labels.NewScratchBuilder(len(minLabels) / 2)
|
||||||
|
|
||||||
labelIdx := 0
|
labelIdx := 0
|
||||||
for labelIdx < len(minLabels) {
|
for labelIdx < len(minLabels) {
|
||||||
|
@ -844,11 +839,11 @@ func Uint32RefToLabels(symbols string, minLabels []uint32) labels.Labels {
|
||||||
offset, length = unpackRef(minLabels[labelIdx+1])
|
offset, length = unpackRef(minLabels[labelIdx+1])
|
||||||
|
|
||||||
value := symbols[offset : offset+length]
|
value := symbols[offset : offset+length]
|
||||||
ls = append(ls, labels.Label{Name: name, Value: value})
|
ls.Add(name, value)
|
||||||
labelIdx += 2
|
labelIdx += 2
|
||||||
}
|
}
|
||||||
|
|
||||||
return ls
|
return ls.Labels()
|
||||||
}
|
}
|
||||||
|
|
||||||
// metricTypeToMetricTypeProto transforms a Prometheus metricType into prompb metricType. Since the former is a string we need to transform it to an enum.
|
// metricTypeToMetricTypeProto transforms a Prometheus metricType into prompb metricType. Since the former is a string we need to transform it to an enum.
|
||||||
|
|
Loading…
Reference in a new issue