Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Microsoft.ApplicationInsights from 2.4.0 to 2.12.0 #276

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/Common/AzurePSCmdlet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.ApplicationInsights;
using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.PowerShell.Common.Share.Survey;
using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
using Microsoft.Azure.PowerShell.Common.Share.Survey;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
Expand Down Expand Up @@ -353,10 +352,7 @@ protected override void BeginProcessing()
if (_metricHelper == null)
{
_metricHelper = new MetricHelper(profile);
_metricHelper.AddTelemetryClient(new TelemetryClient
{
InstrumentationKey = "7df6ff70-8353-4672-80d6-568517fed090"
});
_metricHelper.AddDefaultTelemetryClient();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.4.0" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.12.0" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 12 additions & 2 deletions src/Common/MetricHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public MetricHelper(INetworkHelper network)
#if DEBUG
if (TestMockSupport.RunningMocked)
{
TelemetryConfiguration.Active.DisableTelemetry = true;
telemetryConfiguration.DisableTelemetry = true;
isra-fel marked this conversation as resolved.
Show resolved Hide resolved
}
#endif
}
Expand Down Expand Up @@ -425,7 +425,7 @@ private void PopulatePropertiesFromQos(AzurePSQoSEvent qos, IDictionary<string,
private static string[] exceptionTrackAcceptModuleList = { "Az.Accounts", "Az.Compute", "Az.AKS", "Az.ContainerRegistry" };
private static string[] exceptionTrackAcceptCmdletList = { "Get-AzKeyVaultSecret", "Get-AzKeyVaultCert" };

private static string ConvertFrameToString(StackFrame frame)
private static string ConvertFrameToString(System.Diagnostics.StackFrame frame)
isra-fel marked this conversation as resolved.
Show resolved Hide resolved
{
string[] fullNameParts = frame?.GetMethod()?.DeclaringType?.FullName?.Split('.');
if(fullNameParts == null || fullNameParts.Length == 0)
Expand Down Expand Up @@ -513,6 +513,16 @@ public static Dictionary<string, string> SerializeCustomEventPayload<T>(T payloa

return JsonConvert.DeserializeObject<Dictionary<string, string>>(payloadAsJson);
}

private static TelemetryConfiguration telemetryConfiguration = new TelemetryConfiguration()
{
InstrumentationKey = "7df6ff70-8353-4672-80d6-568517fed090"
};

public void AddDefaultTelemetryClient()
{
AddTelemetryClient(new TelemetryClient(telemetryConfiguration));
}
}
}

Expand Down