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:
InstrumentationKey = "###YourKey###"
in snippet belowProgram.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.
Don't know what caused it, but you can get around by manually adding ApplicationInsights.config
.
Workflow:
Running the solution again made the event count appear next to the light bulb.
Data from Debug session telemetry shown accordingly.
Funny thing, if you now remove the config file, the events will still show up in the Application Insights Search window, although the count next to the light bulb disappears again.