From 62183f5487413b3df5b877edfe02668e81dee1e3 Mon Sep 17 00:00:00 2001 From: xrsv Date: Tue, 29 Oct 2024 17:45:57 -0700 Subject: [PATCH] fix(alerts): adjust noisy very low volume traffic alerts (#891) * fix(alerts): adjust noisy very low volume traffic alerts * 100 --- bin/stacks/routing-api-stack.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/stacks/routing-api-stack.ts b/bin/stacks/routing-api-stack.ts index 18eeece1ca..6ed020739e 100644 --- a/bin/stacks/routing-api-stack.ts +++ b/bin/stacks/routing-api-stack.ts @@ -438,8 +438,10 @@ export class RoutingAPIStack extends cdk.Stack { return } const alarmName = `RoutingAPI-SEV2-SuccessRate-Alarm-ChainId: ${chainId.toString()}` + // We only want to alert if the volume besides 400 errors is high enough over default period (5m) for 5xx errors. + const invocationsThreshold = 50 const metric = new MathExpression({ - expression: '100*(response200/(invocations-response400))', + expression: `IF((invocations - response400) > ${invocationsThreshold}, 100*(response200/(invocations-response400)), 100)`, usingMetrics: { invocations: new aws_cloudwatch.Metric({ namespace: 'Uniswap', @@ -481,8 +483,10 @@ export class RoutingAPIStack extends cdk.Stack { return } const alarmName = `RoutingAPI-SEV2-SuccessRate-Alarm-RequestSource: ${requestSource.toString()}` + // We only want to alert if the volume besides 400 errors is high enough over default period (5m) for 5xx errors. + const invocationsThreshold = 50 const metric = new MathExpression({ - expression: '100*(response200/(invocations-response400))', + expression: `IF((invocations - response400) > ${invocationsThreshold}, 100*(response200/(invocations-response400)), 100)`, usingMetrics: { invocations: new aws_cloudwatch.Metric({ namespace: 'Uniswap', @@ -529,8 +533,10 @@ export class RoutingAPIStack extends cdk.Stack { return } const alarmName = `RoutingAPI-SEV3-SuccessRate-Alarm-RequestSource-ChainId: ${requestSource.toString()} ${chainId}` + // We only want to alert if the volume besides 400 errors is high enough over default period (5m) for 5xx errors. + const invocationsThreshold = 50 const metric = new MathExpression({ - expression: '100*(response200/(invocations-response400))', + expression: `IF((invocations - response400) > ${invocationsThreshold}, 100*(response200/(invocations-response400)), 100)`, usingMetrics: { invocations: new aws_cloudwatch.Metric({ namespace: 'Uniswap',