I am logging custom events from my ASP.NET Core 8 Web API. I can see those events display in Live Metrics shortly after they are sent, but I’m not able to find them in any of the ‘events’ tables to query later.
I’ve checked in the ‘customEvents’ table in Log Analytics, and I’ve also checked the ‘AppEvents’ table in my Log Analytics Workspace. It has been more than 24 hours since those events were seen in Live Metrics, which I assume is more than enough time for processing to occur. Is there something I’m missing?
I am running a custom ITelemetryInitializer
, but it only operates on request and dependency telemetry:
public class TelemetryInitializer : ITelemetryInitializer
{
public void InitializeTelemetry(ITelemetry telemetry)
{
if (telemetry is DependencyTelemetry dependency)
{
// manipulate dependency data
}
if (telemetry is RequestTelemetry request)
{
// manipulate request data
}
}
}
Most of my configuration is accomplished in appsettings.json
:
"ApplicationInsights": {
"InstrumentationKey": "redacted",
"DeveloperMode": false,
"EnableAdaptiveSampling": true,
"EnableRequestTrackingTelemetryModule": true,
"EnablePerformanceCountersCollectionModule": false,
"EnableActiveTelemetryConfigurationSetup": true,
"InitialSamplingPercentage": 5,
"SamplingSettings": {
"MaxTelemetryItemsPerSecond": 5,
"ExcludedTypes": "Event",
"IncludedTypes": "Exception;Dependency;Trace;Request"
}
}
I suspect AdaptiveSampling
has something to do with it, but I’m not sure why that would allow me to see it in Live Metrics and then not in the table afterwards.
EDIT:
I was asked to provide my Program.cs
file, but for these purposes, my ApplicationInsights registration is all happening in Startup.cs
:
public void ConfigureServices(IServiceCollection services)
{
services.AddApplicationInsightsTelemetry(options =>
{
Configuration.GetSection("ApplicationInsights")
.Bind(options);
});
services.AddSingleton<ITelemetryInitializer, TelemetryInitializer>();
}
2
Answers
From what I can tell, the problem here seems to be the Daily Data Cap that we've set for this instrumentation key on the Azure side. MS documentation indicates that reaching the daily cap should block "all billable data from being ingested", but it seems that "ingested" may be referring only to the underlying tables where this information would be queryable, and not necessarily blocking telemetry from hitting AppInsights altogether.
I'm now using an entirely separate instrumentation key that does not have the same limitations, and I've been able to see my events in both Live Metrics and Log Analytics.
I am able to see the Custom Events in Live Metrics, Transaction Search and Logs in Application Insights with the default and the configuration which you have shared.
Live Metrics:
Transaction Search:
Logs – Application Insights:
and as well as in LogAnalytics – AppEvents Table.
My Program.cs file:
My
TelemetryInitializer.cs
file:My Controller Class:
With
EventTelemetry
:Without
EventTelemetry
:"ExcludedTypes": "Event",
fromappsettings.json
file and check once.