Skip to content

Commit b117855

Browse files
authored
Upgrade Microsoft.ApplicationInsights from 2.4.0 to 2.12.0 (#276)
1 parent 98a1ebd commit b117855

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/Common/AzurePSCmdlet.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using Microsoft.ApplicationInsights;
1615
using Microsoft.Azure.Commands.Common.Authentication;
1716
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
17+
using Microsoft.Azure.PowerShell.Common.Share.Survey;
1818
using Microsoft.Azure.ServiceManagement.Common.Models;
1919
using Microsoft.WindowsAzure.Commands.Common;
2020
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
21-
using Microsoft.Azure.PowerShell.Common.Share.Survey;
2221
using System;
2322
using System.Collections.Concurrent;
2423
using System.Collections.Generic;
@@ -353,10 +352,7 @@ protected override void BeginProcessing()
353352
if (_metricHelper == null)
354353
{
355354
_metricHelper = new MetricHelper(profile);
356-
_metricHelper.AddTelemetryClient(new TelemetryClient
357-
{
358-
InstrumentationKey = "7df6ff70-8353-4672-80d6-568517fed090"
359-
});
355+
_metricHelper.AddDefaultTelemetryClient();
360356
}
361357
}
362358
}

src/Common/Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
</ItemGroup>
6464

6565
<ItemGroup>
66-
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.4.0" />
66+
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.12.0" />
6767
</ItemGroup>
6868

6969
<ItemGroup>

src/Common/MetricHelper.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public MetricHelper(INetworkHelper network)
127127
#if DEBUG
128128
if (TestMockSupport.RunningMocked)
129129
{
130-
TelemetryConfiguration.Active.DisableTelemetry = true;
130+
telemetryConfiguration.DisableTelemetry = true;
131131
}
132132
#endif
133133
}
@@ -425,7 +425,7 @@ private void PopulatePropertiesFromQos(AzurePSQoSEvent qos, IDictionary<string,
425425
private static string[] exceptionTrackAcceptModuleList = { "Az.Accounts", "Az.Compute", "Az.AKS", "Az.ContainerRegistry" };
426426
private static string[] exceptionTrackAcceptCmdletList = { "Get-AzKeyVaultSecret", "Get-AzKeyVaultCert" };
427427

428-
private static string ConvertFrameToString(StackFrame frame)
428+
private static string ConvertFrameToString(System.Diagnostics.StackFrame frame)
429429
{
430430
string[] fullNameParts = frame?.GetMethod()?.DeclaringType?.FullName?.Split('.');
431431
if(fullNameParts == null || fullNameParts.Length == 0)
@@ -513,6 +513,16 @@ public static Dictionary<string, string> SerializeCustomEventPayload<T>(T payloa
513513

514514
return JsonConvert.DeserializeObject<Dictionary<string, string>>(payloadAsJson);
515515
}
516+
517+
private static TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration()
518+
{
519+
InstrumentationKey = "7df6ff70-8353-4672-80d6-568517fed090"
520+
};
521+
522+
public void AddDefaultTelemetryClient()
523+
{
524+
AddTelemetryClient(new TelemetryClient(telemetryConfiguration));
525+
}
516526
}
517527
}
518528

0 commit comments

Comments
 (0)