diff --git a/bin/stacks/dashboard-stack.ts b/bin/stacks/dashboard-stack.ts index 07daa782..55b872b1 100644 --- a/bin/stacks/dashboard-stack.ts +++ b/bin/stacks/dashboard-stack.ts @@ -505,6 +505,26 @@ export class DashboardStack extends cdk.NestedStack { stat: 'Sum', }, }, + { + height: 6, + width: 12, + y: 68, + x: 0, + type: 'metric', + properties: { + metrics: _.flatMap(SUPPORTED_CHAINS, (chainId) => [ + ['Uniswap', `NotificationRecordStaleness-chain-${chainId}`, 'Service', `UniswapXService`], + ['.', '.', '.', `.`, { stat: 'p99' }], + ['.', '.', '.', `.`, { stat: 'p50' }], + ['.', '.', '.', `.`, { stat: 'Average' }], + ]), + view: 'timeSeries', + region, + title: 'DutchV2 Notification Record Staleness', + period: 300, + stat: 'p90', + }, + }, { height: 1, width: 24, diff --git a/bin/stacks/lambda-stack.ts b/bin/stacks/lambda-stack.ts index 6df2c4cf..f3cd6c0d 100644 --- a/bin/stacks/lambda-stack.ts +++ b/bin/stacks/lambda-stack.ts @@ -53,7 +53,7 @@ export class LambdaStack extends cdk.NestedStack { const { provisionedConcurrency, kmsKey, tableCapacityConfig, indexCapacityConfig, chatbotSNSArn } = props const lambdaName = `${SERVICE_NAME}Lambda` - const orderNotificationProvisionedConcurrency = 10 + const orderNotificationProvisionedConcurrency = 50 const lambdaRole = new aws_iam.Role(this, `${lambdaName}-LambdaRole`, { assumedBy: new aws_iam.ServicePrincipal('lambda.amazonaws.com'), @@ -165,7 +165,7 @@ export class LambdaStack extends cdk.NestedStack { const notificationConfig = { startingPosition: aws_lambda.StartingPosition.TRIM_HORIZON, - batchSize: 10, + batchSize: 1, retryAttempts: 0, bisectBatchOnError: true, reportBatchItemFailures: true, diff --git a/lib/handlers/order-notification/handler.ts b/lib/handlers/order-notification/handler.ts index b12cc5f9..dc6e528d 100644 --- a/lib/handlers/order-notification/handler.ts +++ b/lib/handlers/order-notification/handler.ts @@ -32,15 +32,20 @@ export class OrderNotificationHandler extends DynamoStreamLambdaHandler DUTCHV2_ORDER_LATENCY_THRESHOLD_SEC) { + // GPA currently sets mainnet decay start to 24 secs into the future + if (newOrder.chainId == ChainId.MAINNET && decayTimeDifference > DUTCHV2_ORDER_LATENCY_THRESHOLD_SEC) { const staleOrderMetricName = `NotificationStaleOrder-chain-${newOrder.chainId.toString()}` metrics.putMetric(staleOrderMetricName, 1, Unit.Count) } - const staleOrderMetricName = `NotificationOrderStaleness-chain-${newOrder.chainId.toString()}` - metrics.putMetric(staleOrderMetricName, timeDifference) + const orderStalenessMetricName = `NotificationOrderStaleness-chain-${newOrder.chainId.toString()}` + metrics.putMetric(orderStalenessMetricName, decayTimeDifference) } const registeredEndpoints = await webhookProvider.getEndpoints({