1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-01-03 22:52:30 +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" "context"
"errors" "errors"
"fmt" "fmt"
"sort" "slices"
"strings" "strings"
"sync" "sync"
"unicode" "unicode"
@ -313,9 +313,7 @@ func getAttrs(attrs attribute.Set, ks, vs [2]string, resourceKV keyVals) ([]stri
values := make([]string, 0, attrs.Len()) values := make([]string, 0, attrs.Len())
for key, vals := range keysMap { for key, vals := range keysMap {
keys = append(keys, key) keys = append(keys, key)
sort.Slice(vals, func(i, j int) bool { slices.Sort(vals)
return i < j
})
values = append(values, strings.Join(vals, ";")) values = append(values, strings.Join(vals, ";"))
} }