Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gql): add sev3 alert #769

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions bin/stacks/routing-api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,41 @@ export class RoutingAPIStack extends cdk.Stack {
treatMissingData: aws_cloudwatch.TreatMissingData.NOT_BREACHING, // Missing data points are treated as "good" and within the threshold
})

// Create an alarm for when GraphQLTokenFeeFetcherFetchFeesFailure rate goes above 15%.
// We do have on chain fallback in place of GQL failure, but we want to be alerted if the failure rate is high to take action.
// For this reason we only alert on SEV3.
const graphqlTokenFeeFetcherErrorRateSev3 = new aws_cloudwatch.Alarm(
this,
'RoutingAPI-SEV3-GQLTokenFeeFetcherFailureRate',
{
alarmName: 'RoutingAPI-SEV3-GQLTokenFeeFetcherFailureRate',
metric: new MathExpression({
expression:
'100*(GraphQLTokenFeeFetcherFetchFeesFailure/(GraphQLTokenFeeFetcherFetchFeesSuccess+GraphQLTokenFeeFetcherFetchFeesFailure))',
period: Duration.minutes(5),
usingMetrics: {
GraphQLTokenFeeFetcherFetchFeesSuccess: new aws_cloudwatch.Metric({
namespace: 'Uniswap',
metricName: `GraphQLTokenFeeFetcherFetchFeesSuccess`,
dimensionsMap: { Service: 'RoutingAPI' },
unit: aws_cloudwatch.Unit.COUNT,
statistic: 'sum',
}),
GraphQLTokenFeeFetcherFetchFeesFailure: new aws_cloudwatch.Metric({
namespace: 'Uniswap',
metricName: `GraphQLTokenFeeFetcherFetchFeesFailure`,
dimensionsMap: { Service: 'RoutingAPI' },
unit: aws_cloudwatch.Unit.COUNT,
statistic: 'sum',
}),
},
}),
threshold: 15,
evaluationPeriods: 3,
treatMissingData: aws_cloudwatch.TreatMissingData.NOT_BREACHING, // Missing data points are treated as "good" and within the threshold
}
)

// Alarms for high 400 error rate for each chain
const percent4XXByChainAlarm: cdk.aws_cloudwatch.Alarm[] = []
SUPPORTED_CHAINS.forEach((chainId) => {
Expand Down Expand Up @@ -538,6 +573,7 @@ export class RoutingAPIStack extends cdk.Stack {
apiAlarm4xxSev3.addAlarmAction(new aws_cloudwatch_actions.SnsAction(chatBotTopic))
apiAlarmLatencySev3.addAlarmAction(new aws_cloudwatch_actions.SnsAction(chatBotTopic))
simulationAlarmSev3.addAlarmAction(new aws_cloudwatch_actions.SnsAction(chatBotTopic))
graphqlTokenFeeFetcherErrorRateSev3.addAlarmAction(new aws_cloudwatch_actions.SnsAction(chatBotTopic))

percent4XXByChainAlarm.forEach((alarm) => {
alarm.addAlarmAction(new aws_cloudwatch_actions.SnsAction(chatBotTopic))
Expand Down
Loading