I'm encapsulating TelemetryClient
functionality to a framework component for both client and server to use. In the process, trimming dependencies and replacing default behavior with my own.
My problem, however, is although telemetry shows up in debug output, it's not shown in the Application Insights Search window.
Note, the telemetry is picked up in Azure Portal.
How can I get data from debug session telemetry, without the full blown Web App to Add Application Insights Telemetry... workflow?
Steps to reproduce:
- Create Azure resource, replace
InstrumentationKey = "###YourKey###"
in snippet below - Create .NET Framework ConsoleApp
- Add Microsoft.ApplicationInsights nuget package
Program.cs
using Microsoft.ApplicationInsights;
using Microsoft.ApplicationInsights.Extensibility;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
Track.AddEvent("Debugging");
System.Console.WriteLine("Search Insights");
System.Console.ReadLine();
}
}
public static class Track
{
private static readonly TelemetryClient TelemetryClient;
static Track()
{
TelemetryConfiguration config = TelemetryConfiguration.CreateDefault();
config.InstrumentationKey = "###YourKey###";
TelemetryClient = new TelemetryClient(config);
}
public static void AddEvent(string eventName)
{
TelemetryClient.TrackEvent(eventName);
}
}
}
Taking data from Azure Resource.
ReadLine()
in there, but does callingFlush()
on the telemetry client before the program exits make a difference? – Brendan Green