From c5f3f6e03d44990404f11fac381c12e35db26da3 Mon Sep 17 00:00:00 2001 From: Vasilis Xouris Date: Fri, 9 Aug 2024 21:16:49 -0700 Subject: [PATCH] fix(alarm): exclude very low volume chains from 4xx alarm (no route) --- bin/stacks/routing-api-stack.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/stacks/routing-api-stack.ts b/bin/stacks/routing-api-stack.ts index 3cdccae39..35d5060e5 100644 --- a/bin/stacks/routing-api-stack.ts +++ b/bin/stacks/routing-api-stack.ts @@ -401,8 +401,10 @@ export class RoutingAPIStack extends cdk.Stack { return } const alarmName = `RoutingAPI-SEV3-4XXAlarm-ChainId: ${chainId.toString()}` + // We only want to alert if the volume is high enough over default period (5m) for 4xx errors (no route). + const invocationsThreshold = 500; const metric = new MathExpression({ - expression: '100*(response400/invocations)', + expression: `IF(invocations > ${invocationsThreshold}, 100*(response400/invocations), 0)`, usingMetrics: { invocations: new aws_cloudwatch.Metric({ namespace: 'Uniswap',