@@ -29,9 +29,8 @@ import { InstrumentDescriptor, InstrumentType } from '../InstrumentDescriptor';
29
29
import { Maybe } from '../utils' ;
30
30
import { AggregationTemporality } from '../export/AggregationTemporality' ;
31
31
import { Buckets } from './exponential-histogram/Buckets' ;
32
+ import { getMapping } from './exponential-histogram/mapping/getMapping' ;
32
33
import { Mapping } from './exponential-histogram/mapping/types' ;
33
- import { ExponentMapping } from './exponential-histogram/mapping/ExponentMapping' ;
34
- import { LogarithmMapping } from './exponential-histogram/mapping/LogarithmMapping' ;
35
34
import * as util from './exponential-histogram//util' ;
36
35
37
36
/**
@@ -66,13 +65,14 @@ class HighLow {
66
65
constructor ( public low : number , public high : number ) { }
67
66
}
68
67
69
- export class ExponentialHistogramAccumulation implements Accumulation {
70
- static DEFAULT_MAX_SIZE = 160 ;
71
- static MIN_MAX_SIZE = 2 ;
68
+ const MAX_SCALE = 20 ;
69
+ const DEFAULT_MAX_SIZE = 160 ;
70
+ const MIN_MAX_SIZE = 2 ;
72
71
72
+ export class ExponentialHistogramAccumulation implements Accumulation {
73
73
constructor (
74
74
public startTime : HrTime = startTime ,
75
- private _maxSize = ExponentialHistogramAccumulation . DEFAULT_MAX_SIZE ,
75
+ private _maxSize = DEFAULT_MAX_SIZE ,
76
76
private _recordMinMax = true ,
77
77
private _sum = 0 ,
78
78
private _count = 0 ,
@@ -81,13 +81,12 @@ export class ExponentialHistogramAccumulation implements Accumulation {
81
81
private _max = Number . NEGATIVE_INFINITY ,
82
82
private _positive = new Buckets ( ) ,
83
83
private _negative = new Buckets ( ) ,
84
- private _mapping : Mapping = LogarithmMapping . get ( LogarithmMapping . MAX_SCALE )
84
+ private _mapping : Mapping = getMapping ( MAX_SCALE )
85
85
) {
86
- if ( this . _maxSize < ExponentialHistogramAccumulation . MIN_MAX_SIZE ) {
86
+ if ( this . _maxSize < MIN_MAX_SIZE ) {
87
87
diag . warn ( `Exponential Histogram Max Size set to ${ this . _maxSize } , \
88
- changing to the minimum size of: \
89
- ${ ExponentialHistogramAccumulation . MIN_MAX_SIZE } ` ) ;
90
- this . _maxSize = ExponentialHistogramAccumulation . MIN_MAX_SIZE ;
88
+ changing to the minimum size of: ${ MIN_MAX_SIZE } ` ) ;
89
+ this . _maxSize = MIN_MAX_SIZE ;
91
90
}
92
91
}
93
92
@@ -419,11 +418,7 @@ export class ExponentialHistogramAccumulation implements Accumulation {
419
418
this . _positive . downscale ( change ) ;
420
419
this . _negative . downscale ( change ) ;
421
420
422
- if ( newScale <= 0 ) {
423
- this . _mapping = ExponentMapping . get ( newScale ) ;
424
- } else {
425
- this . _mapping = LogarithmMapping . get ( newScale ) ;
426
- }
421
+ this . _mapping = getMapping ( newScale ) ;
427
422
}
428
423
429
424
/**
0 commit comments