You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using this (the above snippet uses the Microsoft.Azure.WebJobs.Logging.ApplicationInsights package which I know is related to another repo, but bear with me) I was only able to see traces and exceptions in my logs. I wanted to setup telemetry to track my dependency calls as well. So after reading up, I tried to use and configure the ApplicationInsights.WorkerService library instead of the above package. So my new setup looked like below:
var aiOptions = new ApplicationInsightsServiceOptions
{
EnableAdaptiveSampling = false,
ConnectionString = configuration.GetConnectionString("ApplicationInsights")
};
services.AddApplicationInsightsTelemetryWorkerService(aiOptions);
My dependency telemetry started showing up, but now my traces disappeared.
Following your documentation here, I provided a specific override for ApplicationInsights in the configuration(with the "Information" level enabled) , but this did not work either. I still only saw the dependencies in my logs.
The only way I got both my traces and dependencies working is to use both the packages and configure them very specifically in the following order:
services.AddApplicationInsightsTelemetryWorkerService(aiOptions); //This has to go first
services.AddLogging(builder =>
{
builder.AddConsole();
builder.AddDebug();
builder.AddApplicationInsightsWebJobs(options =>
{
options.ConnectionString = configuration.GetConnectionString("ApplicationInsights");
options.EnableLiveMetrics = true;
});
});
Can you please check why the logging of traces does not work? I would expect that only the WorkerService SDK is required since it has all the providers required according to the documentation.
Further information on my setup:
.Net Core 8.0
Project SDK used -> Microsoft.NET.Sdk
The text was updated successfully, but these errors were encountered:
@cijothomas In the example you shared, do you mean the use of some CustomTelemetryProcessor? Other than that, the example looks pretty similar to what I had done above.
One question, does the fact that we are not using the Worker SDK but only the .Net SDK make a difference? That's something I did not try.
Dear team,
I have a .net core Worker service for which I had configured App Insights using the below snippet in my ConfigureServices method:
Using this (the above snippet uses the Microsoft.Azure.WebJobs.Logging.ApplicationInsights package which I know is related to another repo, but bear with me) I was only able to see traces and exceptions in my logs. I wanted to setup telemetry to track my dependency calls as well. So after reading up, I tried to use and configure the ApplicationInsights.WorkerService library instead of the above package. So my new setup looked like below:
My dependency telemetry started showing up, but now my traces disappeared.
Following your documentation here, I provided a specific override for ApplicationInsights in the configuration(with the "Information" level enabled) , but this did not work either. I still only saw the dependencies in my logs.
The only way I got both my traces and dependencies working is to use both the packages and configure them very specifically in the following order:
Can you please check why the logging of traces does not work? I would expect that only the WorkerService SDK is required since it has all the providers required according to the documentation.
Further information on my setup:
.Net Core 8.0
Project SDK used -> Microsoft.NET.Sdk
The text was updated successfully, but these errors were encountered: