@@ -29,16 +29,15 @@ public abstract class AggregatorTestsBase
2929 private static readonly MetricStreamIdentity MetricStreamIdentity = new ( Instrument , HistogramConfiguration ) ;
3030
3131 private readonly bool emitOverflowAttribute ;
32+ private readonly bool shouldReclaimUnusedMetricPoints ;
3233 private readonly AggregatorStore aggregatorStore ;
3334
34- protected AggregatorTestsBase ( bool emitOverflowAttribute )
35+ protected AggregatorTestsBase ( bool emitOverflowAttribute , bool shouldReclaimUnusedMetricPoints )
3536 {
36- if ( emitOverflowAttribute )
37- {
38- this . emitOverflowAttribute = emitOverflowAttribute ;
39- }
37+ this . emitOverflowAttribute = emitOverflowAttribute ;
38+ this . shouldReclaimUnusedMetricPoints = shouldReclaimUnusedMetricPoints ;
4039
41- this . aggregatorStore = new ( MetricStreamIdentity , AggregationType . HistogramWithBuckets , AggregationTemporality . Cumulative , 1024 , emitOverflowAttribute ) ;
40+ this . aggregatorStore = new ( MetricStreamIdentity , AggregationType . HistogramWithBuckets , AggregationTemporality . Cumulative , 1024 , emitOverflowAttribute , this . shouldReclaimUnusedMetricPoints ) ;
4241 }
4342
4443 [ Fact ]
@@ -268,7 +267,8 @@ public void HistogramBucketsDefaultUpdatesForSecondsTest(string meterName, strin
268267 AggregationType . Histogram ,
269268 AggregationTemporality . Cumulative ,
270269 maxMetricPoints : 1024 ,
271- this . emitOverflowAttribute ) ;
270+ this . emitOverflowAttribute ,
271+ this . shouldReclaimUnusedMetricPoints ) ;
272272
273273 KnownHistogramBuckets actualHistogramBounds = KnownHistogramBuckets . Default ;
274274 if ( aggregatorStore . HistogramBounds == Metric . DefaultHistogramBoundsShortSeconds )
@@ -345,6 +345,7 @@ internal void ExponentialHistogramTests(AggregationType aggregationType, Aggrega
345345 aggregationTemporality ,
346346 maxMetricPoints : 1024 ,
347347 this . emitOverflowAttribute ,
348+ this . shouldReclaimUnusedMetricPoints ,
348349 exemplarsEnabled ? new AlwaysOnExemplarFilter ( ) : null ) ;
349350
350351 var expectedHistogram = new Base2ExponentialBucketHistogram ( ) ;
@@ -453,7 +454,8 @@ internal void ExponentialMaxScaleConfigWorks(int? maxScale)
453454 AggregationType . Base2ExponentialHistogram ,
454455 AggregationTemporality . Cumulative ,
455456 maxMetricPoints : 1024 ,
456- this . emitOverflowAttribute ) ;
457+ this . emitOverflowAttribute ,
458+ this . shouldReclaimUnusedMetricPoints ) ;
457459
458460 aggregatorStore . Update ( 10 , Array . Empty < KeyValuePair < string , object > > ( ) ) ;
459461
@@ -529,15 +531,31 @@ private class ThreadArguments
529531public class AggregatorTests : AggregatorTestsBase
530532{
531533 public AggregatorTests ( )
532- : base ( false )
534+ : base ( emitOverflowAttribute : false , shouldReclaimUnusedMetricPoints : false )
533535 {
534536 }
535537}
536538
537539public class AggregatorTestsWithOverflowAttribute : AggregatorTestsBase
538540{
539541 public AggregatorTestsWithOverflowAttribute ( )
540- : base ( true )
542+ : base ( emitOverflowAttribute : true , shouldReclaimUnusedMetricPoints : false )
543+ {
544+ }
545+ }
546+
547+ public class AggregatorTestsWithReclaimAttribute : AggregatorTestsBase
548+ {
549+ public AggregatorTestsWithReclaimAttribute ( )
550+ : base ( emitOverflowAttribute : false , shouldReclaimUnusedMetricPoints : true )
551+ {
552+ }
553+ }
554+
555+ public class AggregatorTestsWithBothReclaimAndOverflowAttributes : AggregatorTestsBase
556+ {
557+ public AggregatorTestsWithBothReclaimAndOverflowAttributes ( )
558+ : base ( emitOverflowAttribute : true , shouldReclaimUnusedMetricPoints : true )
541559 {
542560 }
543561}
0 commit comments