I have a console application we deploy as a WebJob in Azure. Application Insights is working, because the telemetry is send to Azure correctly. But the "Application Insights Search" window in Visual Studio (2019) is not picking up the telemetry locally. What do I need to configure, so the application insights window will show the telemetry for the console application?
In the solution we have an MVC website and the WebJob together in the same solution. The telemetry works locally for the MVC website project, but not for the webjob project.
I have integrated Application Insights with the following code:
builder.ConfigureLogging((context, loggingBuilder) =>
{
loggingBuilder.AddApplicationInsightsWebJobs(o =>
{
o.InstrumentationKey = instrumentationKey;
o.EnableLiveMetrics = true;
o.LiveMetricsInitializationDelay = TimeSpan.FromMinutes(1);
o.SamplingExcludedTypes = "Exception";
});
});
The instrumentation key comes from the appsettings.json:
"Company.Logging": {
"InstrumentationKey": "1242189c-1192-41d9-b877-b26890bd0eef",
"LoggingServiceUrl": "https://loggingapidev.company.com/api/logs/batch"
}
We use the same configuration for the website, that works.
I did try to add the "APPINSIGHTS_INSTRUMENTATIONKEY" key in the appsettings.json and as an environment variable. That didn't have any effect.
Does anyone know what I can do to make this work? It would make it more intuitive for developers to work with application insights. Now I have to direct them to the portal where they can find their local telemetry.
ConfigureLogging
callback is being invoked at all? – Dai