Skip to content

Commit 024a84f

Browse files
apollo_committer: add number of modifications of each trie per block (#11918)
1 parent 8c1f466 commit 024a84f

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

crates/apollo_committer/src/committer.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ use crate::metrics::{
5353
register_metrics,
5454
COMPUTE_DURATION_PER_BLOCK,
5555
COMPUTE_DURATION_PER_BLOCK_HIST,
56+
COUNT_CLASSES_TRIE_MODIFICATIONS_PER_BLOCK,
57+
COUNT_CONTRACTS_TRIE_MODIFICATIONS_PER_BLOCK,
58+
COUNT_STORAGE_TRIES_MODIFICATIONS_PER_BLOCK,
5659
OFFSET,
5760
READ_DB_ENTRIES_PER_BLOCK,
5861
READ_DURATION_PER_BLOCK,
@@ -449,7 +452,9 @@ impl ComponentStarter for ApolloCommitter {
449452
}
450453
}
451454

452-
fn update_metrics(BlockMeasurement { n_reads, n_writes, durations, .. }: &BlockMeasurement) {
455+
fn update_metrics(
456+
BlockMeasurement { n_reads, n_writes, durations, modifications_counts }: &BlockMeasurement,
457+
) {
453458
READ_DURATION_PER_BLOCK.set_lossy(durations.read);
454459
READ_DURATION_PER_BLOCK_HIST.record_lossy(durations.read);
455460
READ_DB_ENTRIES_PER_BLOCK.set_lossy(*n_reads);
@@ -458,4 +463,7 @@ fn update_metrics(BlockMeasurement { n_reads, n_writes, durations, .. }: &BlockM
458463
WRITE_DURATION_PER_BLOCK.set_lossy(durations.write);
459464
WRITE_DURATION_PER_BLOCK_HIST.record_lossy(durations.write);
460465
WRITE_DB_ENTRIES_PER_BLOCK.set_lossy(*n_writes);
466+
COUNT_STORAGE_TRIES_MODIFICATIONS_PER_BLOCK.set_lossy(modifications_counts.storage_tries);
467+
COUNT_CONTRACTS_TRIE_MODIFICATIONS_PER_BLOCK.set_lossy(modifications_counts.contracts_trie);
468+
COUNT_CLASSES_TRIE_MODIFICATIONS_PER_BLOCK.set_lossy(modifications_counts.classes_trie);
461469
}

crates/apollo_committer/src/metrics.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ define_metrics!(
1818
"offset",
1919
"The next block number to commit"
2020
},
21+
MetricGauge {
22+
COUNT_STORAGE_TRIES_MODIFICATIONS_PER_BLOCK,
23+
"count_storage_tries_modifications_per_block",
24+
"Number of all storage tries modifications"
25+
},
26+
MetricGauge {
27+
COUNT_CONTRACTS_TRIE_MODIFICATIONS_PER_BLOCK,
28+
"count_contracts_trie_modifications_per_block",
29+
"Number of contracts trie modifications"
30+
},
31+
MetricGauge {
32+
COUNT_CLASSES_TRIE_MODIFICATIONS_PER_BLOCK,
33+
"count_classes_trie_modifications_per_block",
34+
"Number of classes trie modifications"
35+
},
2136
MetricHistogram {
2237
READ_DURATION_PER_BLOCK_HIST,
2338
"read_duration_per_block_hist",
@@ -64,6 +79,9 @@ define_metrics!(
6479
pub fn register_metrics(offset: BlockNumber) {
6580
OFFSET.register();
6681
OFFSET.set_lossy(offset.0);
82+
COUNT_STORAGE_TRIES_MODIFICATIONS_PER_BLOCK.register();
83+
COUNT_CONTRACTS_TRIE_MODIFICATIONS_PER_BLOCK.register();
84+
COUNT_CLASSES_TRIE_MODIFICATIONS_PER_BLOCK.register();
6785
READ_DURATION_PER_BLOCK_HIST.register();
6886
READ_DURATION_PER_BLOCK.register();
6987
READ_DB_ENTRIES_PER_BLOCK.register();

0 commit comments

Comments
 (0)