1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-10 09:50:58 +02:00

fix b3 propagation benchmark to include iterations. (#212)

also include byte allocation report.
 rename file to match http_trace_context propagator.
This commit is contained in:
rghetia 2019-10-15 13:12:56 -07:00 committed by GitHub
parent 388d3248fe
commit 7e5fc4e6aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,9 +62,11 @@ func BenchmarkExtractB3(b *testing.B) {
for h, v := range tt.headers {
req.Header.Set(h, v)
}
b.ReportAllocs()
b.ResetTimer()
_ = propagator.Extract(ctx, req.Header)
for i := 0; i < b.N; i++ {
_ = propagator.Extract(ctx, req.Header)
}
})
}
}
@ -107,9 +109,11 @@ func BenchmarkInjectB3(b *testing.B) {
} else {
ctx, _ = mockTracer.Start(ctx, "inject")
}
b.ReportAllocs()
b.ResetTimer()
propagator.Inject(ctx, req.Header)
for i := 0; i < b.N; i++ {
propagator.Inject(ctx, req.Header)
}
})
}
}