experimental race free labels
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
dd71d9ec59
commit
8c4a73ddfa
@ -328,11 +328,13 @@ func (m *prometheusMeter) Set(opts ...meter.Option) meter.Meter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func labelMetric(labels []string) []*dto.LabelPair {
|
func labelMetric(labels []string) []*dto.LabelPair {
|
||||||
dtoLabels := make([]*dto.LabelPair, 0, len(labels)/2)
|
nl := make([]string, len(labels))
|
||||||
for idx := 0; idx < len(labels); idx += 2 {
|
copy(nl, labels)
|
||||||
|
dtoLabels := make([]*dto.LabelPair, 0, len(nl)/2)
|
||||||
|
for idx := 0; idx < len(nl); idx += 2 {
|
||||||
dtoLabels = append(dtoLabels, &dto.LabelPair{
|
dtoLabels = append(dtoLabels, &dto.LabelPair{
|
||||||
Name: &(labels[idx]),
|
Name: &(nl[idx]),
|
||||||
Value: &(labels[idx+1]),
|
Value: &(nl[idx+1]),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return dtoLabels
|
return dtoLabels
|
||||||
|
Loading…
Reference in New Issue
Block a user