@@ -221,14 +221,7 @@ internal void SnapshotDelta(int indexSnapshot)
221
221
continue ;
222
222
}
223
223
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 ) ;
232
225
233
226
this . currentMetricPointBatch [ this . batchSize ] = i ;
234
227
this . batchSize ++ ;
@@ -246,14 +239,7 @@ internal void SnapshotDeltaWithMetricPointReclaim()
246
239
ref var metricPointWithNoTags = ref this . metricPoints [ 0 ] ;
247
240
if ( metricPointWithNoTags . MetricPointStatus != MetricPointStatus . NoCollectPending )
248
241
{
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 ) ;
257
243
258
244
this . currentMetricPointBatch [ this . batchSize ] = 0 ;
259
245
this . batchSize ++ ;
@@ -265,14 +251,7 @@ internal void SnapshotDeltaWithMetricPointReclaim()
265
251
ref var metricPointForOverflow = ref this . metricPoints [ 1 ] ;
266
252
if ( metricPointForOverflow . MetricPointStatus != MetricPointStatus . NoCollectPending )
267
253
{
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 ) ;
276
255
277
256
this . currentMetricPointBatch [ this . batchSize ] = 1 ;
278
257
this . batchSize ++ ;
@@ -329,14 +308,7 @@ internal void SnapshotDeltaWithMetricPointReclaim()
329
308
continue ;
330
309
}
331
310
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 ) ;
340
312
341
313
this . currentMetricPointBatch [ this . batchSize ] = i ;
342
314
this . batchSize ++ ;
@@ -358,14 +330,7 @@ internal void SnapshotCumulative(int indexSnapshot)
358
330
continue ;
359
331
}
360
332
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 ) ;
369
334
370
335
this . currentMetricPointBatch [ this . batchSize ] = i ;
371
336
this . batchSize ++ ;
@@ -395,6 +360,18 @@ private static double[] FindDefaultHistogramBounds(in MetricStreamIdentity metri
395
360
return Metric . DefaultHistogramBounds ;
396
361
}
397
362
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
+
398
375
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
399
376
private void InitializeZeroTagPointIfNotInitialized ( )
400
377
{
0 commit comments