File tree Expand file tree Collapse file tree 4 files changed +12
-50
lines changed
sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore Expand file tree Collapse file tree 4 files changed +12
-50
lines changed Original file line number Diff line number Diff line change 2121* Fixed a bug in LiveMetrics that counted all manually created Dependencies as failures.
2222 ([ #45103 ] ( https://github.com/Azure/azure-sdk-for-net/pull/45103 ) )
2323
24+ * Fixed a bug in LiveMetrics that caused incorrect counts for telemetry.
25+ ([ #46429 ] ( https://github.com/Azure/azure-sdk-for-net/pull/46429 ) )
26+
2427### Other Changes
2528
2629* Updated the code of vendored resource detector library ` OpenTelemetry.Resources.Azure ` from the OpenTelemetry .NET contrib repository.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License.
33
4+ using System . Collections . Concurrent ;
45using Azure . Monitor . OpenTelemetry . AspNetCore . Models ;
56
67namespace Azure . Monitor . OpenTelemetry . AspNetCore . LiveMetrics . DataCollection
@@ -14,17 +15,17 @@ namespace Azure.Monitor.OpenTelemetry.AspNetCore.LiveMetrics.DataCollection
1415 /// </summary>
1516 internal class DoubleBuffer
1617 {
17- private DocumentBuffer _currentBuffer = new ( ) ;
18+ private ConcurrentQueue < DocumentIngress > _currentBuffer = new ( ) ;
1819
1920 public void WriteDocument ( DocumentIngress document )
2021 {
21- _currentBuffer . Add ( document ) ;
22+ _currentBuffer . Enqueue ( document ) ;
2223 }
2324
24- public DocumentBuffer FlipDocumentBuffers ( )
25+ public ConcurrentQueue < DocumentIngress > FlipDocumentBuffers ( )
2526 {
2627 // Atomically exchange the current buffer with a new empty buffer and return the old buffer
27- return Interlocked . Exchange ( ref _currentBuffer , new DocumentBuffer ( ) ) ;
28+ return Interlocked . Exchange ( ref _currentBuffer , new ConcurrentQueue < DocumentIngress > ( ) ) ;
2829 }
2930 }
3031}
Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License.
33
4+ using System . Collections . Concurrent ;
45using Azure . Monitor . OpenTelemetry . AspNetCore . LiveMetrics ;
56using Azure . Monitor . OpenTelemetry . AspNetCore . LiveMetrics . DataCollection ;
67using Azure . Monitor . OpenTelemetry . AspNetCore . LiveMetrics . Filtering ;
@@ -45,9 +46,10 @@ public MonitoringDataPoint GetDataPoint()
4546 string projectionError = string . Empty ;
4647 Dictionary < string , AccumulatedValues > metricAccumulators = CreateMetricAccumulators ( _collectionConfiguration ) ;
4748 LiveMetricsBuffer liveMetricsBuffer = new ( ) ;
48- DocumentBuffer filledBuffer = _documentBuffer . FlipDocumentBuffers ( ) ;
4949 IEnumerable < DocumentStream > documentStreams = _collectionConfiguration . DocumentStreams ;
50- foreach ( var item in filledBuffer . ReadAllAndClear ( ) )
50+
51+ ConcurrentQueue < DocumentIngress > filledBuffer = _documentBuffer . FlipDocumentBuffers ( ) ;
52+ while ( filledBuffer . TryDequeue ( out DocumentIngress ? item ) )
5153 {
5254 bool matchesDocumentStreamFilter = false ;
5355
You can’t perform that action at this time.
0 commit comments