File tree Expand file tree Collapse file tree 3 files changed +18
-11
lines changed Expand file tree Collapse file tree 3 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -765,7 +765,6 @@ protected void LogQosEvent()
765765 {
766766 _metricHelper . LogQoSEvent ( _qosEvent , IsUsageMetricEnabled , IsErrorMetricEnabled ) ;
767767 _metricHelper . FlushMetric ( ) ;
768- WriteDebug ( "Finish sending metric." ) ;
769768 }
770769 catch ( Exception e )
771770 {
Original file line number Diff line number Diff line change 6363 </ItemGroup >
6464
6565 <ItemGroup >
66- <PackageReference Include =" Microsoft.ApplicationInsights" Version =" 2.12.0 " />
66+ <PackageReference Include =" Microsoft.ApplicationInsights" Version =" 2.13.1 " />
6767 </ItemGroup >
6868
6969 <ItemGroup >
Original file line number Diff line number Diff line change 1616using Microsoft . ApplicationInsights . DataContracts ;
1717using Microsoft . ApplicationInsights . Extensibility ;
1818using Microsoft . Azure . Commands . Common ;
19- using Microsoft . Azure . Commands . Common . Authentication . Abstractions ;
2019using Microsoft . Azure . Commands . Common . Authentication ;
20+ using Microsoft . Azure . Commands . Common . Authentication . Abstractions ;
2121using Microsoft . Azure . PowerShell . Common . Share ;
2222using Microsoft . Rest . Azure ;
2323using Microsoft . WindowsAzure . Commands . Common . Utilities ;
3131using System . Management . Automation . Host ;
3232using System . Security . Cryptography ;
3333using System . Text ;
34+ using System . Threading . Tasks ;
3435
3536namespace Microsoft . WindowsAzure . Commands . Common
3637{
3738 public class MetricHelper
3839 {
3940 protected INetworkHelper _networkHelper ;
40- private const int FlushTimeoutInMilli = 5000 ;
4141 private const string DefaultPSVersion = "3.0.0.0" ;
4242 private const string EventName = "cmdletInvocation" ;
4343
@@ -481,17 +481,25 @@ public void FlushMetric()
481481 return ;
482482 }
483483
484- try
484+ Task flushMetricTask = FlushMetricAsync ( TelemetryClients ) ;
485+ }
486+
487+ private async Task FlushMetricAsync ( IEnumerable < TelemetryClient > TelemetryClients )
488+ {
489+ await Task . Run ( ( ) =>
485490 {
486491 foreach ( TelemetryClient client in TelemetryClients )
487492 {
488- client . Flush ( ) ;
493+ try
494+ {
495+ client . Flush ( ) ;
496+ }
497+ catch
498+ {
499+ // ignored
500+ }
489501 }
490- }
491- catch
492- {
493- // ignored
494- }
502+ } ) ;
495503 }
496504
497505 /// <summary>
You can’t perform that action at this time.
0 commit comments