Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Commit

Permalink
add logger.metrics example
Browse files Browse the repository at this point in the history
  • Loading branch information
huwenchao committed Dec 1, 2019
1 parent 59c5e7e commit 7c04ff3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/consensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ parking_lot = "0.9"
rlp = "0.4"
serde = {version = "1.0", features = ["derive"]}

common-logger = { path = "../../common/logger"}
common-crypto = { path = "../../common/crypto"}
common-merkle = { path = "../../common/merkle"}
core-mempool = { path = "../../core/mempool"}
Expand Down
6 changes: 6 additions & 0 deletions core/consensus/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ impl<Adapter: ConsensusAdapter + 'static> ConsensusEngine<Adapter> {
.save_epoch(Context::new(), epoch.clone())
.await?;

common_logger::metrics(common_logger::json!({
"name": "save_epoch",
"epoch_id": epoch_id,
"ordered_tx_num": epoch.ordered_tx_hashes.len()
}));

let prev_hash = Hash::digest(epoch.encode_fixed()?);
{
let mut current_consensus_status = self.current_consensus_status.write();
Expand Down

0 comments on commit 7c04ff3

Please sign in to comment.