Skip to content

Commit

Permalink
feat(collator): add metric for expired external msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
serejkaaa512 authored and SmaGMan committed Jul 8, 2024
1 parent 2d43e73 commit dd3820a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 8 additions & 2 deletions collator/src/collator/do_collate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,15 +848,21 @@ impl CollatorStdImpl {
collation_data.gen_utime as u64 * 1000 + collation_data.gen_utime_ms as u64;
if next_chain_time - anchor.chain_time() > expire_timeout {
let iter = anchor.externals_iterator(0);
let mut expired_msgs_count = 0;
for ext_msg in iter {
tracing::info!(target: tracing_targets::COLLATOR_READ_NEXT_EXTS,
tracing::info!(target: tracing_targets::COLLATOR,
"ext_msg hash: {}, dst: {} is expired", ext_msg.hash(), ext_msg.info().dst,
);
expired_msgs_count += 1;
}

let labels = &[("workchain", shard_id.workchain().to_string())];
metrics::counter!("tycho_do_collate_ext_msgs_expired_count", labels)
.increment(expired_msgs_count);

// skip and remove fully expired anchor
let _ = anchors_cache.remove(next_idx);
tracing::info!(target: tracing_targets::COLLATOR_READ_NEXT_EXTS,
tracing::debug!(target: tracing_targets::COLLATOR_READ_NEXT_EXTS,
"anchor with key {} fully skipped due to expiration, removed from anchors cache", key,
);

Expand Down
5 changes: 5 additions & 0 deletions scripts/gen-dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,11 @@ def collator_do_collate() -> RowPanel:
"Ext msgs error count",
labels=['workchain=~"$workchain"'],
),
create_counter_panel(
"tycho_do_collate_ext_msgs_expired_count",
"Ext msgs expired count",
labels=['workchain=~"$workchain"'],
),
create_counter_panel(
"tycho_do_collate_msgs_read_count_int",
"Read Int msgs count",
Expand Down

0 comments on commit dd3820a

Please sign in to comment.