When reviewing some log messages inside Application Insights I noticed a lot of messages like this:
AI: TelemetryChannel found a telemetry item without an InstrumentationKey. This is a required field and must be set in either your config file or at application startup.
I had an ApplicationInsights section inside my appsettings.json where I provided an instrumentation key, so that could not be the issue(and the trace message arrived in the correct Application Insights resource).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ApplicationInsights": { | |
"InstrumentationKey": "instrumentation-key" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddApplicationInsightsTelemetry(); | |
} |
This turned out to be a bug in the Application Insights version I was using(2.15.0).
Upgrading to the latest version(2.20.0 at the moment of writing) solved the problem.
Up to the next issue!