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
I noticed a difference in behavior in our docker services when configuring ApplicationInsights InstrumentationKey in a KeyVault using Microsoft.Extensions.Configuration.AzureKeyVault:
ServiceA (WorkerService)
ServibeB (AspNetCore)
The InstrumentationKey is null in appsettings.json and fetched from a KeyVault in our environments. The result is this:
ServiceA can fetch the Instrumentation key using this configuration: public void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(); }
ServiceB can not fetch the Instrumentation key using this initialization: public void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(); }
ServiceB can fetch the Instrumentation key using this initialization: public void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(this.Configuration); }
Now I'm not that knowledgeable with dotnet core configurations yet but I think the problem comes from this line
@Yalpe - Btw your analysis is fully correct! thanks for spending time here, and hopefully no other customers would have to spend time on this, as we;ll have a fix for this very soon!
Hi,
I noticed a difference in behavior in our docker services when configuring ApplicationInsights InstrumentationKey in a KeyVault using Microsoft.Extensions.Configuration.AzureKeyVault:
ServiceA (WorkerService)
ServibeB (AspNetCore)
The InstrumentationKey is null in appsettings.json and fetched from a KeyVault in our environments. The result is this:
ServiceA can fetch the Instrumentation key using this configuration:
public void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(); }
ServiceB can not fetch the Instrumentation key using this initialization:
public void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(); }
ServiceB can fetch the Instrumentation key using this initialization:
public void ConfigureServices(IServiceCollection services) { services.AddApplicationInsightsTelemetry(this.Configuration); }
Now I'm not that knowledgeable with dotnet core configurations yet but I think the problem comes from this line
ApplicationInsights-dotnet/NETCORE/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/DefaultApplicationInsightsServiceConfigureOptions.cs
Line 31 in d331966
ApplicationInsights-dotnet/NETCORE/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs
Line 67 in d331966
If I compare the code to the WorkerService, I noticed that the IConfiguration is injected instead.
ApplicationInsights-dotnet/NETCORE/src/Microsoft.ApplicationInsights.WorkerService/DefaultApplicationInsightsServiceConfigureOptions.cs
Line 21 in d331966
Could this be why the behavior is different?
The text was updated successfully, but these errors were encountered: