Skip to content

Commit f6aaba4

Browse files
authored
feat(consensus): add new metrics for commits in starfish (#9155)
# Description of change PR adds metrics to Starfish to track the number of non-empty committed blocks per commit and per authority. ## How the change has been tested - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [ ] Patch-specific tests (correctness, functionality coverage) - [ ] I have added tests that prove my fix is effective or that my feature works - [x] I have checked that new and existing unit tests pass locally with my changes
1 parent d2e815a commit f6aaba4

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

crates/starfish/core/src/commit_observer.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,19 @@ impl CommitObserver {
379379
.map(|x| x.transactions().len())
380380
.sum::<usize>() as f64,
381381
);
382+
// Report the number of blocks committed with transactions per commit
383+
metrics
384+
.non_empty_blocks_per_commit_count
385+
.observe(commit.transactions.len() as f64);
386+
// Report the number of blocks committed with transactions per authority
387+
for verified_transaction in &commit.transactions {
388+
let authority_index = verified_transaction.block_ref().author;
389+
let hostname = &self.context.committee.authority(authority_index).hostname;
390+
metrics
391+
.committed_non_empty_blocks_per_authority
392+
.with_label_values(&[hostname])
393+
.inc();
394+
}
382395

383396
let block_refs_for_committed_txs = commit
384397
.transactions

crates/starfish/core/src/metrics.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ pub(crate) struct NodeMetrics {
181181
pub(crate) num_of_bad_nodes: IntGauge,
182182
pub(crate) quorum_receive_latency: Histogram,
183183
pub(crate) transactions_per_commit_count: Histogram,
184+
pub(crate) non_empty_blocks_per_commit_count: Histogram,
185+
pub(crate) committed_non_empty_blocks_per_authority: IntCounterVec,
184186
pub(crate) transactions_synchronizer_fetched_transactions_by_peer: IntCounterVec,
185187
pub(crate) transactions_synchronizer_fetched_transactions_by_authority: IntCounterVec,
186188
pub(crate) transactions_synchronizer_missing_transactions_by_authority: IntCounterVec,
@@ -583,6 +585,18 @@ impl NodeMetrics {
583585
NUM_BUCKETS.to_vec(),
584586
registry,
585587
).unwrap(),
588+
non_empty_blocks_per_commit_count: register_histogram_with_registry!(
589+
"non_empty_blocks_per_commit_count",
590+
"The number of non-empty blocks per commit.",
591+
NUM_BUCKETS.to_vec(),
592+
registry,
593+
).unwrap(),
594+
committed_non_empty_blocks_per_authority: register_int_counter_vec_with_registry!(
595+
"committed_non_empty_blocks_per_authority",
596+
"Number of blocks committed with transactions per block author",
597+
&["authority"],
598+
registry,
599+
).unwrap(),
586600
bundles_with_invalid_parts: register_int_counter_vec_with_registry!(
587601
"bundles_with_invalid_parts",
588602
"Number of bundles that contain invalid parts per peer",

0 commit comments

Comments
 (0)