[Blockchain Watcher] (METRICS) Map block high diff metric (#1397)
* Map block high diff metric * Map block high diff metric --------- Co-authored-by: julian merlo <julianmerlo@julians-MacBook-Pro.local>
This commit is contained in:
parent
b8e3f43333
commit
c3950c4fb9
|
@ -112,7 +112,7 @@
|
|||
},
|
||||
"sui": {
|
||||
"network": "mainnet",
|
||||
"rpcs": ["https://fullnode.mainnet.sui.io:443", "http://m-sui-01.nodes.stable.io:8546"]
|
||||
"rpcs": ["https://fullnode.mainnet.sui.io:443"]
|
||||
},
|
||||
"aptos": {
|
||||
"network": "mainnet",
|
||||
|
|
|
@ -91,15 +91,26 @@ export class PollAptos extends RunPollingJob {
|
|||
chain: "aptos",
|
||||
commitment: this.cfg.getCommitment(),
|
||||
};
|
||||
const lastFrom = this.lastFrom ?? 0n;
|
||||
const previousFrom = this.previousFrom ?? 0n;
|
||||
const diffCursor = BigInt(lastFrom) - BigInt(previousFrom);
|
||||
|
||||
this.statsRepo.count("job_execution", labels);
|
||||
this.statsRepo.measure("polling_cursor", this.lastFrom ?? 0n, {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", lastFrom, {
|
||||
...labels,
|
||||
type: "max",
|
||||
});
|
||||
this.statsRepo.measure("polling_cursor", this.previousFrom ?? 0n, {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", previousFrom, {
|
||||
...labels,
|
||||
type: "current",
|
||||
});
|
||||
|
||||
this.statsRepo.measure("polling_cursor", diffCursor, {
|
||||
...labels,
|
||||
type: "diff",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,15 +129,26 @@ export class PollEvm extends RunPollingJob {
|
|||
chain: this.cfg.chain ?? "",
|
||||
commitment: this.cfg.getCommitment(),
|
||||
};
|
||||
const latestBlockHeight = this.latestBlockHeight ?? 0n;
|
||||
const blockHeightCursor = this.blockHeightCursor ?? 0n;
|
||||
const diffCursor = BigInt(latestBlockHeight) - BigInt(blockHeightCursor);
|
||||
|
||||
this.statsRepo.count("job_execution", labels);
|
||||
this.statsRepo.measure("polling_cursor", this.latestBlockHeight ?? 0n, {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", latestBlockHeight, {
|
||||
...labels,
|
||||
type: "max",
|
||||
});
|
||||
this.statsRepo.measure("polling_cursor", this.blockHeightCursor ?? 0n, {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", blockHeightCursor, {
|
||||
...labels,
|
||||
type: "current",
|
||||
});
|
||||
|
||||
this.statsRepo.measure("polling_cursor", diffCursor, {
|
||||
...labels,
|
||||
type: "diff",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -134,15 +134,26 @@ export class PollSolanaTransactions extends RunPollingJob {
|
|||
chain: "solana",
|
||||
commitment: this.cfg.commitment,
|
||||
};
|
||||
const latestSlot = BigInt(this.latestSlot ?? 0);
|
||||
const slotCursor = BigInt(this.slotCursor ?? 0);
|
||||
const diffCursor = latestSlot - slotCursor;
|
||||
|
||||
this.statsRepo.count("job_execution", labels);
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.latestSlot ?? 0), {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", latestSlot, {
|
||||
...labels,
|
||||
type: "max",
|
||||
});
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.slotCursor ?? 0n), {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", slotCursor, {
|
||||
...labels,
|
||||
type: "current",
|
||||
});
|
||||
|
||||
this.statsRepo.measure("polling_cursor", BigInt(diffCursor), {
|
||||
...labels,
|
||||
type: "diff",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,15 +110,26 @@ export class PollSuiTransactions extends RunPollingJob {
|
|||
chain: "sui",
|
||||
commitment: "immediate",
|
||||
};
|
||||
const checkpoint = BigInt(this.cursor?.checkpoint ?? 0);
|
||||
const currentCheckpoint = BigInt(this.currentCheckpoint ?? 0);
|
||||
const diffCursor = checkpoint - currentCheckpoint;
|
||||
|
||||
this.statsRepo.count("job_execution", labels);
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.cursor?.checkpoint ?? 0), {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", checkpoint, {
|
||||
...labels,
|
||||
type: "max",
|
||||
});
|
||||
this.statsRepo.measure("polling_cursor", BigInt(this.currentCheckpoint ?? 0n), {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", currentCheckpoint, {
|
||||
...labels,
|
||||
type: "current",
|
||||
});
|
||||
|
||||
this.statsRepo.measure("polling_cursor", BigInt(diffCursor), {
|
||||
...labels,
|
||||
type: "diff",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,15 +114,26 @@ export class PollWormchain extends RunPollingJob {
|
|||
chain: this.cfg.chain ?? "",
|
||||
commitment: this.cfg.getCommitment(),
|
||||
};
|
||||
const latestBlockHeight = this.latestBlockHeight ?? 0n;
|
||||
const blockHeightCursor = this.blockHeightCursor ?? 0n;
|
||||
const diffCursor = latestBlockHeight - blockHeightCursor;
|
||||
|
||||
this.statsRepo.count("job_execution", labels);
|
||||
this.statsRepo.measure("polling_cursor", this.latestBlockHeight ?? 0n, {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", latestBlockHeight, {
|
||||
...labels,
|
||||
type: "max",
|
||||
});
|
||||
this.statsRepo.measure("polling_cursor", this.blockHeightCursor ?? 0n, {
|
||||
|
||||
this.statsRepo.measure("polling_cursor", blockHeightCursor, {
|
||||
...labels,
|
||||
type: "current",
|
||||
});
|
||||
|
||||
this.statsRepo.measure("polling_cursor", diffCursor, {
|
||||
...labels,
|
||||
type: "diff",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue