@@ -84,9 +84,9 @@ describe('Meter', () => {
84
84
meter . collect ( ) ;
85
85
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
86
86
87
- assert . strictEqual ( record1 . aggregator . value ( ) , 10 ) ;
87
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 10 ) ;
88
88
counter . add ( 10 , labelSet ) ;
89
- assert . strictEqual ( record1 . aggregator . value ( ) , 20 ) ;
89
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 20 ) ;
90
90
} ) ;
91
91
92
92
it ( 'should return counter with resource' , ( ) => {
@@ -102,9 +102,9 @@ describe('Meter', () => {
102
102
meter . collect ( ) ;
103
103
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
104
104
105
- assert . strictEqual ( record1 . aggregator . value ( ) , 10 ) ;
105
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 10 ) ;
106
106
boundCounter . add ( 10 ) ;
107
- assert . strictEqual ( record1 . aggregator . value ( ) , 20 ) ;
107
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 20 ) ;
108
108
} ) ;
109
109
110
110
it ( 'should return the aggregator' , ( ) => {
@@ -123,9 +123,9 @@ describe('Meter', () => {
123
123
meter . collect ( ) ;
124
124
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
125
125
126
- assert . strictEqual ( record1 . aggregator . value ( ) , 10 ) ;
126
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 10 ) ;
127
127
boundCounter . add ( - 100 ) ;
128
- assert . strictEqual ( record1 . aggregator . value ( ) , 10 ) ;
128
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 10 ) ;
129
129
} ) ;
130
130
131
131
it ( 'should not add the instrument data when disabled' , ( ) => {
@@ -136,7 +136,7 @@ describe('Meter', () => {
136
136
boundCounter . add ( 10 ) ;
137
137
meter . collect ( ) ;
138
138
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
139
- assert . strictEqual ( record1 . aggregator . value ( ) , 0 ) ;
139
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 0 ) ;
140
140
} ) ;
141
141
142
142
it ( 'should add negative value when monotonic is set to false' , ( ) => {
@@ -147,7 +147,7 @@ describe('Meter', () => {
147
147
boundCounter . add ( - 10 ) ;
148
148
meter . collect ( ) ;
149
149
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
150
- assert . strictEqual ( record1 . aggregator . value ( ) , - 10 ) ;
150
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , - 10 ) ;
151
151
} ) ;
152
152
153
153
it ( 'should return same instrument on same label values' , ( ) => {
@@ -159,7 +159,7 @@ describe('Meter', () => {
159
159
meter . collect ( ) ;
160
160
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
161
161
162
- assert . strictEqual ( record1 . aggregator . value ( ) , 20 ) ;
162
+ assert . strictEqual ( record1 . aggregator . toPoint ( ) . value , 20 ) ;
163
163
assert . strictEqual ( boundCounter , boundCounter1 ) ;
164
164
} ) ;
165
165
} ) ;
@@ -214,7 +214,7 @@ describe('Meter', () => {
214
214
unit : '1' ,
215
215
valueType : ValueType . DOUBLE ,
216
216
} ) ;
217
- assert . strictEqual ( record [ 0 ] . aggregator . value ( ) , 10 ) ;
217
+ assert . strictEqual ( record [ 0 ] . aggregator . toPoint ( ) . value , 10 ) ;
218
218
} ) ;
219
219
} ) ;
220
220
@@ -319,12 +319,15 @@ describe('Meter', () => {
319
319
320
320
meter . collect ( ) ;
321
321
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
322
- assert . deepStrictEqual ( record1 . aggregator . value ( ) as Distribution , {
323
- count : 0 ,
324
- max : - Infinity ,
325
- min : Infinity ,
326
- sum : 0 ,
327
- } ) ;
322
+ assert . deepStrictEqual (
323
+ record1 . aggregator . toPoint ( ) . value as Distribution ,
324
+ {
325
+ count : 0 ,
326
+ max : - Infinity ,
327
+ min : Infinity ,
328
+ sum : 0 ,
329
+ }
330
+ ) ;
328
331
} ) ;
329
332
330
333
it ( 'should not set the instrument data when disabled' , ( ) => {
@@ -336,12 +339,15 @@ describe('Meter', () => {
336
339
337
340
meter . collect ( ) ;
338
341
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
339
- assert . deepStrictEqual ( record1 . aggregator . value ( ) as Distribution , {
340
- count : 0 ,
341
- max : - Infinity ,
342
- min : Infinity ,
343
- sum : 0 ,
344
- } ) ;
342
+ assert . deepStrictEqual (
343
+ record1 . aggregator . toPoint ( ) . value as Distribution ,
344
+ {
345
+ count : 0 ,
346
+ max : - Infinity ,
347
+ min : Infinity ,
348
+ sum : 0 ,
349
+ }
350
+ ) ;
345
351
} ) ;
346
352
347
353
it ( 'should accept negative (and positive) values when absolute is set to false' , ( ) => {
@@ -354,12 +360,15 @@ describe('Meter', () => {
354
360
355
361
meter . collect ( ) ;
356
362
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
357
- assert . deepStrictEqual ( record1 . aggregator . value ( ) as Distribution , {
358
- count : 2 ,
359
- max : 50 ,
360
- min : - 10 ,
361
- sum : 40 ,
362
- } ) ;
363
+ assert . deepStrictEqual (
364
+ record1 . aggregator . toPoint ( ) . value as Distribution ,
365
+ {
366
+ count : 2 ,
367
+ max : 50 ,
368
+ min : - 10 ,
369
+ sum : 40 ,
370
+ }
371
+ ) ;
363
372
} ) ;
364
373
365
374
it ( 'should return same instrument on same label values' , ( ) => {
@@ -370,12 +379,15 @@ describe('Meter', () => {
370
379
boundMeasure2 . record ( 100 ) ;
371
380
meter . collect ( ) ;
372
381
const [ record1 ] = meter . getBatcher ( ) . checkPointSet ( ) ;
373
- assert . deepStrictEqual ( record1 . aggregator . value ( ) as Distribution , {
374
- count : 2 ,
375
- max : 100 ,
376
- min : 10 ,
377
- sum : 110 ,
378
- } ) ;
382
+ assert . deepStrictEqual (
383
+ record1 . aggregator . toPoint ( ) . value as Distribution ,
384
+ {
385
+ count : 2 ,
386
+ max : 100 ,
387
+ min : 10 ,
388
+ sum : 110 ,
389
+ }
390
+ ) ;
379
391
assert . strictEqual ( boundMeasure1 , boundMeasure2 ) ;
380
392
} ) ;
381
393
} ) ;
@@ -500,7 +512,7 @@ describe('Meter', () => {
500
512
labelKeys : [ 'key' ] ,
501
513
} ) ;
502
514
assert . strictEqual ( record [ 0 ] . labels , labelSet ) ;
503
- const value = record [ 0 ] . aggregator . value ( ) as Sum ;
515
+ const value = record [ 0 ] . aggregator . toPoint ( ) . value as Sum ;
504
516
assert . strictEqual ( value , 10.45 ) ;
505
517
} ) ;
506
518
@@ -529,16 +541,22 @@ describe('Meter', () => {
529
541
labelKeys : [ 'key' ] ,
530
542
} ) ;
531
543
assert . strictEqual ( record [ 0 ] . labels , labelSet ) ;
532
- const value = record [ 0 ] . aggregator . value ( ) as Sum ;
544
+ const value = record [ 0 ] . aggregator . toPoint ( ) . value as Sum ;
533
545
assert . strictEqual ( value , 10 ) ;
534
546
} ) ;
535
547
} ) ;
536
548
} ) ;
537
549
538
550
function ensureMetric ( metric : MetricRecord ) {
539
551
assert . ok ( metric . aggregator instanceof ObserverAggregator ) ;
540
- assert . ok ( metric . aggregator . value ( ) >= 0 && metric . aggregator . value ( ) <= 1 ) ;
541
- assert . ok ( metric . aggregator . value ( ) >= 0 && metric . aggregator . value ( ) <= 1 ) ;
552
+ assert . ok (
553
+ metric . aggregator . toPoint ( ) . value >= 0 &&
554
+ metric . aggregator . toPoint ( ) . value <= 1
555
+ ) ;
556
+ assert . ok (
557
+ metric . aggregator . toPoint ( ) . value >= 0 &&
558
+ metric . aggregator . toPoint ( ) . value <= 1
559
+ ) ;
542
560
const descriptor = metric . descriptor ;
543
561
assert . strictEqual ( descriptor . name , 'name' ) ;
544
562
assert . strictEqual ( descriptor . description , 'desc' ) ;
0 commit comments