Skip to content

Commit

Permalink
fix(alerts): adjust noisy very low volume traffic alerts (#891)
Browse files Browse the repository at this point in the history
* fix(alerts): adjust noisy very low volume traffic alerts

* 100
  • Loading branch information
xrsv authored Oct 30, 2024
1 parent 1f99389 commit 62183f5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bin/stacks/routing-api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 62183f5

Please sign in to comment.