Add a benchmark for addExtraLabels function
This commit is contained in:
parent
3515499561
commit
5710165c4b
@ -26,7 +26,7 @@ bar{foo="bar",a="x"} 2
|
||||
foo 1
|
||||
# some counter
|
||||
# type foobar counter
|
||||
foobar{a="b",c="d"} 4`, `x="y"`, `foo{x="y"} 1
|
||||
foobar{a="b",c="d"} 4`, `x="y"`, `foo{x="y"} 1
|
||||
# some counter
|
||||
# type foobar counter
|
||||
foobar{x="y",a="b",c="d"} 4
|
||||
|
20
push_timing_test.go
Normal file
20
push_timing_test.go
Normal file
@ -0,0 +1,20 @@
|
||||
package metrics
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func BenchmarkAddExtraLabels(b *testing.B) {
|
||||
extraLabels := `foo="bar"`
|
||||
src := []byte(`foo 1
|
||||
bar{baz="x"} 2
|
||||
`)
|
||||
b.ReportAllocs()
|
||||
b.SetBytes(1)
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
var dst []byte
|
||||
for pb.Next() {
|
||||
dst = addExtraLabels(dst[:0], src, extraLabels)
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user