question

MaartenClauwaert-3892 avatar image
1 Vote"
MaartenClauwaert-3892 asked ryanchill answered

Azure Alert - Microsoft.AspNetCore.Hosting|Failed Requests (Azure.ApplicationInsights)

I'm having trouble understanding how the standard metric "Microsoft.AspNetCore.Hosting|Failed Requests (Azure.ApplicationInsights)" works in Azure. I'm hoping someone can shed some light on it as it seems no documentation on it exists either.

The alert is configured as shown in below picture. It's being triggered multiple times a day, while no failures are appearing in the relevant Application Insights instance.

GsTo4.png

I was expecting the chart from the above alert would match following kusto query:

let start=ago(6hr);
let end=now();
let timeGrain=5m;
let dataset=requests
| where timestamp > start and timestamp < end
| where client_Type != "Browser"
;
dataset
| summarize failedCount=sumif(itemCount, success == false) by bin(timestamp, timeGrain)
| extend request='Overall'
| render timechart

ZTMZf.png


azure-webappsazure-monitorazure-webapps-monitoring
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I'm trying to get more details on this @MaartenClauwaert-3892 and will post a follow up.

0 Votes 0 ·

thank you!

0 Votes 0 ·

@ryanchill any update yet by any chance?

0 Votes 0 ·
ryanchill avatar image ryanchill MaartenClauwaert-3892 ·

Unfortunately, nothing yet @MaartenClauwaert-3892, but I'll be sure to update once I get a response.

0 Votes 0 ·

1 Answer

ryanchill avatar image
0 Votes"
ryanchill answered

Hi @MaartenClauwaert-3892,

Apologies for the delayed response. It was an ah-ha moment when it was pointed out to me. Application Insights uses EventSource for dotnet. Microsoft.AspNetCore.Hosting|Failed Requests is being generated by RequestFailed() in HostingEventSource. This method is called by HostingApplicationDiagnostics.RequestEnd() when the request ends in a 500. Modifying dataset in your kusto query to the following should pull those 500s in.

let dataset=AppRequest //requests is a legacy table https://docs.microsoft.com/en-us/azure/azure-monitor/app/apm-tables
| where timestamp > start and timestamp < end
| where resultCode > "500"




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.