简体   繁体   中英

Azure alert on Azure Functions "Failed" metric is triggering with no apparent failures

I want an Azure Alert to trigger when a certain function app fails. I set it up as a GTE 1 threshold on the [function name] Failed metric thinking that would yield the expected result. However, when it runs daily I am getting notifications that the alert fired but I cannot find anything in the Application Insights to indicate the failure and it appears to be running successfully and completing.

Here is the triggered alert summary:

在此处输入图像描述

Here is the invocation monitoring from the portal showing that same function over the past few days with no failures:

在此处输入图像描述

And here is an application insights search over that time period showing no exceptions and all successful dependency actions:

在此处输入图像描述

The question is - what could be causing a Azure Function Failed metric to be registering non-zero values without any telemetry in Application Insights?

Update - here is the alert configuration

在此处输入图像描述

And the specific condition settings-

在此处输入图像描述

Failures blade for wider time range:

在此处输入图像描述

There are some dependency failures on a blob 404 but I think that is from a different function that explicitly checks for the existence of blobs at paths to know which files to download from an external source. Also the timestamps don't fall in the sample period.

在此处输入图像描述

No exceptions:

在此处输入图像描述

Per comment on the question by @ivan-yang I have switched the alerting to use a custom log search instead of the built-in Azure Function metric. At this point that metric seems to be pretty opaque as to what is triggering it and it was triggering every day when I ran the Azure Function with no apparent underlying failure. I plan to avoid this metric now.

My log based alert is using the following query for now to get what I was looking for (an exception happened or a function failed):

requests
| where success == false
| union (exceptions)
| order by timestamp desc

Thanks to @ivan-yang and @krishnendughosh-msft for the help

sorry for late questions, but how do you specify a function? I got several functions in my ressource group and I want to create an Alert log for each of them. Currently, if there are an error in one function, I receive a mail from each alert. Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM