Skip to content

Commit

Permalink
More events for observability (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoAtwill authored Mar 1, 2024
1 parent 3c53858 commit 0df894a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion fendermint/app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use num_traits::Zero;
use serde::{Deserialize, Serialize};
use tendermint::abci::request::CheckTxKind;
use tendermint::abci::{request, response};
use tracing::instrument;

use crate::{tmconv::*, VERSION};
use crate::{BlockHeight, APP_VERSION};
Expand Down Expand Up @@ -525,6 +526,7 @@ where
}

/// Query the application for data at the current or past height.
#[instrument(skip(self))]
async fn query(&self, request: request::Query) -> AbciResult<response::Query> {
let db = self.state_store_clone();
let height = FvmQueryHeight::from(request.height.value());
Expand Down Expand Up @@ -654,14 +656,23 @@ where
time = request.time.to_string(),
"process proposal"
);
let txs = request.txs.into_iter().map(|tx| tx.to_vec()).collect();
let txs: Vec<_> = request.txs.into_iter().map(|tx| tx.to_vec()).collect();
let num_txs = txs.len();

let accept = self
.interpreter
.process(self.chain_env.clone(), txs)
.await
.context("failed to process proposal")?;

emit!(
EventType::ProposalProcessed,
is_accepted = accept,
height = request.height.value(),
size = num_txs,
hash = request.hash.to_string(),
proposer = request.proposer_address.to_string()
);
if accept {
Ok(response::ProcessProposal::Accept)
} else {
Expand Down
2 changes: 2 additions & 0 deletions fendermint/vm/event/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pub enum EventType {
NewBottomUpCheckpoint,
/// A new block is produced in fendermint
NewBlock,
/// A proposal is processed
ProposalProcessed,
}

#[macro_export]
Expand Down

0 comments on commit 0df894a

Please sign in to comment.