@@ -352,10 +352,12 @@ internal void ExponentialHistogramTests(AggregationType aggregationType, Aggrega
352
352
var count = metricPoint . GetHistogramCount ( ) ;
353
353
var sum = metricPoint . GetHistogramSum ( ) ;
354
354
var hasMinMax = metricPoint . TryGetHistogramMinMaxValues ( out var min , out var max ) ;
355
+ var firstScale = metricPoint . GetExponentialHistogramData ( ) . Scale ;
355
356
356
357
AssertExponentialBucketsAreCorrect ( expectedHistogram , metricPoint . GetExponentialHistogramData ( ) ) ;
357
358
Assert . Equal ( 50 , sum ) ;
358
359
Assert . Equal ( 6 , count ) ;
360
+ Assert . True ( firstScale <= Metric . DefaultExponentialHistogramMaxScale , $ "The first scale value, { firstScale } , is greater than Metric.DefaultExponentialHistogramMaxScale.") ;
359
361
360
362
if ( aggregationType == AggregationType . Base2ExponentialHistogramWithMinMax )
361
363
{
@@ -373,12 +375,14 @@ internal void ExponentialHistogramTests(AggregationType aggregationType, Aggrega
373
375
count = metricPoint . GetHistogramCount ( ) ;
374
376
sum = metricPoint . GetHistogramSum ( ) ;
375
377
hasMinMax = metricPoint . TryGetHistogramMinMaxValues ( out min , out max ) ;
378
+ var secondScale = metricPoint . GetExponentialHistogramData ( ) . Scale ;
376
379
377
380
if ( aggregationTemporality == AggregationTemporality . Cumulative )
378
381
{
379
382
AssertExponentialBucketsAreCorrect ( expectedHistogram , metricPoint . GetExponentialHistogramData ( ) ) ;
380
383
Assert . Equal ( 50 , sum ) ;
381
384
Assert . Equal ( 6 , count ) ;
385
+ Assert . Equal ( firstScale , secondScale ) ;
382
386
383
387
if ( aggregationType == AggregationType . Base2ExponentialHistogramWithMinMax )
384
388
{
@@ -393,10 +397,11 @@ internal void ExponentialHistogramTests(AggregationType aggregationType, Aggrega
393
397
}
394
398
else
395
399
{
396
- expectedHistogram . Reset ( ) ;
400
+ expectedHistogram . Reset ( isMinMax : aggregationType == AggregationType . HistogramWithMinMax ) ;
397
401
AssertExponentialBucketsAreCorrect ( expectedHistogram , metricPoint . GetExponentialHistogramData ( ) ) ;
398
402
Assert . Equal ( 0 , sum ) ;
399
403
Assert . Equal ( 0 , count ) ;
404
+ Assert . Equal ( Metric . DefaultExponentialHistogramMaxScale , secondScale ) ;
400
405
401
406
if ( aggregationType == AggregationType . Base2ExponentialHistogramWithMinMax )
402
407
{
0 commit comments