Skip to content

Commit

Permalink
feat: live switch avax quote for 100 percent
Browse files Browse the repository at this point in the history
We check the following metrics before we decide to increase traffic switch on AVAX:

- Is AVAX still sampling at 10%, meanwhile live traffic switched at 1%?
Based on the [metrics](https://us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2#metricsV2?graph=~(metrics~(~(~(expression~'*28m1*2bm2*29*2f*28m1*2bm2*2bm3*2bm4*29*2a100~label~'AVAX*20sampling*20percent~id~'e1~period~900))~(~(expression~'*28m5*2bm6*29*2f*28m5*2bm6*2bm7*2bm8*29*2a100~label~'AVAX*20traffic*20switch*20percent~id~'e2~period~900))~(~'Uniswap~'ON_CHAIN_QUOTE_PROVIDER_EXACT_OUT_TRAFFIC_SAMPLING_CHAIN_ID_43114~'Service~'RoutingAPI~(id~'m1~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_IN_TRAFFIC_SAMPLING_CHAIN_ID_43114~'.~'.~(id~'m2~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_IN_TRAFFIC_TOTAL_CHAIN_ID_43114~'.~'.~(id~'m3~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_OUT_TRAFFIC_TOTAL_CHAIN_ID_43114~'.~'.~(id~'m4~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_IN_TRAFFIC_CURRENT_CHAIN_ID_43114~'.~'.~(id~'m7~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_OUT_TRAFFIC_CURRENT_CHAIN_ID_43114~'.~'.~(id~'m8~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_IN_TRAFFIC_TARGET_CHAIN_ID_43114~'.~'.~(id~'m5~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_OUT_TRAFFIC_TARGET_CHAIN_ID_43114~'.~'.~(id~'m6~visible~false)))~view~'timeSeries~stacked~false~region~'us-east-2~period~900~stat~'Sum~start~'-PT24H~end~'P0D)&query=~'*7bUniswap*2cService*7d*20_TRAFFIC_TARGET_CHAIN_ID_), this appears to be the same:
<img width="1286" alt="Screenshot 2024-04-23 at 9 36 12 AM" src="https://github.com/Uniswap/routing-api/assets/91580504/4dbf5cd2-4657-4e6c-961c-63c794bd08f3">

- Is the success rate on the AVAX endpoint and on each AVAX RPC call consistent?
AVAX endpoint shows the consistently high success rate:
<img width="728" alt="Screenshot 2024-04-23 at 9 58 54 AM" src="https://github.com/Uniswap/routing-api/assets/91580504/0669bea0-5123-46c4-8248-09a2a01c1593">

- Is the latency on the AVAX endpoint consistent?
AVAX latency does not change after live switch:
<img width="724" alt="Screenshot 2024-04-23 at 9 59 52 AM" src="https://github.com/Uniswap/routing-api/assets/91580504/71a1b926-7c52-404b-9998-3499b013179e">

- Is the RPC call volume only slightly up after quote shadow sampling on AVAX?
[AVAX RPC call volume](https://us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2#metricsV2?graph=~(metrics~(~(~'Uniswap~'ChainId_43114_V3QuoterQuoteLatency~'Service~'RoutingAPI~(visible~false))~(~'.~'ChainId_43114_ShadowV3QuoterQuoteLatency~'.~'.~(visible~false))~(~'.~'RPC_GATEWAY_43114_INFURA_call_SUCCESS~'.~'.)~(~'.~'RPC_GATEWAY_43114_QUIKNODE_call_FAILED~'.~'.~(visible~false))~(~'.~'RPC_GATEWAY_43114_QUIKNODE_call_SUCCESS~'.~'.)~(~'.~'RPC_GATEWAY_43114_INFURA_call_FAILED~'.~'.~(visible~false)))~view~'timeSeries~stacked~false~region~'us-east-2~start~'-PT12H~end~'P0D~period~60~stat~'Sum)&query=~'*7bUniswap*2cService*7d*2042220*20RPC*20CALL) only shows minimum increase, which is important because when we live switch, we don't expect to see any further more RPC calls due to our optimized implementations:
<img width="1286" alt="Screenshot 2024-04-23 at 10 00 57 AM" src="https://github.com/Uniswap/routing-api/assets/91580504/46d03555-62d4-468a-b160-e1895a47e578">

- Is the quote accuracy always 100% between new v3 quoter and current v3 quoter?
The [accuracy comparison](https://us-east-2.console.aws.amazon.com/cloudwatch/home?region=us-east-2#metricsV2?graph=~(metrics~(~(~(expression~'*28m7*2bm8*29*2f*28m7*2bm8*2bm9*2bm10*29*2a100~label~'Expression1~id~'e1~period~60))~(~'Uniswap~'ChainId_42220_V3QuoterQuoteLatency~'Service~'RoutingAPI~(visible~false~id~'m1))~(~'.~'ChainId_42220_ShadowV3QuoterQuoteLatency~'.~'.~(visible~false~id~'m2))~(~'.~'RPC_GATEWAY_42220_INFURA_call_SUCCESS~'.~'.~(visible~false~id~'m3))~(~'.~'RPC_GATEWAY_42220_QUIKNODE_call_FAILED~'.~'.~(visible~false~id~'m4))~(~'.~'RPC_GATEWAY_42220_QUIKNODE_call_SUCCESS~'.~'.~(visible~false~id~'m5))~(~'.~'RPC_GATEWAY_42220_INFURA_call_FAILED~'.~'.~(visible~false~id~'m6))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_IN_TRAFFIC_CURRENT_AND_TARGET_QUOTES_MATCH_CHAIN_ID_43114~'.~'.~(id~'m7~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_OUT_TRAFFIC_CURRENT_AND_TARGET_QUOTES_MATCH_CHAIN_ID_43114~'.~'.~(id~'m8~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_IN_TRAFFIC_CURRENT_AND_TARGET_QUOTES_MISMATCH_CHAIN_ID_43114~'.~'.~(id~'m9~visible~false))~(~'.~'ON_CHAIN_QUOTE_PROVIDER_EXACT_OUT_TRAFFIC_CURRENT_AND_TARGET_QUOTES_MISMATCH_CHAIN_ID_43114~'.~'.~(id~'m10~visible~false)))~view~'timeSeries~stacked~false~region~'us-east-2~start~'-PT3H~end~'P0D~period~60~stat~'Sum)&query=~'*7bUniswap*2cService*7d*2042220) shows it's always at 100%:
<img width="1288" alt="Screenshot 2024-04-23 at 10 02 40 AM" src="https://github.com/Uniswap/routing-api/assets/91580504/a8bad331-b316-436a-b422-41af34ae545d">
  • Loading branch information
jsy1218 authored Apr 23, 2024
1 parent 3dac595 commit 9d79d1c
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ export const QUOTE_PROVIDER_TRAFFIC_SWITCH_CONFIGURATION = (
case ChainId.AVALANCHE:
// Avalanche RPC eth_call traffic is about 1/100 of mainnet, so we can shadow sample 10% of traffic
return {
switchExactInPercentage: 1,
samplingExactInPercentage: 10,
switchExactOutPercentage: 1,
samplingExactOutPercentage: 10,
switchExactInPercentage: 100,
samplingExactInPercentage: 0,
switchExactOutPercentage: 100,
samplingExactOutPercentage: 0,
} as QuoteProviderTrafficSwitchConfiguration
// If we accidentally switch a traffic, we have the protection to shadow sample only 0.1% of traffic
default:
Expand Down

0 comments on commit 9d79d1c

Please sign in to comment.