Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cachedRoutes): add logs for tracing #936

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,50 @@ export class DynamoRouteCachingProvider extends IRouteCachingProvider {
let blockNumber: number = 0
let originalAmount: string = ''

// Log metrics how often we might be using expired cached routes when we shouldn't.
// Plan to fix this by filtering below, but for now we want to know how often this happens and where.
const numberOfExpiredCachedRoutes = cachedRoutesArr.filter(
(cachedRoutes) => !cachedRoutes.notExpired(currentBlockNumber, optimistic)
).length
const numberOfNotExpiredCachedRoutes = cachedRoutesArr.length - numberOfExpiredCachedRoutes
if (numberOfExpiredCachedRoutes > 0 && numberOfNotExpiredCachedRoutes > 0) {
metric.putMetric(`RoutesDbArrayWithMixedExpiredCachedRoutes_Opt_${optimistic}`, 1, MetricLoggerUnit.Count)
metric.putMetric(
`RoutesDbArrayWithMixedExpiredCachedRoutes_${ID_TO_NETWORK_NAME(chainId)}_Opt_${optimistic}`,
1,
MetricLoggerUnit.Count
)
// log number of expired cached routes
metric.putMetric(
`RoutesDbArrayWithMixedExpiredCachedRoutesCount_Opt_${optimistic}`,
numberOfExpiredCachedRoutes,
MetricLoggerUnit.Count
)
metric.putMetric(
`RoutesDbArrayWithMixedExpiredCachedRoutesCount_${ID_TO_NETWORK_NAME(chainId)}_Opt_${optimistic}`,
numberOfExpiredCachedRoutes,
MetricLoggerUnit.Count
)
// and total
metric.putMetric(
`RoutesDbArrayWithMixedExpiredCachedRoutesTotal_Opt_${optimistic}`,
cachedRoutesArr.length,
MetricLoggerUnit.Count
)
metric.putMetric(
`RoutesDbArrayWithMixedExpiredCachedRoutesTotal_${ID_TO_NETWORK_NAME(chainId)}_Opt_${optimistic}`,
cachedRoutesArr.length,
MetricLoggerUnit.Count
)
} else {
metric.putMetric(`RoutesDbArrayWithoutMixedExpiredCachedRoutes_Opt_${optimistic}`, 1, MetricLoggerUnit.Count)
metric.putMetric(
`RoutesDbArrayWithoutMixedExpiredCachedRoutes_${ID_TO_NETWORK_NAME(chainId)}_Opt_${optimistic}`,
1,
MetricLoggerUnit.Count
)
}

cachedRoutesArr.forEach((cachedRoutes) => {
metric.putMetric(`RoutesDbPerBlockFound`, cachedRoutes.routes.length, MetricLoggerUnit.Count)
cachedRoutes.routes.forEach((cachedRoute) => {
Expand Down
Loading