mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 08:42:15 +08:00
Revert "Prometheus: Reduce allocations parsing exemplars" (#66367)
Revert "Prometheus: Reduce allocations parsing exemplars (#58959)" This reverts commit a1f2d0e20582e3773ac623c5e0d55300fdbdc620.
This commit is contained in:
@ -41,7 +41,6 @@ func BenchmarkExemplarJson(b *testing.B) {
|
||||
tCtx, err := setup(true)
|
||||
require.NoError(b, err)
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
for n := 0; n < b.N; n++ {
|
||||
res := http.Response{
|
||||
StatusCode: 200,
|
||||
|
@ -228,8 +228,8 @@ func readArrayData(iter *jsoniter.Iterator) backend.DataResponse {
|
||||
}
|
||||
|
||||
// For consistent ordering read values to an array not a map
|
||||
func readLabelsAsPairs(iter *jsoniter.Iterator, pairs [][2]string) [][2]string {
|
||||
pairs = pairs[:0]
|
||||
func readLabelsAsPairs(iter *jsoniter.Iterator) [][2]string {
|
||||
pairs := make([][2]string, 0, 10)
|
||||
for k := iter.ReadObject(); k != ""; k = iter.ReadObject() {
|
||||
pairs = append(pairs, [2]string{k, iter.ReadString()})
|
||||
}
|
||||
@ -270,7 +270,7 @@ func readLabelsOrExemplars(iter *jsoniter.Iterator) (*data.Frame, [][2]string) {
|
||||
|
||||
case "labels":
|
||||
max := 0
|
||||
for _, pair := range readLabelsAsPairs(iter, pairs) {
|
||||
for _, pair := range readLabelsAsPairs(iter) {
|
||||
k := pair[0]
|
||||
v := pair[1]
|
||||
f, ok := lookup[k]
|
||||
@ -305,7 +305,6 @@ func readLabelsOrExemplars(iter *jsoniter.Iterator) (*data.Frame, [][2]string) {
|
||||
}
|
||||
default:
|
||||
v := fmt.Sprintf("%v", iter.Read())
|
||||
pairs = pairs[:0]
|
||||
pairs = append(pairs, [2]string{l1Field, v})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user