Skip to content

Commit

Permalink
chore: more metrics for routes/quotes fetched
Browse files Browse the repository at this point in the history
  • Loading branch information
xrsv committed Oct 30, 2024
1 parent 25b034d commit d7847a9
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/providers/on-chain-quote-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,60 @@ 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`,
routesQuotes
.map((routeWithQuotes) => routeWithQuotes[1].length)
.reduce((a, b) => a + b, 0),
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,
Expand Down

0 comments on commit d7847a9

Please sign in to comment.