[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": {
|
"sui": {
|
||||||
"network": "mainnet",
|
"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": {
|
"aptos": {
|
||||||
"network": "mainnet",
|
"network": "mainnet",
|
||||||
|
|
|
@ -91,15 +91,26 @@ export class PollAptos extends RunPollingJob {
|
||||||
chain: "aptos",
|
chain: "aptos",
|
||||||
commitment: this.cfg.getCommitment(),
|
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.count("job_execution", labels);
|
||||||
this.statsRepo.measure("polling_cursor", this.lastFrom ?? 0n, {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", lastFrom, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "max",
|
type: "max",
|
||||||
});
|
});
|
||||||
this.statsRepo.measure("polling_cursor", this.previousFrom ?? 0n, {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", previousFrom, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "current",
|
type: "current",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.statsRepo.measure("polling_cursor", diffCursor, {
|
||||||
|
...labels,
|
||||||
|
type: "diff",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,15 +129,26 @@ export class PollEvm extends RunPollingJob {
|
||||||
chain: this.cfg.chain ?? "",
|
chain: this.cfg.chain ?? "",
|
||||||
commitment: this.cfg.getCommitment(),
|
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.count("job_execution", labels);
|
||||||
this.statsRepo.measure("polling_cursor", this.latestBlockHeight ?? 0n, {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", latestBlockHeight, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "max",
|
type: "max",
|
||||||
});
|
});
|
||||||
this.statsRepo.measure("polling_cursor", this.blockHeightCursor ?? 0n, {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", blockHeightCursor, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "current",
|
type: "current",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.statsRepo.measure("polling_cursor", diffCursor, {
|
||||||
|
...labels,
|
||||||
|
type: "diff",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,15 +134,26 @@ export class PollSolanaTransactions extends RunPollingJob {
|
||||||
chain: "solana",
|
chain: "solana",
|
||||||
commitment: this.cfg.commitment,
|
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.count("job_execution", labels);
|
||||||
this.statsRepo.measure("polling_cursor", BigInt(this.latestSlot ?? 0), {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", latestSlot, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "max",
|
type: "max",
|
||||||
});
|
});
|
||||||
this.statsRepo.measure("polling_cursor", BigInt(this.slotCursor ?? 0n), {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", slotCursor, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "current",
|
type: "current",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.statsRepo.measure("polling_cursor", BigInt(diffCursor), {
|
||||||
|
...labels,
|
||||||
|
type: "diff",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,15 +110,26 @@ export class PollSuiTransactions extends RunPollingJob {
|
||||||
chain: "sui",
|
chain: "sui",
|
||||||
commitment: "immediate",
|
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.count("job_execution", labels);
|
||||||
this.statsRepo.measure("polling_cursor", BigInt(this.cursor?.checkpoint ?? 0), {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", checkpoint, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "max",
|
type: "max",
|
||||||
});
|
});
|
||||||
this.statsRepo.measure("polling_cursor", BigInt(this.currentCheckpoint ?? 0n), {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", currentCheckpoint, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "current",
|
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 ?? "",
|
chain: this.cfg.chain ?? "",
|
||||||
commitment: this.cfg.getCommitment(),
|
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.count("job_execution", labels);
|
||||||
this.statsRepo.measure("polling_cursor", this.latestBlockHeight ?? 0n, {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", latestBlockHeight, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "max",
|
type: "max",
|
||||||
});
|
});
|
||||||
this.statsRepo.measure("polling_cursor", this.blockHeightCursor ?? 0n, {
|
|
||||||
|
this.statsRepo.measure("polling_cursor", blockHeightCursor, {
|
||||||
...labels,
|
...labels,
|
||||||
type: "current",
|
type: "current",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.statsRepo.measure("polling_cursor", diffCursor, {
|
||||||
|
...labels,
|
||||||
|
type: "diff",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue