4

我有一个用例可以在 SLA 未命中时发出警报。我的应用程序在 startTime (M1) 和 endTime (M2) 上发出指标。如果我的工作完成,我将能够通过像 (M2-M1) 这样的度量数学来了解 SLA 未命中并对此发出警报。

但是如果我的工作卡住了,我仍然希望通过计算 (currentTime-M1) 得到警报(可能会按计划进行)。AWS CloudWatch 可以做到这一点吗?也欢迎非基于 AWS 的方法和解决方案!!

4

1 回答 1

0

也许您可以创建一个 CloudWatch 洞察查询,如下所示:

fields ispresent(execution_arn) as isRes
| filter isRes 
| filter type in ["ExecutionStarted", "ExecutionSucceeded", "ExecutionFailed", "ExecutionAborted", "ExecutionTimedOut"]
| stats latest(type) as status, 
  earliest (event_timestamp) as starttime, 
  latest (event_timestamp) as endtime, 
  endtime - starttime as duration  by execution_arn
| sort duration desc

您必须为状态机启用 CW 日志: https ://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html

于 2020-10-27T18:20:36.807 回答