Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark metric test for UpDownCounter #2655

Merged
merged 35 commits into from
Jul 12, 2022
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ac81cd0
add benchmark metric test for UpDownCounter
hanyuancheung Mar 5, 2022
215b152
move counter annotation up
hanyuancheung Mar 7, 2022
047a887
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Mar 10, 2022
c9493cb
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Mar 14, 2022
bbff747
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Mar 19, 2022
d5323b0
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Mar 23, 2022
7df6a67
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Mar 24, 2022
9d4612d
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Mar 30, 2022
62c6505
fix syncFloat64 to syncInt64
hanyuancheung Mar 30, 2022
9ccb1b2
fix syncFloat64 to syncInt64
hanyuancheung Mar 30, 2022
040baa5
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 1, 2022
d526e55
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 5, 2022
88d8c03
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 6, 2022
d5324f0
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 7, 2022
415696e
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 8, 2022
93c1dd4
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 12, 2022
8ca8c72
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 15, 2022
80e9d94
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 17, 2022
065a5f1
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 20, 2022
7c62b81
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 25, 2022
b392c33
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 27, 2022
9521a86
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 28, 2022
1d48108
fix go-lint err
hanyuancheung Apr 28, 2022
ee67b2f
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Apr 29, 2022
cb0a054
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung May 5, 2022
1bd6eb7
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung May 9, 2022
dedf1b3
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung May 16, 2022
4d22543
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung May 20, 2022
0c34e3d
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung May 26, 2022
c2fe2db
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung May 30, 2022
c4fba18
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Jun 10, 2022
58a7bdf
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Jun 12, 2022
ffe1d64
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Jun 16, 2022
09d6fee
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Jul 2, 2022
33a11be
Merge branch 'main' into fix-benchmark-metric-test
hanyuancheung Jul 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions sdk/metric/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,39 @@ func (f *benchFixture) iCounter(name string) syncint64.Counter {
}
return ctr
}

func (f *benchFixture) fCounter(name string) syncfloat64.Counter {
ctr, err := f.meter.SyncFloat64().Counter(name)
if err != nil {
f.B.Error(err)
}
return ctr
}

func (f *benchFixture) iUpDownCounter(name string) syncint64.UpDownCounter {
ctr, err := f.meter.SyncInt64().UpDownCounter(name)
if err != nil {
f.B.Error(err)
}
return ctr
}

func (f *benchFixture) fUpDownCounter(name string) syncfloat64.UpDownCounter {
ctr, err := f.meter.SyncFloat64().UpDownCounter(name)
if err != nil {
f.B.Error(err)
}
return ctr
}

func (f *benchFixture) iHistogram(name string) syncint64.Histogram {
ctr, err := f.meter.SyncInt64().Histogram(name)
if err != nil {
f.B.Error(err)
}
return ctr
}

func (f *benchFixture) fHistogram(name string) syncfloat64.Histogram {
ctr, err := f.meter.SyncFloat64().Histogram(name)
if err != nil {
Expand Down Expand Up @@ -228,6 +247,34 @@ func BenchmarkFloat64CounterAdd(b *testing.B) {
}
}

// UpDownCounter

func BenchmarkInt64UpDownCounterAdd(b *testing.B) {
ctx := context.Background()
fix := newFixture(b)
labs := makeAttrs(1)
cnt := fix.iUpDownCounter("int64.sum")

b.ResetTimer()

for i := 0; i < b.N; i++ {
cnt.Add(ctx, 1, labs...)
}
}

func BenchmarkFloat64UpDownCounterAdd(b *testing.B) {
ctx := context.Background()
fix := newFixture(b)
labs := makeAttrs(1)
cnt := fix.fUpDownCounter("float64.sum")

b.ResetTimer()

for i := 0; i < b.N; i++ {
cnt.Add(ctx, 1.1, labs...)
}
}

// LastValue

func BenchmarkInt64LastValueAdd(b *testing.B) {
Expand Down