Skip to content
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: add metric for the latest block from the chain (tip) #172

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

anxolin
Copy link
Contributor

@anxolin anxolin commented Dec 7, 2024

Description

Follow up on #171

This PR adds the latest mined block (tip of the chain).

It allow us to build a burn-down chart on how far we are from the chain (as we consume blocks).

This is useful to see that indeed the slope is downwards.
Otherwise, we won't arrive to the tip of the chain! 😄

Changes

Include a new metric


# HELP watch_tower_block_height_latest Block height of the last block (tip of the chain)
# TYPE watch_tower_block_height_latest gauge
watch_tower_block_height_latest{chain_id="1"} 21351273

EDIT: 🚨 I had to make a follow up to this PR here #173

@anxolin anxolin requested a review from a team December 7, 2024 14:44
@anxolin
Copy link
Contributor Author

anxolin commented Dec 7, 2024

@cowprotocol/frontend , merging to test this, but please review anyways

@anxolin anxolin merged commit a6aaf36 into main Dec 7, 2024
4 checks passed
@anxolin anxolin deleted the add-latest-block branch December 7, 2024 14:45
@github-actions github-actions bot locked and limited conversation to collaborators Dec 7, 2024
Comment on lines 193 to +196
let currentBlock = await provider.getBlock("latest");
metrics.blockHeightLatest
.labels(chainId.toString())
.set(currentBlock.number);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: since this is repeated 3 times, would it be worth it to wrap around a fn? Just so we don't forget to track the metrics if we want to use this elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, i saw it only after merging. The whole code needs some serious refactoring. Lets clean it up all in the future 🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants