1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-28 21:09:17 +02:00

Use slices.Sort in Prometheus exporter instead of sort.Slice (#4988)

This commit is contained in:
Tyler Yahn 2024-02-28 22:13:41 -08:00 committed by GitHub
parent 7dea232a46
commit 32f3933456
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@ import (
"context"
"errors"
"fmt"
"sort"
"slices"
"strings"
"sync"
"unicode"
@ -313,9 +313,7 @@ func getAttrs(attrs attribute.Set, ks, vs [2]string, resourceKV keyVals) ([]stri
values := make([]string, 0, attrs.Len())
for key, vals := range keysMap {
keys = append(keys, key)
sort.Slice(vals, func(i, j int) bool {
return i < j
})
slices.Sort(vals)
values = append(values, strings.Join(vals, ";"))
}