Skip to content
Draft
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
6 changes: 2 additions & 4 deletions TinyInsights.TestApp/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ namespace TinyInsights.TestApp;
public partial class MainPage : ContentPage
{
private readonly IInsights insights;
private readonly InsightsMessageHandler insightsMessageHandler;
private readonly ILogger logger;

public MainPage(IInsights insights, InsightsMessageHandler insightsMessageHandler, ILogger logger)
public MainPage(IInsights insights, ILogger logger)
{
this.insights = insights;
this.insightsMessageHandler = insightsMessageHandler;
this.logger = logger;
BindingContext = this;
insights.OverrideAnonymousUserId("TestUser");
Expand Down Expand Up @@ -80,7 +78,7 @@ private async void ExceptionButton_OnClicked(object? sender, EventArgs e)

private async void TrackHttpButton_OnClicked(object? sender, EventArgs e)
{
var client = new HttpClient(insightsMessageHandler);
var client = new HttpClient();

for (int i = 0; i < 10; i++)
{
Expand Down
9 changes: 9 additions & 0 deletions TinyInsights/ApplicationInsightsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.DependencyCollector;
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
Expand Down Expand Up @@ -27,6 +28,7 @@ public class ApplicationInsightsProvider : IInsightsProvider, ILogger
public bool IsTrackEventsEnabled { get; set; } = true;
public bool IsTrackDependencyEnabled { get; set; } = true;
public bool EnableConsoleLogging { get; set; }
public bool UseDependencyTrackingModule { get; set; } = false;

private static ICrashHandler CreateDefaultCrashHandlerType() => new CrashToJsonFileStorageHandler();

Expand Down Expand Up @@ -190,6 +192,13 @@ private static void OnDisappearing(object? sender, Page e)
ConnectionString = ConnectionString
};


if (UseDependencyTrackingModule)
{
var dependencyModule = new DependencyTrackingTelemetryModule();
dependencyModule.Initialize(configuration);
}

client = new TelemetryClient(configuration);

client.Context.Device.OperatingSystem = DeviceInfo.Platform.ToString();
Expand Down
3 changes: 2 additions & 1 deletion TinyInsights/TinyInsights.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.22.0" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.23.0" />
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.23.0" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('net8')) ">
Expand Down