Skip to content

Commit

Permalink
Test limit for last value
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Dec 6, 2023
1 parent 426b29d commit 3a59317
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion sdk/metric/internal/aggregate/lastvalue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ func TestLastValue(t *testing.T) {
}

func testLastValue[N int64 | float64]() func(*testing.T) {
in, out := Builder[N]{Filter: attrFltr}.LastValue()
in, out := Builder[N]{
Filter: attrFltr,
AggregationLimit: 3,
}.LastValue()
ctx := context.Background()
return test[N](in, out, []teststep[N]{
{
Expand Down Expand Up @@ -87,6 +90,36 @@ func testLastValue[N int64 | float64]() func(*testing.T) {
},
},
},
}, {
input: []arg[N]{
{ctx, 1, alice},
{ctx, 1, bob},
// These will exceed cardinality limit.
{ctx, 1, carol},
{ctx, 1, dave},
},
expect: output{
n: 3,
agg: metricdata.Gauge[N]{
DataPoints: []metricdata.DataPoint[N]{
{
Attributes: fltrAlice,
Time: staticTime,
Value: 1,
},
{
Attributes: fltrBob,
Time: staticTime,
Value: 1,
},
{
Attributes: overflowSet,
Time: staticTime,
Value: 1,
},
},
},
},
},
})
}
Expand Down

0 comments on commit 3a59317

Please sign in to comment.