Skip to content

Commit

Permalink
Removed Application Insights
Browse files Browse the repository at this point in the history
  • Loading branch information
AstumppMSFT committed Mar 28, 2016
1 parent d8ff989 commit 736f9ab
Show file tree
Hide file tree
Showing 39 changed files with 65 additions and 711 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// ---------------------------------------------------------------------------------

using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using PhotoSharingApp.Universal.Services;

Expand Down Expand Up @@ -74,9 +73,7 @@ public async Task GetTopCategoriesTest()
[TestInitialize]
public void Init()
{
var telemetryClient = new TelemetryClient();
_serviceClient = new ServiceClient(telemetryClient,
new AuthenticationHandler(telemetryClient));
_serviceClient = new ServiceClient(new AuthenticationHandler());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using PhotoSharingApp.Universal.Models;
using PhotoSharingApp.Universal.Services;
Expand All @@ -45,9 +44,7 @@ public class ServiceLoadTests
[TestInitialize]
public void Init()
{
var telemetryClient = new TelemetryClient();
_serviceClient = new ServiceClient(telemetryClient,
new AuthenticationHandler(telemetryClient));
_serviceClient = new ServiceClient(new AuthenticationHandler());
_configuration = new DefaultConfig();
}

Expand Down
22 changes: 1 addition & 21 deletions PhotoSharingApp/PhotoSharingApp.Universal/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using Microsoft.Practices.ServiceLocation;
using PhotoSharingApp.Universal.Facades;
using PhotoSharingApp.Universal.Lifecycle;
using PhotoSharingApp.Universal.Models;
using PhotoSharingApp.Universal.ServiceEnvironments;
using PhotoSharingApp.Universal.Telemetry;
using PhotoSharingApp.Universal.Unity;
using PhotoSharingApp.Universal.Views;
using Windows.ApplicationModel;
Expand All @@ -57,11 +53,6 @@ public sealed partial class App : Application
/// </summary>
public App()
{
WindowsAppInitializer.InitializeAsync(ServiceEnvironmentBase.Current.InstrumentationKey,
WindowsCollectors.Metadata
| WindowsCollectors.Session
| WindowsCollectors.UnhandledException);

InitializeComponent();

// Register for events
Expand Down Expand Up @@ -124,7 +115,7 @@ private async Task<AppShell> Initialize()
await AppInitialization.DoInitializations();

// Create a AppShell to act as the navigation context and navigate to the first page
shell = new AppShell(AppEnvironment.Instance.TelemetryClient);
shell = new AppShell();

// Set the default language
shell.Language = ApplicationLanguages.Languages[0];
Expand All @@ -143,9 +134,6 @@ protected override async void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);

var telemetryClient = new TelemetryClient();
telemetryClient.TrackEvent(TelemetryEvents.AppOnNotificationActivated);

var shell = Window.Current.Content as AppShell;

// Check if the application needs to be initialized.
Expand All @@ -167,11 +155,6 @@ protected override async void OnActivated(IActivatedEventArgs args)
/// <param name="e">Details about the launch request and process.</param>
protected override async void OnLaunched(LaunchActivatedEventArgs e)
{
// We have not configured our dependency container yet for the very first launch event,
// so we create this instance manually.
var telemetryClient = new TelemetryClient();
telemetryClient.TrackEvent(TelemetryEvents.AppOnLaunch);

var shell = await Initialize();

// Place our app shell in the current Window
Expand Down Expand Up @@ -233,9 +216,6 @@ private async void OnUnhandledException(object sender, UnhandledExceptionEventAr
{
e.Handled = true;

var telemetryClient = new TelemetryClient();
telemetryClient.TrackException(e.Exception);

var resourceLoader = ResourceLoader.GetForCurrentView();
var dialog = new MessageDialog(resourceLoader.GetString("UnexpectedError_Message"),
resourceLoader.GetString("UnexpectedError_Title"));
Expand Down
9 changes: 1 addition & 8 deletions PhotoSharingApp/PhotoSharingApp.Universal/AppShareTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@

using System;
using System.Linq;
using Microsoft.ApplicationInsights;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;
using PhotoSharingApp.Universal.Facades;
using PhotoSharingApp.Universal.Lifecycle;
using PhotoSharingApp.Universal.Models;
using PhotoSharingApp.Universal.Telemetry;
using PhotoSharingApp.Universal.Unity;
using PhotoSharingApp.Universal.ViewModels;
using Windows.ApplicationModel.Activation;
Expand Down Expand Up @@ -73,9 +71,6 @@ private Frame GetOrCreateRootFrame()
/// <param name="args">Event data for the event.</param>
protected override async void OnShareTargetActivated(ShareTargetActivatedEventArgs args)
{
var telemetryClient = new TelemetryClient();
telemetryClient.TrackEvent(TelemetryEvents.AppOnShareTargetActivated);

IAppEnvironment mainAppEnvironment = null;
IUploadFinishedHandler mainUploadFinishedHandler = null;

Expand Down Expand Up @@ -146,10 +141,8 @@ protected override async void OnShareTargetActivated(ShareTargetActivatedEventAr
Window.Current.Activate();
}
}
catch (Exception exception)
catch (Exception)
{
telemetryClient.TrackException(exception);

args.ShareOperation.ReportCompleted();
}
}
Expand Down
16 changes: 0 additions & 16 deletions PhotoSharingApp/PhotoSharingApp.Universal/Camera/CameraEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using PhotoSharingApp.Universal.ComponentModel;
using PhotoSharingApp.Universal.Editing;
using PhotoSharingApp.Universal.Extensions;
Expand Down Expand Up @@ -87,16 +86,6 @@ public class CameraEngine : ObservableObjectBase, ICameraEngine
/// </summary>
private VideoEncodingProperties _selectedPreviewResolution;

/// <summary>
/// The telemetry client.
/// </summary>
private readonly TelemetryClient _telemetryClient;

public CameraEngine(TelemetryClient telemetryClient)
{
_telemetryClient = telemetryClient;
}

/// <summary>
/// Gets a value indicating whether multiple cameras are available.
/// </summary>
Expand Down Expand Up @@ -266,7 +255,6 @@ public async Task InitCamera(DeviceInformation deviceInformation = null)
}
else
{
_telemetryClient.TrackTrace("No camera detected");
throw new CameraNotFoundException();
}
}
Expand Down Expand Up @@ -354,10 +342,6 @@ public async Task StopPreviewAsync()
await _mediaCapture.StopPreviewAsync();
IsPreviewing = false;
}
else
{
_telemetryClient.TrackTraceWithCallerName("mediaCapture is null");
}
}

/// <summary>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@
// ---------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using PhotoSharingApp.Universal.Extensions;
using PhotoSharingApp.Universal.Models;
using PhotoSharingApp.Universal.Services;
using PhotoSharingApp.Universal.Store;
using PhotoSharingApp.Universal.Telemetry;
using Windows.ApplicationModel.Store;

namespace PhotoSharingApp.Universal.Facades
Expand All @@ -49,15 +45,9 @@ public class LicensingFacade : ILicensingFacade
/// </summary>
private readonly IPhotoService _photoService;

/// <summary>
/// The telemetry client.
/// </summary>
private readonly TelemetryClient _telemetryClient;

public LicensingFacade(TelemetryClient telemetryClient, IPhotoService photoService,
public LicensingFacade(IPhotoService photoService,
IAuthEnforcementHandler authEnforcementHandler)
{
_telemetryClient = telemetryClient;
_photoService = photoService;
_authEnforcementHandler = authEnforcementHandler;
}
Expand All @@ -73,8 +63,6 @@ public LicensingFacade(TelemetryClient telemetryClient, IPhotoService photoServi
/// </remarks>
private async Task DoFulfillment()
{
_telemetryClient.TrackEvent(TelemetryEvents.DoFullfillment);

var productLicenses = CurrentAppProxy.LicenseInformation.ProductLicenses;

// Do fulfillment of all avalaible IAPs.
Expand All @@ -95,17 +83,8 @@ public async Task PurchaseGold(string productId)
{
await _authEnforcementHandler.CheckUserAuthentication();

_telemetryClient.TrackEvent(TelemetryEvents.PurchaseGoldInitiated,
TelemetryProperties.ProductId, productId);

// Kick off the purchase
var purchaseResults = await CurrentAppProxy.RequestProductPurchaseAsync(productId);
_telemetryClient.TrackEvent(TelemetryEvents.PurchaseGoldPurchaseResultsAvailable,
new Dictionary<string, string>
{
{ TelemetryProperties.ProductId, productId },
{ TelemetryProperties.PurchaseStatus, purchaseResults.Status.ToString() }
});

if (purchaseResults.Status == ProductPurchaseStatus.Succeeded
|| purchaseResults.Status == ProductPurchaseStatus.NotFulfilled)
Expand Down Expand Up @@ -138,16 +117,6 @@ private async Task TryFulfillGold(ProductLicense productLicense)

// Now update local gold balance
AppEnvironment.Instance.CurrentUser.GoldBalance = user.GoldBalance;

_telemetryClient.TrackEvent(TelemetryEvents.PurchaseGoldSuccess);
}
else
{
_telemetryClient.TrackEvent(TelemetryEvents.PurchaseGoldFail,
new Dictionary<string, string>
{
{ TelemetryProperties.ProductId, productLicense.ProductId }
});
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
using System.Reflection;
using System.Runtime.Serialization;
using System.Threading.Tasks;
using Microsoft.ApplicationInsights;
using PhotoSharingApp.Universal.Extensions;
using PhotoSharingApp.Universal.Models;
using PhotoSharingApp.Universal.Serialization;
Expand Down Expand Up @@ -55,20 +54,6 @@ public class NavigationFacade : INavigationFacade
/// </summary>
private Frame _frame;

/// <summary>
/// The telemetry client.
/// </summary>
private readonly TelemetryClient _telemetryClient;

/// <summary>
/// Initializes a new instance of the <see cref="NavigationFacade" /> class.
/// </summary>
/// <param name="telemetryClient">The telemetry client.</param>
public NavigationFacade(TelemetryClient telemetryClient)
{
_telemetryClient = telemetryClient;
}

/// <summary>
/// Determines if back navigation
/// </summary>
Expand Down Expand Up @@ -424,10 +409,9 @@ public void RemoveUploadPhotoFramesFromBackStack(string categoryIdNavigatedTo)
framesToRemove++;
}
}
catch (SerializationException e)
catch (SerializationException)
{
// Swallow exception. Args were of different type than expected.
_telemetryClient.TrackException(e);
// Swallow exception. Args were of different type than expected.
}
}

Expand Down
Loading

0 comments on commit 736f9ab

Please sign in to comment.