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

Expose metrics for sequence indexing cursor progress #4715

Open
Tracked by #3321
daniel-savu opened this issue Oct 21, 2024 · 9 comments · May be fixed by #4892
Open
Tracked by #3321

Expose metrics for sequence indexing cursor progress #4715

daniel-savu opened this issue Oct 21, 2024 · 9 comments · May be fixed by #4892

Comments

@daniel-savu
Copy link
Contributor

daniel-savu commented Oct 21, 2024

Context

Sequenced events like HyperlaneMessage and MerkleTreeInsertion are indexed using a forward-backward cursor which is initialized to the sequence number at the blockchain tip, when the agent is started.

For instance, if the last HyperlaneMessage had nonce 123, the forward-backward cursor would instantiate:

  • a forward cursor that looks for messages in new blocks, with nonces 124 and up
  • a backward cursor that iterates blocks from the tip back to genesis (or to whatever is configured in index.from)

Problem

When an RPC becomes healthy after an outage, it's hard to know if agents are making any progress indexing the missed events over that period. If they're running but not making any progress, the RPC may still be having issues. The only way to know this is by checking raw logs, which requires knowledge of what to look for.

Suggested Solution

A simple way to provide better observability here is to have some new Prometheus metrics for indexed events:

  • for all event types (regardless if sequenced or not): the block number the cursor(s) are currently at
  • for sequenced events: the sequence number that the backward and forward cursors are on, and the max known sequence

To continue with the HyperlaneMessage example, the metrics at a random point for a given chain would look something like:

  • cursor_current_block{eventType: 'HyperlaneMessage', cursorType: 'ForwardSequenced'}: 118000
  • cursor_current_sequence{eventType: 'HyperlaneMessage', cursorType: 'ForwardSequenced'}: 240
  • cursor_current_block{eventType: 'HyperlaneMessage', cursorType: 'BackwardSequenced'}: 91021
  • cursor_current_sequence{eventType: 'HyperlaneMessage', cursorType: 'BackwardSequenced'}: 82
  • cursor_max_sequence{eventType: 'HyperlaneMessage'}: 345

Based on this, it will be much easier to have dashboard showing the indexing progress agents make after each RPC rotation and restart, per indexed event and chain.

@RajVerma97
Copy link

can you assign me?
and how much is the bounty?

@daniel-savu
Copy link
Contributor Author

can you assign me? and how much is the bounty?

@RajVerma97 sure thing! The approximate scope I assigned is small which is $500. If it ends up being easier than expected, it'll be extra-small which is $250. KYC is required FYI

@RajVerma97
Copy link

got it

@RajVerma97
Copy link

i am having issues in running the project locally
i did npm install
then npm run build
still cant see the project locally

@paulbalaji
Copy link
Contributor

i am having issues in running the project locally i did npm install then npm run build still cant see the project locally

please read the "working on hyperlane" section of the monorepo README. For further questions, join the discord and ask the community for help. https://github.com/hyperlane-xyz/hyperlane-monorepo#working-on-hyperlane

@RajVerma97
Copy link

Screenshot 2024-10-23 at 5 21 32 PM

do i have to add the metrics here?

@daniel-savu
Copy link
Contributor Author

daniel-savu commented Oct 28, 2024

@RajVerma97 sorry I won't be able to provide too much support here, have you been able to make progress?

@RajVerma97 RajVerma97 removed their assignment Oct 28, 2024
@RajVerma97
Copy link

sorry i wasnt able to move forward

@Mantas-M
Copy link
Contributor

On it 🫡

@Mantas-M Mantas-M linked a pull request Nov 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

4 participants