简体   繁体   English

Azure 警报 Azure 功能“失败”指标正在触发,没有明显的故障

[英]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.我希望在某个 function 应用程序失败时触发 Azure 警报。 I set it up as a GTE 1 threshold on the [function name] Failed metric thinking that would yield the expected result.我将其设置为 [function name] Failed metric thinking 上的 GTE 1 阈值,这将产生预期的结果。 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.但是,当它每天运行时,我会收到警报触发的通知,但我在 Application Insights 中找不到任何指示失败的信息,并且它似乎正在成功运行并完成。

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:这是来自门户的调用监控,显示过去几天相同的 function 没有失败:

在此处输入图像描述

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?问题是 - 什么可能导致 Azure Function 失败的指标在 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. blob 404 存在一些依赖关系失败,但我认为这是来自不同的 function,它明确检查路径中是否存在 blob,以了解要从外部源下载哪些文件。 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.根据@ivan-yang 对问题的评论,我已将警报切换为使用自定义日志搜索而不是内置的 Azure 函数指标。 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.在这一点上,该指标对于触发它的原因似乎非常不透明,并且每天当我运行 Azure 函数时它都在触发而没有明显的潜在故障。 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感谢@ivan-yang 和@krishnendughosh-msft 的帮助

sorry for late questions, but how do you specify a function?抱歉迟到的问题,但你如何指定 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.目前,如果一个 function 有错误,我会收到来自每个警报的邮件。 Thanks.谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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