Skip to content

Commit

Permalink
chore: more metrics for routes/quotes fetched (#757)
Browse files Browse the repository at this point in the history
* chore: more metrics for routes/quotes fetched

* simplify
  • Loading branch information
xrsv authored Oct 30, 2024
1 parent 25b034d commit 8bfec29
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 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,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,
Expand Down

0 comments on commit 8bfec29

Please sign in to comment.