我有一个用例,可在SLA未命中时发出警报。我的应用程序在startTime(M1)和endTime(M2)上发出度量。如果我的工作完成了,我可以通过执行像(M2-M1)这样的度量数学并对此发出警报来知道SLA丢失。
但是,如果我的工作陷于停顿,我仍然想通过计算(currentTime-M1)来得到提醒(可能是按计划进行的)。 AWS CloudWatch可以做到这一点吗?也欢迎使用非基于AWS的方法和解决方案!
答案 0 :(得分: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