Skip to content

Commit

Permalink
fix: rpc gateway dashboard missing latencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy1218 committed May 24, 2024
1 parent 6b43be9 commit e8e9963
Showing 1 changed file with 13 additions and 70 deletions.
83 changes: 13 additions & 70 deletions bin/stacks/rpc-gateway-dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as aws_cloudwatch from 'aws-cdk-lib/aws-cloudwatch'
import { Construct } from 'constructs'
import _ from 'lodash'
import { ID_TO_NETWORK_NAME } from '@uniswap/smart-order-router/build/main/util/chains'
import { MAJOR_METHOD_NAMES } from '../../lib/rpc/SingleJsonRpcProvider'
import { CallType, MAJOR_METHOD_NAMES } from '../../lib/rpc/SingleJsonRpcProvider'
import { SUPPORTED_CHAINS } from '../../lib/handlers/injector-sor'
import { TESTNETS } from '../../lib/util/testNets'
import { getRpcGatewayEnabledChains } from '../../lib/rpc/ProdConfig'
Expand Down Expand Up @@ -97,16 +97,18 @@ function getLatencyMetricsForChain(chainId: ChainId) {
const metrics = []
for (const providerName of getProviderNameForChain(chainId)) {
for (const methodName of MAJOR_METHOD_NAMES) {
metrics.push([
'Uniswap',
`RPC_GATEWAY_${chainId}_${providerName}_evaluated_latency_${methodName}`,
'Service',
'RoutingAPI',
{
id: `${methodName}_latency_${chainId}_${providerName}`,
label: `${providerName} ${methodName} latency on ${ID_TO_NETWORK_NAME(chainId)}`,
},
])
for (const callType of Object.values(CallType)) {
metrics.push([
'Uniswap',
`RPC_GATEWAY_${chainId}_${providerName}_evaluated_${callType as CallType}_latency_${methodName}`,
'Service',
'RoutingAPI',
{
id: `${methodName}_latency_${chainId}_${providerName}`,
label: `${providerName} ${methodName} sampling latency on ${ID_TO_NETWORK_NAME(chainId)}`,
},
])
}
}
}
return metrics
Expand Down Expand Up @@ -220,23 +222,6 @@ function getDbSyncFailMetricsForChain(chainId: ChainId) {
return metrics
}

function getEvaluateLatencyMetricsForChain(chainId: ChainId) {
const metrics = []
for (const providerName of getProviderNameForChain(chainId)) {
metrics.push([
'Uniswap',
`RPC_GATEWAY_${chainId}_${providerName}_evaluate_latency`,
'Service',
'RoutingAPI',
{
id: `evaluate_latency_${chainId}_${providerName}`,
label: `${providerName} (Shadow) Evaluate latency for ${ID_TO_NETWORK_NAME(chainId)}`,
},
])
}
return metrics
}

function getCheckHealthMetricsForChain(chainId: ChainId) {
const metrics = []
for (const providerName of getProviderNameForChain(chainId)) {
Expand Down Expand Up @@ -592,27 +577,6 @@ export class RpcGatewayDashboardStack extends cdk.NestedStack {
},
},
},
{
height: 8,
width: 24,
type: 'metric',
properties: {
metrics: getProviderDbHealthStateChangeForChain(chainId),
view: 'timeSeries',
stacked: false,
region,
stat: 'Maximum',
period: 300,
title: `Provider DB health change for ${ID_TO_NETWORK_NAME(chainId)}`,
setPeriodToTimeRange: true,
yAxis: {
left: {
showUnits: false,
label: 'DB health state changes',
},
},
},
},
{
height: 8,
width: 24,
Expand Down Expand Up @@ -823,27 +787,6 @@ export class RpcGatewayDashboardStack extends cdk.NestedStack {
},
},
},
{
height: 8,
width: 24,
type: 'metric',
properties: {
metrics: getEvaluateLatencyMetricsForChain(chainId),
view: 'timeSeries',
stacked: false,
region,
stat: 'Sum',
period: 300,
title: `(Shadow) Evaluate latency call for ${ID_TO_NETWORK_NAME(chainId)}`,
setPeriodToTimeRange: true,
yAxis: {
left: {
showUnits: false,
label: 'Occurrences',
},
},
},
},
{
height: 8,
width: 24,
Expand Down

0 comments on commit e8e9963

Please sign in to comment.