You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-13 01:00:22 +02:00
Add a RecordBatch benchmark (#594)
This commit is contained in:
@ -528,3 +528,40 @@ func BenchmarkFloat64ArrayAdd(b *testing.B) {
|
|||||||
func BenchmarkFloat64ArrayHandleAdd(b *testing.B) {
|
func BenchmarkFloat64ArrayHandleAdd(b *testing.B) {
|
||||||
benchmarkFloat64MeasureHandleAdd(b, "float64.array")
|
benchmarkFloat64MeasureHandleAdd(b, "float64.array")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BatchRecord
|
||||||
|
|
||||||
|
func benchmarkBatchRecord8Labels(b *testing.B, numInst int) {
|
||||||
|
const numLabels = 8
|
||||||
|
ctx := context.Background()
|
||||||
|
fix := newFixture(b)
|
||||||
|
labs := makeLabels(numLabels)
|
||||||
|
var meas []metric.Measurement
|
||||||
|
|
||||||
|
for i := 0; i < numInst; i++ {
|
||||||
|
inst := fix.meter.NewInt64Counter(fmt.Sprint("int64.counter.", i))
|
||||||
|
meas = append(meas, inst.Measurement(1))
|
||||||
|
}
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
fix.sdk.RecordBatch(ctx, fix.sdk.Labels(labs...), meas...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func BenchmarkBatchRecord8Labels_1Instrument(b *testing.B) {
|
||||||
|
benchmarkBatchRecord8Labels(b, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BenchmarkBatchRecord_8Labels_2Instruments(b *testing.B) {
|
||||||
|
benchmarkBatchRecord8Labels(b, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BenchmarkBatchRecord_8Labels_4Instruments(b *testing.B) {
|
||||||
|
benchmarkBatchRecord8Labels(b, 4)
|
||||||
|
}
|
||||||
|
|
||||||
|
func BenchmarkBatchRecord_8Labels_8Instruments(b *testing.B) {
|
||||||
|
benchmarkBatchRecord8Labels(b, 8)
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user