Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More events for observability #732

Merged
merged 3 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading