I have dotnet core web application hosted in Azure and using application insights for logging.
I found I have abnormal amount of n/a critical trace message, like around 11k in just 1 min. Anyone has encountered this issue in application insights?
library:
- Microsoft.ApplicationInsights.AspNetCore Version=2.15.0
- Microsoft.ApplicationInsights.DependencyCollector Version=2.15.0
- Microsoft.ApplicationInsights.DiagnosticSourceListener Version=2.15.0
- Microsoft.ApplicationInsights.EventSourceListener Version=2.15.0
- Microsoft.ApplicationInsights.TraceListener Version=2.15.0
- Microsoft.ApplicationInsights.WindowsServer Version=2.15.0
- Microsoft.AspNetCore.Hosting Version=2.2.7
dotnet runtime: netcoreapp3.1
I have configured application insights at below.
public static IWebHostBuilder UseLoggingWithAppInsights(this IWebHostBuilder builder)
{
builder.ConfigureServices((context, services) =>
{
services.AddApplicationInsightsTelemetry(applicationInsightsInstrumentKey);
});
var provider = services.BuildServiceProvider();
IWebHostEnvironment host = provider.GetService<IWebHostEnvironment>();
IHttpContextAccessor context = provider.GetService<IHttpContextAccessor>();
TelemetryConfiguration.Active.EnableTelemetry(applicationInsightsInstrumentKey, appName, telemetryDetails, telemetrySettings, context, host);
TelemetryConfiguration config = provider.GetService<TelemetryConfiguration>() ?? TelemetryConfiguration.CreateDefault();
TelemetryConfiguration.Active.FireTraceToSeeIfActive();
config.FireTraceToSeeIfActive();
builder.ConfigureServices((context, services) =>
{
var instrumentationKey = context.Configuration.GetValue<string>("ApplicationInsights:InstrumentationKey");
if (string.IsNullOrWhiteSpace(TelemetryConfiguration.Active.InstrumentationKey)
|| TelemetryConfiguration.Active.InstrumentationKey != instrumentationKey)
{
TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey;
}
var provider = services.BuildServiceProvider();
Util.StaticApplicationLogging.LoggerFactory = provider.GetRequiredService<ILoggerFactory>();
});
builder.ConfigureLogging((builderContext, loggingBuilder) =>
{
loggingBuilder.AddConfiguration(builderContext.Configuration.GetSection("Logging"));
});
return builder;
}