Skip to content

Commit

Permalink
[tiny] Fix histogram metric, reduce warning volume (MystenLabs#9858)
Browse files Browse the repository at this point in the history
1. The histogram for calculating round duration didn't convert it from
ms to sec
2. We shouldn't generate a warn message for the long standing user cert
sequencing, it might creates unhealthy volume of unnecessary logs.

## Description 

Describe the changes or additions included in this PR.

## Test Plan 

How did you test the new or updated feature?

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes

Co-authored-by: Dmitri Perelman <[email protected]>
  • Loading branch information
dmitri-perelman and Dmitri Perelman authored Mar 24, 2023
1 parent dc81b3d commit ca6066b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
29 changes: 19 additions & 10 deletions crates/sui-core/src/consensus_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,16 +569,25 @@ impl ConsensusAdapter {
Either::Right(((), processed_waiter)) => Some(processed_waiter),
};
let transaction_key = transaction.key();
let _monitor = CancelOnDrop(spawn_monitored_task!(async {
let mut i = 0u64;
loop {
i += 1;
const WARN_DELAY_S: u64 = 30;
tokio::time::sleep(Duration::from_secs(WARN_DELAY_S)).await;
let total_wait = i * WARN_DELAY_S;
warn!("Still waiting {total_wait} seconds for transaction {transaction_key:?} to commit in narwhal");
}
}));
// Log warnings for capability or end of publish transactions that fail to get sequenced
let _monitor = if matches!(
transaction.kind,
ConsensusTransactionKind::EndOfPublish(_)
| ConsensusTransactionKind::CapabilityNotification(_)
) {
Some(CancelOnDrop(spawn_monitored_task!(async {
let mut i = 0u64;
loop {
i += 1;
const WARN_DELAY_S: u64 = 30;
tokio::time::sleep(Duration::from_secs(WARN_DELAY_S)).await;
let total_wait = i * WARN_DELAY_S;
warn!("Still waiting {total_wait} seconds for transaction {transaction_key:?} to commit in narwhal");
}
})))
} else {
None
};
if let Some(processed_waiter) = processed_waiter {
debug!("Submitting {transaction_key:?} to consensus");

Expand Down
2 changes: 1 addition & 1 deletion narwhal/primary/src/proposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ impl Proposer {
self.metrics
.proposal_latency
.with_label_values(&[reason])
.observe((current_timestamp - t) as f64);
.observe(((current_timestamp - t) / 1000) as f64);
}
self.last_round_timestamp = Some(current_timestamp);
debug!("Dag moved to round {}", self.round);
Expand Down

0 comments on commit ca6066b

Please sign in to comment.