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: cursor metrics #4892

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Mantas-M
Copy link
Contributor

Description

Adds metrics to ForwardBackward cursor in order to be able to monitor sync progress more effectively.

Introduced metrics

  • cursor_current_block: Which block is the forward and backward cursor indexing currently for each event
    Cursor Current Block BSC
    Example above shows all event average

  • cursor_current_sequence: Which sequence is the cursor currently on for a specific event
    Cursor Current Sequence
    As in the graph for Base above, we can see that the Forward cursor only begins showing data if there are new events to index since agent launch

  • cursor_max_sequence: The max sequence the cursor can reach

image

Related issues

Backward compatibility

Yes

Testing

Manual

Copy link

changeset-bot bot commented Nov 24, 2024

⚠️ No Changeset found

Latest commit: f98afce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Mantas-M
Copy link
Contributor Author

Mantas-M commented Nov 27, 2024

Read the issue again and I thought to refactor the metrics to be cursor generic due to this requirement set by @daniel-savu
for all event types (regardless if sequenced or not): the block number the cursor(s) are currently at

Initially seems like it would be not necessary due to the contract_sync_block_height metric doing mostly the same thing:

image

But this makes it cleaner in my opinion and when/if the internal Grafana dashboards would be migrated to the new metric, contract_sync_block_height could be removed entirely.

Now with the CursorMetrics being passed in to both the RateLimitedContractSyncCursor and the ForwardBackwardSequenceAwareSyncCursor we get a more verbose group of metrics from both sequence aware and non sequence aware event indexing cursor block heights:

image

Additionally, since the implementation of name on the Indexable trait, we could technically remove the label strings passed into the sync function making it a bit nicer and keeping all the hardcoded strings on the Indexable trait implementation.

image

@Mantas-M Mantas-M changed the title feat: forward-backward cursor metrics feat: cursor metrics Nov 28, 2024
/// Labels:
/// - `event_type`: the event type the cursor is indexing. Could be anything implementing `Indexable`.
/// - `chain`: Chain the cursor is collecting data from.
/// - `cursor_type`: The type of cursor. E.g. `forward_sequenced`, `backward_sequenced`, `forward_rate_limited` or `backward_rate_limited`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if values forward_rate_limited and backward_rate_limited are valid for this metric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

forward_rate_limited is indeed valid as it's the only mode for the RateLimitedCursor, as seen here

backward_rate_limited removed in both occurrences.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

Expose metrics for sequence indexing cursor progress
2 participants