@@ -221,14 +221,7 @@ internal void SnapshotDelta(int indexSnapshot)
221221 continue ;
222222 }
223223
224- if ( this . IsExemplarEnabled ( ) )
225- {
226- metricPoint . TakeSnapshotWithExemplar ( outputDelta : true ) ;
227- }
228- else
229- {
230- metricPoint . TakeSnapshot ( outputDelta : true ) ;
231- }
224+ this . TakeMetricPointSnapshot ( ref metricPoint , outputDelta : true ) ;
232225
233226 this . currentMetricPointBatch [ this . batchSize ] = i ;
234227 this . batchSize ++ ;
@@ -246,14 +239,7 @@ internal void SnapshotDeltaWithMetricPointReclaim()
246239 ref var metricPointWithNoTags = ref this . metricPoints [ 0 ] ;
247240 if ( metricPointWithNoTags . MetricPointStatus != MetricPointStatus . NoCollectPending )
248241 {
249- if ( this . IsExemplarEnabled ( ) )
250- {
251- metricPointWithNoTags . TakeSnapshotWithExemplar ( outputDelta : true ) ;
252- }
253- else
254- {
255- metricPointWithNoTags . TakeSnapshot ( outputDelta : true ) ;
256- }
242+ this . TakeMetricPointSnapshot ( ref metricPointWithNoTags , outputDelta : true ) ;
257243
258244 this . currentMetricPointBatch [ this . batchSize ] = 0 ;
259245 this . batchSize ++ ;
@@ -265,14 +251,7 @@ internal void SnapshotDeltaWithMetricPointReclaim()
265251 ref var metricPointForOverflow = ref this . metricPoints [ 1 ] ;
266252 if ( metricPointForOverflow . MetricPointStatus != MetricPointStatus . NoCollectPending )
267253 {
268- if ( this . IsExemplarEnabled ( ) )
269- {
270- metricPointForOverflow . TakeSnapshotWithExemplar ( outputDelta : true ) ;
271- }
272- else
273- {
274- metricPointForOverflow . TakeSnapshot ( outputDelta : true ) ;
275- }
254+ this . TakeMetricPointSnapshot ( ref metricPointForOverflow , outputDelta : true ) ;
276255
277256 this . currentMetricPointBatch [ this . batchSize ] = 1 ;
278257 this . batchSize ++ ;
@@ -329,14 +308,7 @@ internal void SnapshotDeltaWithMetricPointReclaim()
329308 continue ;
330309 }
331310
332- if ( this . IsExemplarEnabled ( ) )
333- {
334- metricPoint . TakeSnapshotWithExemplar ( outputDelta : true ) ;
335- }
336- else
337- {
338- metricPoint . TakeSnapshot ( outputDelta : true ) ;
339- }
311+ this . TakeMetricPointSnapshot ( ref metricPoint , outputDelta : true ) ;
340312
341313 this . currentMetricPointBatch [ this . batchSize ] = i ;
342314 this . batchSize ++ ;
@@ -358,14 +330,7 @@ internal void SnapshotCumulative(int indexSnapshot)
358330 continue ;
359331 }
360332
361- if ( this . IsExemplarEnabled ( ) )
362- {
363- metricPoint . TakeSnapshotWithExemplar ( outputDelta : false ) ;
364- }
365- else
366- {
367- metricPoint . TakeSnapshot ( outputDelta : false ) ;
368- }
333+ this . TakeMetricPointSnapshot ( ref metricPoint , outputDelta : false ) ;
369334
370335 this . currentMetricPointBatch [ this . batchSize ] = i ;
371336 this . batchSize ++ ;
@@ -395,6 +360,18 @@ private static double[] FindDefaultHistogramBounds(in MetricStreamIdentity metri
395360 return Metric . DefaultHistogramBounds ;
396361 }
397362
363+ private void TakeMetricPointSnapshot ( ref MetricPoint metricPoint , bool outputDelta )
364+ {
365+ if ( this . IsExemplarEnabled ( ) )
366+ {
367+ metricPoint . TakeSnapshotWithExemplar ( outputDelta ) ;
368+ }
369+ else
370+ {
371+ metricPoint . TakeSnapshot ( outputDelta ) ;
372+ }
373+ }
374+
398375 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
399376 private void InitializeZeroTagPointIfNotInitialized ( )
400377 {
0 commit comments