Hi all, I have an ASP.Net Core 3.1 Web API installed as App Service in Azure.
This App Service has the environment variable APPINSIGHTS_INSTRUMENTATIONKEY properly configured and until now it was writting operations like a charm.
But my API also uses CosmosDB (Mongo) and these dependencies were not being tracked.
After googling, I found out I had to use TelemetryClient.
Registering:
string appInsightsKey = Environment.GetEnvironmentVariable("APPINSIGHTS_INSTRUMENTATIONKEY");
if (!string.IsNullOrEmpty(appInsightsKey))
{
var telemetryConfig = TelemetryConfiguration.CreateDefault();
telemetryConfig.InstrumentationKey = appInsightsKey;
services.AddSingleton(new TelemetryClient(telemetryConfig));
var depModule = new DependencyTrackingTelemetryModule();
depModule.Initialize(telemetryConfig);
}
Member
12 Points
28 Posts
ASP.Net Core 3.1 WebAPI, using TelemetryClient Azure Application insights hides operations metric...
Feb 17, 2021 03:31 PM|pacojones|LINK
Hi all, I have an ASP.Net Core 3.1 Web API installed as App Service in Azure.
This App Service has the environment variable APPINSIGHTS_INSTRUMENTATIONKEY properly configured and until now it was writting operations like a charm.
But my API also uses CosmosDB (Mongo) and these dependencies were not being tracked.
After googling, I found out I had to use TelemetryClient.
Registering:
Then adding the client on my repository:
Now when I go to my application insights, I only see dependencies and don't see any operations at all.
Do I need to explicitly add also application insights on startup in order to use insights with telemetry client? Am I missing something here?
Thanks a lot!
Member
12 Points
28 Posts
Re: ASP.Net Core 3.1 WebAPI, using TelemetryClient Azure Application insights hides operations me...
Feb 17, 2021 07:33 PM|pacojones|LINK
Tried out installing package Microsoft.ApplicationInsights.AspNetCore and added the following line, works like a charm.