From 8bfec299001d3204483f761f57a38be04512a948 Mon Sep 17 00:00:00 2001 From: xrsv Date: Wed, 30 Oct 2024 14:49:23 -0700 Subject: [PATCH] chore: more metrics for routes/quotes fetched (#757) * chore: more metrics for routes/quotes fetched * simplify --- src/providers/on-chain-quote-provider.ts | 52 ++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/providers/on-chain-quote-provider.ts b/src/providers/on-chain-quote-provider.ts index cc22ac8dc..ebf5126ef 100644 --- a/src/providers/on-chain-quote-provider.ts +++ b/src/providers/on-chain-quote-provider.ts @@ -1223,6 +1223,58 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider { } attempt loops. Total calls made to provider: ${totalCallsMade}. Have retried for timeout: ${haveRetriedForTimeout}` ); + // Log total routes + metric.putMetric( + `${this.metricsPrefix( + this.chainId, + useMixedRouteQuoter, + mixedRouteContainsV4Pool, + protocol, + optimisticCachedRoutes + )}RoutesLength`, + routesQuotes.length, + MetricLoggerUnit.Count + ); + + // Log total quotes + metric.putMetric( + `${this.metricsPrefix( + this.chainId, + useMixedRouteQuoter, + mixedRouteContainsV4Pool, + protocol, + optimisticCachedRoutes + )}RoutesQuotesLength`, + successfulQuotes.length + failedQuotes.length, + MetricLoggerUnit.Count + ); + + // log successful quotes + metric.putMetric( + `${this.metricsPrefix( + this.chainId, + useMixedRouteQuoter, + mixedRouteContainsV4Pool, + protocol, + optimisticCachedRoutes + )}RoutesSuccessfulQuotesLength`, + successfulQuotes.length, + MetricLoggerUnit.Count + ); + + // log failed quotes + metric.putMetric( + `${this.metricsPrefix( + this.chainId, + useMixedRouteQuoter, + mixedRouteContainsV4Pool, + protocol, + optimisticCachedRoutes + )}RoutesFailedQuotesLength`, + failedQuotes.length, + MetricLoggerUnit.Count + ); + return { routesWithQuotes: routesQuotes, blockNumber,