Napisałem aplikację konsoli, która śledzi wydarzenia i metryk przez aplikację Insights, a ja Rysunek A WebJob nie będzie wszystko, co różni, dodając następujące pakiety Nuget:
- Microsoft.ApplicationInsights
- Microsoft.ApplicationInsights.TraceListener (może to nie być konieczne)
My ApplicationInsights.config
wygląda następująco:
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights" />
</TelemetryModules>
</ApplicationInsights>
I prosty program robi to:
TelemetryConfiguration.Active.InstrumentationKey = "the_key";
TelemetryConfiguration.Active.TelemetryChannel.DeveloperMode = true;
var tc = new TelemetryClient();
tc.TrackRequest("Track Some Request", DateTimeOffset.UtcNow, new TimeSpan(0, 0, 3), "200", true);
tc.TrackMetric("XYZ Metric", 100);
tc.TrackEvent("Tracked Event");
tc.Flush(); //need to do this, otherwise if the app exits the telemetry data won't be sent
Istnieje również to: Application Insights on Windows Desktop apps, services and worker roles
Jeśli chodzi o oficjalne dokumenty, jest to obecnie najbliżej: https://docs.microsoft.com/en-us/azure/application-insights/app-insights-windows-desktop. –