-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(store-indexer): add metric for distance from block tag to follow #2763
Conversation
🦋 Changeset detectedLatest commit: 6ad0bbe The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -73,6 +73,12 @@ async function getLatestStoredBlockNumber(): Promise<bigint | undefined> { | |||
return currentChainState?.lastUpdatedBlockNumber ?? undefined; | |||
} | |||
|
|||
async function getDistanceFromFollowBlock(): Promise<bigint | undefined> { | |||
const latestStoredBlockNumber = (await getLatestStoredBlockNumber()) ?? -1n; | |||
const latestFollowBlockNumber = (await publicClient.getBlock({ blockTag: env.FOLLOW_BLOCK_TAG })).number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we parallelize these to maybe have a better chance of these aligning?
@@ -73,6 +73,12 @@ async function getLatestStoredBlockNumber(): Promise<bigint | undefined> { | |||
return currentChainState?.lastUpdatedBlockNumber ?? undefined; | |||
} | |||
|
|||
async function getDistanceFromFollowBlock(): Promise<bigint | undefined> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we're always returning a bigint now - do we need undefined
here?
name: "distance_from_follow_block", | ||
help: "Block distance from the block tag this the indexer is following", | ||
async collect(): Promise<void> { | ||
this.set(Number(await getDistanceFromFollowBlock())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this.set
on a gauge only support number? vs a numeric string like BigInt.toString()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think number is better here so we can do things like >
for the alerts (and very unlikely the numbers ever get into a range where they don't fit into a number anymore)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, I just assumed that what "gauge" metric type is for, not the value we pass into the gauge
just wondering about the unlikely edge case/assumption where the bigint value > JS number max
Co-authored-by: Kevin Ingersoll <[email protected]>
No description provided.