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 implementation of Sum aggregators #3000

Merged
merged 42 commits into from
Aug 4, 2022
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
405c377
Implement the sum aggregators
MrAlias Jul 7, 2022
a138c5f
Add unit tests for delta/cumulative sums
MrAlias Jul 7, 2022
4ba0c4c
Add benchmarks
MrAlias Jul 7, 2022
f4237c1
Merge sum tests into one
MrAlias Jul 7, 2022
1397f4c
Remove unused start time from cumulative sum
MrAlias Jul 7, 2022
31adb7f
Refactor benchmark tests
MrAlias Jul 7, 2022
3ad3c89
goimports
MrAlias Jul 8, 2022
4b78904
Move timestamp out of lock
MrAlias Jul 8, 2022
090fb3b
Refactor testing
MrAlias Jul 8, 2022
1166395
Fix spelling mistake
MrAlias Jul 8, 2022
0a01d06
Name param of expectFunc
MrAlias Jul 8, 2022
9e9a0ad
Reset delta sum to zero instead of delete
MrAlias Jul 8, 2022
2b1741b
Revert to deleting unused attr sets
MrAlias Jul 11, 2022
2399af3
Refactor testing to allow use across other aggs
MrAlias Jul 11, 2022
45b07ed
Add TODO to bound cumulative sum mem usage
MrAlias Jul 11, 2022
ee4ce7b
Fix misspelling
MrAlias Jul 11, 2022
f125d53
Merge branch 'new_sdk/main' into sum-agg-impl
MrAlias Jul 11, 2022
4311369
Unify aggregator benchmark code in aggregator_test
MrAlias Jul 11, 2022
02cdb3a
Merge branch 'new_sdk/main' into sum-agg-impl
MrAlias Jul 21, 2022
d483c2a
Use generic DataPoint value
MrAlias Jul 21, 2022
5f72d60
Fix assertion_fail_test.go
MrAlias Jul 22, 2022
b5732c0
Merge branch 'generic-metricdata' into sum-agg-impl
MrAlias Jul 22, 2022
17b4e8f
Use generic metricdata types
MrAlias Jul 22, 2022
e48ad68
Merge branch 'new_sdk/main' into sum-agg-impl
MrAlias Jul 25, 2022
dcbfd9a
Fix tests
MrAlias Jul 25, 2022
292898c
Fix benchmarks
MrAlias Jul 25, 2022
b911e60
Fix lint
MrAlias Jul 26, 2022
86971db
Merge branch 'new_sdk/main' into sum-agg-impl
MrAlias Jul 26, 2022
840ca2e
Update sum documentation
MrAlias Jul 26, 2022
bcf2fc5
Remove leftover encapsulating test run
MrAlias Jul 26, 2022
1fe3558
Use t.Cleanup to mock time
MrAlias Jul 26, 2022
16359dd
Merge branch 'new_sdk/main' into sum-agg-impl
MrAlias Jul 27, 2022
3c7a389
Consolidate expecter logic into funcs
MrAlias Jul 27, 2022
2745e1c
Move errNegVal closer to use
MrAlias Jul 27, 2022
c4ad8ac
Run the agg test
MrAlias Jul 27, 2022
e7b779f
Add tests for monotonic sum Aggregate err
MrAlias Jul 27, 2022
cfd7d87
Run make lint
MrAlias Jul 27, 2022
4db6b90
Make monotonic an arg of creation funcs
MrAlias Jul 27, 2022
f01d942
Remove Aggregate monotonic validation
MrAlias Jul 27, 2022
6fed240
Rename sum to valueMap
MrAlias Jul 27, 2022
b2486fa
Merge branch 'new_sdk/main' into sum-agg-impl
MrAlias Jul 28, 2022
672e8b2
Merge branch 'new_sdk/main' into sum-agg-impl
MrAlias Aug 2, 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
Prev Previous commit
Next Next commit
Merge sum tests into one
MrAlias committed Jul 7, 2022

Verified

This commit was signed with the committer’s verified signature.
MrAlias Tyler Yahn
commit f4237c18ca6d496df2c0f6ac377215b03f6d3a4f
32 changes: 18 additions & 14 deletions sdk/metric/internal/sum_test.go
Original file line number Diff line number Diff line change
@@ -117,20 +117,24 @@ func testCumulativeSum[N int64 | float64](t *testing.T, agg Aggregator[N]) {
check(t, want, agg.Aggregations())
}

func TestInt64DeltaSum(t *testing.T) {
testDeltaSum(t, NewDeltaSum[int64]())
}

func TestFloat64DeltaSum(t *testing.T) {
testDeltaSum(t, NewDeltaSum[float64]())
}

func TestInt64CumulativeSum(t *testing.T) {
testCumulativeSum(t, NewCumulativeSum[int64]())
}
func TestSum(t *testing.T) {
t.Run("Delta", func(t *testing.T) {
t.Run("Int64", func(t *testing.T) {
testDeltaSum(t, NewDeltaSum[int64]())
})
t.Run("Float64", func(t *testing.T) {
testDeltaSum(t, NewDeltaSum[float64]())
})
})

func TestFloat64CumulativeSum(t *testing.T) {
testCumulativeSum(t, NewCumulativeSum[float64]())
t.Run("Cumulative", func(t *testing.T) {
t.Run("Int64", func(t *testing.T) {
testCumulativeSum(t, NewCumulativeSum[int64]())
})
t.Run("Float64", func(t *testing.T) {
testCumulativeSum(t, NewCumulativeSum[float64]())
})
})
}

var aggsStore []Aggregation
@@ -141,8 +145,8 @@ func benchmarkAggregatorN[N int64 | float64](b *testing.B, agg Aggregator[N], co
attrs[i] = attribute.NewSet(attribute.Int("value", i))
}

b.ResetTimer()
b.ReportAllocs()
b.ResetTimer()

for n := 0; n < b.N; n++ {
for _, attr := range attrs {