-
Notifications
You must be signed in to change notification settings - Fork 410
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(relayer): add core metric for the highest seen index in tree #5151
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5151 +/- ##
=======================================
Coverage 77.53% 77.53%
=======================================
Files 103 103
Lines 2110 2110
Branches 190 190
=======================================
Hits 1636 1636
Misses 453 453
Partials 21 21
|
.instrument(info_span!("MerkleTreeHookSync")); | ||
|
||
let index_updater_handle = | ||
tokio::spawn(TaskMonitor::instrument(&task_monitor, async move { |
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.
imo creating a new task just to update this metric & using the DB as an intermediary for this info is unnatural
I was thinking instead of having this be super merkle-tree specific, this would be more of a generic sequence number that's tracked when sequence-aware indexing
And in poking around where I'd imagine this would live, it turns out that Mantas actually added exactly this metric just a couple weeks ago 😵💫 https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/rust/main/hyperlane-base/src/contract_sync/cursors/sequence_aware/forward.rs#L456-L459
https://abacusworks.grafana.net/goto/t9kdDYDNg?orgId=1
So given we already have this metric, let's just use the one that was already added hyperlane_cursor_max_sequence
for our alert. Can you have this PR just be to rename latest_leaf_index_gauge
-> latest_tree_insertion_gauge
?
Sorry for sending you down this path - I wasn't aware of this change
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.
Looking into it though, the metrics are currently updated only when the cursor's update
fn is called
hyperlane-monorepo/rust/main/hyperlane-base/src/contract_sync/cursors/sequence_aware/forward.rs
Line 504 in fa3ef92
self.update_metrics().await; |
We only hit this code path if we actually index something, so it means upon startup we don't set the metric until we actually index something. e.g. we haven't had any usage on zksync for a long time so there's no hyperlane_cursor_max_sequence
metric for zksync
Can you change this so that we call update_metrics()
from get_next_range
like around here?
hyperlane-monorepo/rust/main/hyperlane-base/src/contract_sync/cursors/sequence_aware/forward.rs
Line 129 in fa3ef92
let (Some(onchain_sequence_count), tip) = self |
And can you also make it so that the update_metrics
fn doesn't do let max_sequence = self.target_sequence().await as i64;
itself, and instead we pass it in from get_next_range
?
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.
for some reason, the sealevel changes are showing up here so I'm closing this issue and making the changes here: #5178
Description
Drive-by changes
None
Related issues
Backward compatibility
Yes
Testing
invariant in e2e and manually testing