Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
Fix alert description for dead gateways
Browse files Browse the repository at this point in the history
  • Loading branch information
aquarat committed Jan 17, 2024
1 parent 0094578 commit ceee7d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/alerting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,10 @@ export const recordGatewayResponseSuccess = async (templateId: string, gatewayUr
const existingGatewayResult = gatewayResults[selector] ?? { badTries: 0 };

// eslint-disable-next-line functional/immutable-data
const newGatewayResultStatus = (gatewayResults[selector] = {
gatewayResults[selector] = {
...existingGatewayResult,
badTries: success ? 0 : existingGatewayResult.badTries + 1,
});
};

const baseUrl = getBaseUrl(gatewayUrl);

Expand All @@ -289,14 +289,14 @@ export const recordGatewayResponseSuccess = async (templateId: string, gatewayUr
.map((gateway) => findGateway(airnodeAddress, gateway.url)?.badTries ?? 0)
.filter((badTries) => badTries > GATEWAYS_BAD_TRIES_AFTER_WHICH_CONSIDERED_DEAD).length;

if (newGatewayResultStatus.badTries > GATEWAYS_BAD_TRIES_AFTER_WHICH_CONSIDERED_DEAD) {
if (gatewayResults[selector].badTries > GATEWAYS_BAD_TRIES_AFTER_WHICH_CONSIDERED_DEAD) {
limitedSendToOpsGenieLowLevel(
{
message: `Dead gateway for Airnode Address ${airnodeAddress}`,
priority: 'P3',
alias: `dead-gateway-${airnodeAddress}${generateOpsGenieAlias(baseUrl)}`,
description: [
`A gateway has failed at least ${newGatewayResultStatus.badTries} times.`,
`A gateway has failed at least ${gatewayResults[selector].badTries} times.`,
`If the provider doesn't have enough active gateways Airseeker won't be able to get values with which to update the beacon set.`,
`The beaconset can still be updated if a majority of feeds are available, but this isn't ideal.`,
`The hashed URL is included below.`,
Expand Down Expand Up @@ -328,7 +328,7 @@ export const recordGatewayResponseSuccess = async (templateId: string, gatewayUr
record: {
airnodeAddress: airnodeAddress,
hashedUrl: generateOpsGenieAlias(gatewayUrl),
count: newGatewayResultStatus.badTries,
count: gatewayResults[selector].badTries,
},
});
};
Expand Down

0 comments on commit ceee7d9

Please sign in to comment.