Skip to content

Commit

Permalink
parse abacus context. better route error event details
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam committed Aug 23, 2024
1 parent 8824735 commit 9a8964b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/constants/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ export const AnalyticsEvents = unionize(
amount: string;
chainId?: string;
assetaddress?: string;
assetSymbol: string;
assetName: string;
assetSymbol?: string;
assetName?: string;
}>(),
},
{ tag: 'type' as const, value: 'payload' as const }
Expand Down
7 changes: 4 additions & 3 deletions src/lib/abacus/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ class AbacusLogger implements Omit<AbacusLoggingProtocol, '__doNotUseOrImplement
dd.error(message, context, error);
}

ddInfo(tag: string, message: string, context: object) {
ddInfo(tag: string, message: string, context: string) {
const parsedContext = JSON.parse(context.toString());
if (import.meta.env.VITE_ABACUS_LOG_LEVEL === 'debug') {
console.log(`${tag} dd info: ${message}`, context);
console.log(`${tag} dd info: ${message}`, parsedContext);
}
dd.info(message, context);
dd.info(message, parsedContext);
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/views/forms/AccountManagementForms/DepositForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,10 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
errorMessage: routeErrorMessage ?? undefined,
amount: debouncedAmount,
chainId: chainIdStr ?? undefined,
assetAddress: sourceToken?.address,
assetSymbol: sourceToken?.symbol,
assetName: sourceToken?.name,
assetAddress: sourceToken?.address ?? undefined,
assetSymbol: sourceToken?.symbol ?? undefined,
assetName: sourceToken?.name ?? undefined,
assetId: sourceToken?.toString() ?? undefined,
};
track(AnalyticsEvents.RouteError(routeErrorContext));
dd.info('Route error received', routeErrorContext);
Expand Down
7 changes: 4 additions & 3 deletions src/views/forms/AccountManagementForms/WithdrawForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,10 @@ export const WithdrawForm = () => {
errorMessage: routeErrorMessageOverride ?? undefined,
amount: debouncedAmount,
chainId: chainIdStr ?? undefined,
assetAddress: toToken?.address,
assetSymbol: toToken?.symbol,
assetName: toToken?.name,
assetAddress: toToken?.address ?? undefined,
assetSymbol: toToken?.symbol ?? undefined,
assetName: toToken?.name ?? undefined,
assetId: toToken?.toString() ?? undefined,
};
track(AnalyticsEvents.RouteError(routeErrorContext));
dd.info('Route error received', routeErrorContext);
Expand Down

0 comments on commit 9a8964b

Please sign in to comment.