[Blockchain Watcher] (FIX) Improve evm logs (#1130)
* Improve evm log * Mapped last cursos for sui * Mapped last cursos for sui --------- Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Pro.local>
This commit is contained in:
parent
024c29d67d
commit
87f6383f4a
|
@ -18,7 +18,7 @@ export class PollSuiTransactions extends RunPollingJob {
|
|||
protected readonly logger: Logger;
|
||||
|
||||
private cursor?: Cursor;
|
||||
private lastCheckpoint?: bigint;
|
||||
private currentCheckpoint?: bigint;
|
||||
|
||||
constructor(
|
||||
private readonly cfg: PollSuiTransactionsConfig,
|
||||
|
@ -33,6 +33,7 @@ export class PollSuiTransactions extends RunPollingJob {
|
|||
protected async preHook(): Promise<void> {
|
||||
const metadata = await this.metadataRepo.get(this.cfg.id);
|
||||
if (metadata) {
|
||||
this.currentCheckpoint = metadata.lastCursor?.checkpoint;
|
||||
this.cursor = metadata.lastCursor;
|
||||
}
|
||||
}
|
||||
|
@ -48,23 +49,6 @@ export class PollSuiTransactions extends RunPollingJob {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected report(): void {
|
||||
const labels = {
|
||||
job: this.cfg.id,
|
||||
chain: "sui",
|
||||
commitment: "immediate",
|
||||
};
|
||||
this.statsRepo.count("job_execution", labels);
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.lastCheckpoint ?? 0), {
|
||||
...labels,
|
||||
type: "max",
|
||||
});
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.cursor?.checkpoint ?? 0n), {
|
||||
...labels,
|
||||
type: "current",
|
||||
});
|
||||
}
|
||||
|
||||
protected async get(): Promise<any[]> {
|
||||
this.cursor = await this.getCursor();
|
||||
|
||||
|
@ -119,6 +103,23 @@ export class PollSuiTransactions extends RunPollingJob {
|
|||
await this.metadataRepo.save(this.cfg.id, { lastCursor: this.cursor });
|
||||
}
|
||||
}
|
||||
|
||||
protected report(): void {
|
||||
const labels = {
|
||||
job: this.cfg.id,
|
||||
chain: "sui",
|
||||
commitment: "immediate",
|
||||
};
|
||||
this.statsRepo.count("job_execution", labels);
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.cursor?.checkpoint ?? 0), {
|
||||
...labels,
|
||||
type: "max",
|
||||
});
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.currentCheckpoint ?? 0n), {
|
||||
...labels,
|
||||
type: "current",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class PollSuiTransactionsConfig {
|
||||
|
|
|
@ -36,7 +36,7 @@ export const evmRedeemedTransactionFoundMapper = (
|
|||
|
||||
if (protocol && protocol.type && protocol.method) {
|
||||
logger.debug(
|
||||
`[${transaction.chain}] Transaction info: [hash: ${transaction.hash}][VAA: ${emitterChain}/${emitterAddress}/${sequence}]`
|
||||
`[${transaction.chain}] Transaction info: [hash: ${transaction.hash}][VAA: ${emitterChain}/${emitterAddress}/${sequence}][protocol: ${protocol.type}/${protocol.method}]`
|
||||
);
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue