Skip to content

Commit

Permalink
Adding instrucment (#762)
Browse files Browse the repository at this point in the history
Co-authored-by: Akosh Farkash <[email protected]>
  • Loading branch information
cryptoAtwill and aakoshh authored Mar 1, 2024
1 parent d05cffa commit 3c53858
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fendermint/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ use tracing_appender::{
non_blocking::WorkerGuard,
rolling::{RollingFileAppender, Rotation},
};
use tracing_subscriber::fmt::format::FmtSpan;
use tracing_subscriber::{
fmt::{self, writer::MakeWriterExt},
layer::SubscriberExt,
};

mod cmd;

fn init_tracing(opts: &options::Options) -> Option<WorkerGuard> {
Expand Down Expand Up @@ -44,6 +46,7 @@ fn init_tracing(opts: &options::Options) -> Option<WorkerGuard> {
fmt::Layer::new()
.json()
.with_writer(non_blocking.with_max_level(log_level))
.with_span_events(FmtSpan::CLOSE)
.with_target(false)
.with_file(true)
.with_line_number(true),
Expand Down
4 changes: 4 additions & 0 deletions fendermint/vm/topdown/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use ipc_api::staking::StakingChangeRequest;
use ipc_api::subnet_id::SubnetID;
use ipc_provider::manager::{GetBlockHashResult, TopDownQueryPayload};
use ipc_provider::IpcProvider;
use tracing::instrument;

/// The interface to querying state of the parent
#[async_trait]
Expand Down Expand Up @@ -75,13 +76,15 @@ impl ParentQueryProxy for IPCProviderProxy {
}

/// Getting the block hash at the target height.
#[instrument(skip(self))]
async fn get_block_hash(&self, height: BlockHeight) -> anyhow::Result<GetBlockHashResult> {
self.ipc_provider
.get_block_hash(&self.parent_subnet, height as ChainEpoch)
.await
}

/// Get the top down messages from the starting to the ending height.
#[instrument(skip(self))]
async fn get_top_down_msgs(
&self,
height: BlockHeight,
Expand All @@ -97,6 +100,7 @@ impl ParentQueryProxy for IPCProviderProxy {
}

/// Get the validator set at the specified height.
#[instrument(skip(self))]
async fn get_validator_changes(
&self,
height: BlockHeight,
Expand Down
2 changes: 2 additions & 0 deletions fendermint/vm/topdown/src/sync/syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use async_stm::{atomically, atomically_or_err, StmError};
use ethers::utils::hex;
use fendermint_vm_event::{emit, EventType};
use std::sync::Arc;
use tracing::instrument;

/// Parent syncer that constantly poll parent. This struct handles lotus null blocks and deferred
/// execution. For ETH based parent, it should work out of the box as well.
Expand Down Expand Up @@ -257,6 +258,7 @@ where
Ok(data.0)
}

#[instrument(skip(self))]
async fn fetch_data(
&self,
height: BlockHeight,
Expand Down

0 comments on commit 3c53858

Please sign in to comment.