Skip to content

Commit a1136b9

Browse files
authored
feat(api): Update events to incrementing metrics for chainport (#1797)
1 parent e7fed1f commit a1136b9

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/bridges/chainport.service.ts

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -267,32 +267,29 @@ export class ChainportService {
267267
token.web3_address,
268268
);
269269
if (!asset) {
270-
this.datadogService.event(
271-
'Mismatched asset',
272-
`Could not find asset ${token.web3_address}`,
273-
{ alert_type: 'error' },
274-
);
270+
this.datadogService.increment('chainport.errors', 1, {
271+
type: 'missing_asset',
272+
asset: token.web3_address,
273+
});
275274
continue;
276275
}
277276

278277
if (!asset.verified_metadata) {
279-
this.datadogService.event(
280-
'Unverified asset',
281-
`Asset ${asset.identifier} is unverified`,
282-
{ alert_type: 'warning' },
283-
);
278+
this.datadogService.increment('chainport.errors', 1, {
279+
type: 'unverified_asset',
280+
asset: asset.identifier,
281+
});
284282
continue;
285283
}
286284

287285
if (asset.verified_metadata.decimals !== token.decimals) {
288-
const message = `${asset.identifier}
289-
Iron Fish: ${asset.verified_metadata.decimals ?? 'null'}
290-
Chainport: ${token.decimals}`;
291-
this.datadogService.event(
292-
'Mismatched verified asset decimals',
293-
message,
294-
{ alert_type: 'warning' },
295-
);
286+
this.datadogService.increment('chainport.errors', 1, {
287+
type: 'mismatched_decimals',
288+
iron_fish_decimals: (
289+
asset.verified_metadata.decimals ?? 0
290+
).toString(),
291+
chainport_decimals: token.decimals.toString(),
292+
});
296293
continue;
297294
}
298295

0 commit comments

Comments
 (0)