Closed pihalve closed 5 years ago
@pihalve Can you remove the services.AddApplicationInsightsKubernetesEnricher();
and also remove 'Microsoft.ApplicationInsights.Kubernetes 1.0.2' and see if this issue occurs. This will help us narrow down the root cause.
Using Microsoft.Extensions.Logging.ApplicationInsights
and Microsoft.ApplicationInsights.AspNetCore
together shouldn't cause this issue and is documented here: https://github.com/Microsoft/ApplicationInsights-dotnet-logging/blob/develop/src/ILogger/Readme.md
Removing services.AddApplicationInsightsKubernetesEnricher();
makes it work fine. In fact, just using Microsoft.ApplicationInsights.AspNetCore
and Microsoft.ApplicationInsights.Kubernetes
works fine, and just using Microsoft.ApplicationInsights.AspNetCore
and Microsoft.Extensions.Logging.ApplicationsInsights
works fine. But the combination of all three together causes the issue.
Ok thanks for confirming. We need to get some help from Microsoft.ApplicationInsights.Kubernetes owners.
let me find the best person to help
@karolz-ms Is this something which you might know?
@xiaomi7732 is the expert here. @brahmnes did some investigation and figured out that when Ilogger is created, it goes to the AI logging provider, which then goes to the telemetry client, and then the telemetry configuration, and then the list of telemetry initializer, and then the kube telemetry initializer, and then our k8senvironmentfactory, and then our kube http client, which uses and requires an ILogger on construction 😕
So we need to break this circle somehow
Thanks for sharing this info Karol. Will start an internal mail with folks.
This is also tracked here: https://github.com/Microsoft/ApplicationInsights-Kubernetes/issues/173
Hm... version of 2.9.1 of Microsoft.Extensions.Logging.ApplicationInsights
is now available on NuGet and the error is gone. What makes me wonder is that none of the changes in 2.9.1 or the base SDK seem to have anything to do with this issue at first glance .
Please ignore. The error is still here, I had my app accidentally configured so that App Insights was not being used.
@karolz-ms just in case, it's been already tackled from https://github.com/microsoft/ApplicationInsights-Kubernetes/pull/180
cc/ @cijothomas
@ferantivero cool, thx
I'm creating a dockerized ASP.NET Core solution to be hosted in Kubernetes, and want to use ApplicationInsights. So I added 'Microsoft.ApplicationInsights.AspNetCore 2.6.1' and 'Microsoft.ApplicationInsights.Kubernetes 1.0.2'.
Additionally, since I want also to log my own stuff to ApplicationInsights using ILogger, I added 'Microsoft.Extensions.Logging.ApplicationsInsights 2.9.0-beta3'. But when I deploy the solution to Kubernetes the pod crashes with this exception:
In
program.cs
I added this after UseStartup:In
startup.cs
I added this in ConfigureServices:So it seems there's a bit of a compatibility issue. Or perhaps I'm doing something wrong.