You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-12-13 23:57:10 +02:00
Checkpoint only after Update; Keep records in the sync.Map longer (#647)
* Add a test * Benchmark * Ensure records can persist across intervals * Remove dead code * Address feedback, refactor & eliminate race
This commit is contained in:
@@ -555,7 +555,30 @@ func BenchmarkBatchRecord_8Labels_8Instruments(b *testing.B) {
|
||||
benchmarkBatchRecord8Labels(b, 8)
|
||||
}
|
||||
|
||||
// Record creation
|
||||
|
||||
func BenchmarkRepeatedDirectCalls(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
fix := newFixture(b)
|
||||
encoder := export.NewDefaultLabelEncoder()
|
||||
fix.pcb = func(_ context.Context, rec export.Record) error {
|
||||
_ = rec.Labels().Encoded(encoder)
|
||||
return nil
|
||||
}
|
||||
|
||||
c := fix.meter.NewInt64Counter("int64.counter")
|
||||
k := key.String("bench", "true")
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
c.Add(ctx, 1, k)
|
||||
fix.sdk.Collect(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// LabelIterator
|
||||
|
||||
func BenchmarkLabelIterator(b *testing.B) {
|
||||
const labelCount = 1024
|
||||
ctx := context.Background()
|
||||
|
||||
Reference in New Issue
Block a user