Improve tracing (#5698)

* Improve tracing implementation

* Enable tracing in runtime interfaces

* Switch to `TRACE` level
This commit is contained in:
Bastian Köcher
2020-04-20 14:37:27 +02:00
committed by GitHub
parent ca1c60c2cf
commit 1d1caed335
18 changed files with 206 additions and 119 deletions
+10 -46
View File
@@ -1030,12 +1030,7 @@ macro_rules! decl_module {
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
{
fn on_initialize(_block_number_not_used: $trait_instance::BlockNumber) -> $return {
use $crate::sp_std::if_std;
if_std! {
use $crate::tracing;
let span = tracing::span!(tracing::Level::DEBUG, "on_initialize");
let _enter = span.enter();
}
$crate::sp_tracing::enter_span!("on_initialize");
{ $( $impl )* }
}
}
@@ -1051,12 +1046,7 @@ macro_rules! decl_module {
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
{
fn on_initialize($param: $param_ty) -> $return {
use $crate::sp_std::if_std;
if_std! {
use $crate::tracing;
let span = tracing::span!(tracing::Level::DEBUG, "on_initialize");
let _enter = span.enter();
}
$crate::sp_tracing::enter_span!("on_initialize");
{ $( $impl )* }
}
}
@@ -1082,12 +1072,7 @@ macro_rules! decl_module {
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
{
fn on_runtime_upgrade() -> $return {
use $crate::sp_std::if_std;
if_std! {
use $crate::tracing;
let span = tracing::span!(tracing::Level::DEBUG, "on_runtime_upgrade");
let _enter = span.enter();
}
$crate::sp_tracing::enter_span!("on_runtime_upgrade");
{ $( $impl )* }
}
}
@@ -1114,12 +1099,7 @@ macro_rules! decl_module {
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
{
fn on_finalize(_block_number_not_used: $trait_instance::BlockNumber) {
use $crate::sp_std::if_std;
if_std! {
use $crate::tracing;
let span = tracing::span!(tracing::Level::DEBUG, "on_finalize");
let _enter = span.enter();
}
$crate::sp_tracing::enter_span!("on_finalize");
{ $( $impl )* }
}
}
@@ -1135,12 +1115,7 @@ macro_rules! decl_module {
for $module<$trait_instance$(, $instance)?> where $( $other_where_bounds )*
{
fn on_finalize($param: $param_ty) {
use $crate::sp_std::if_std;
if_std! {
use $crate::tracing;
let span = tracing::span!(tracing::Level::DEBUG, "on_finalize");
let _enter = span.enter();
}
$crate::sp_tracing::enter_span!("on_finalize");
{ $( $impl )* }
}
}
@@ -1209,15 +1184,9 @@ macro_rules! decl_module {
$vis fn $name(
$origin: $origin_ty $(, $param: $param_ty )*
) -> $crate::dispatch::DispatchResult {
$crate::sp_std::if_std! {
use $crate::tracing;
let span = tracing::span!(tracing::Level::DEBUG, stringify!($name));
let _enter = span.enter();
}
{
{ $( $impl )* }
Ok(())
}
$crate::sp_tracing::enter_span!(stringify!($name));
{ $( $impl )* }
Ok(())
}
};
@@ -1234,13 +1203,8 @@ macro_rules! decl_module {
) => {
$(#[doc = $doc_attr])*
$vis fn $name($origin: $origin_ty $(, $param: $param_ty )* ) -> $result {
use $crate::sp_std::if_std;
if_std! {
use $crate::tracing;
let span = tracing::span!(tracing::Level::DEBUG, stringify!($name));
let _enter = span.enter();
}
{ $( $impl )* }
$crate::sp_tracing::enter_span!(stringify!($name));
$( $impl )*
}
};