Exception thrown upon detecting container id failure
xiaomi7732 opened this issue · 6 comments
This is reported by @blushingpenguin in #290.
TL;DR - when auto-detection for the container id failed, an exception is thrown, breaking the working flow. The expectation is for a string.Empty to be returned as the container id.
- Fix in 2.x
- Verify if the same fix is needed in 3.x.
Copy of the callstack provided:
Unhandled exception. System.InvalidOperationException: Failed fetching container id.
at Microsoft.ApplicationInsights.Kubernetes.KubeHttpClientSettingsBase.GetContainerIdOrThrow()
at Microsoft.ApplicationInsights.Kubernetes.KubeHttpClientSettingsBase..ctor(String kubernetesServiceHost, String kubernetesServicePort,
IEnumerable`1 containerIdProviders)
at Microsoft.ApplicationInsights.Kubernetes.KubeHttpClientSettingsProvider..ctor(IEnumerable`1 containerIdProviders, String pathToToken,
String pathToCert, String pathToNamespace, String kubernetesServiceHost, String kubernetesServicePort)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
@blushingpenguin PR ready for review. Check out #298 for details.
Fix released at: https://www.nuget.org/packages/Microsoft.ApplicationInsights.Kubernetes/2.0.5-beta2. Please give it a shot. Thanks!
And FYI, it looks like the same issue won't be there for 3.0:
But it is probably better to have a log entry like it in 2.x. I'll submit another PR for that.
Piggybacked the change in #296 for 3.0
Hey @blushingpenguin, do you mind verifying if 2.0.5-beta2 fixed it for you? I will try to make it a stable release once I hear back from you.
Stable package released:
https://www.nuget.org/packages/Microsoft.ApplicationInsights.Kubernetes/2.0.5
@blushingpenguin Thanks for the contribution!