Skip to content

Commit

Permalink
feat(api): Update events to incrementing metrics for chainport (#1797)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanjadvani authored Dec 10, 2024
1 parent e7fed1f commit a1136b9
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions src/bridges/chainport.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,32 +267,29 @@ export class ChainportService {
token.web3_address,
);
if (!asset) {
this.datadogService.event(
'Mismatched asset',
`Could not find asset ${token.web3_address}`,
{ alert_type: 'error' },
);
this.datadogService.increment('chainport.errors', 1, {
type: 'missing_asset',
asset: token.web3_address,
});
continue;
}

if (!asset.verified_metadata) {
this.datadogService.event(
'Unverified asset',
`Asset ${asset.identifier} is unverified`,
{ alert_type: 'warning' },
);
this.datadogService.increment('chainport.errors', 1, {
type: 'unverified_asset',
asset: asset.identifier,
});
continue;
}

if (asset.verified_metadata.decimals !== token.decimals) {
const message = `${asset.identifier}
Iron Fish: ${asset.verified_metadata.decimals ?? 'null'}
Chainport: ${token.decimals}`;
this.datadogService.event(
'Mismatched verified asset decimals',
message,
{ alert_type: 'warning' },
);
this.datadogService.increment('chainport.errors', 1, {
type: 'mismatched_decimals',
iron_fish_decimals: (
asset.verified_metadata.decimals ?? 0
).toString(),
chainport_decimals: token.decimals.toString(),
});
continue;
}

Expand Down

0 comments on commit a1136b9

Please sign in to comment.