mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 09:45:41 +00:00
Add tracing support to node (#1940)
* drop in tracing to replace log * add structured logging to trace messages * add structured logging to debug messages * add structured logging to info messages * add structured logging to warn messages * add structured logging to error messages * normalize spacing and Display vs Debug * add instrumentation to the various 'fn run' * use explicit tracing module throughout * fix availability distribution test * don't double-print errors * remove further redundancy from logs * fix test errors * fix more test errors * remove unused kv_log_macro * fix unused variable * add tracing spans to collation generation * add tracing spans to av-store * add tracing spans to backing * add tracing spans to bitfield-signing * add tracing spans to candidate-selection * add tracing spans to candidate-validation * add tracing spans to chain-api * add tracing spans to provisioner * add tracing spans to runtime-api * add tracing spans to availability-distribution * add tracing spans to bitfield-distribution * add tracing spans to network-bridge * add tracing spans to collator-protocol * add tracing spans to pov-distribution * add tracing spans to statement-distribution * add tracing spans to overseer * cleanup
This commit is contained in:
committed by
GitHub
parent
94670d8082
commit
e49989971d
@@ -116,6 +116,7 @@ fn send_pov_message(relay_parent: Hash, pov_hash: Hash, pov: PoV)
|
||||
|
||||
/// Handles the signal. If successful, returns `true` if the subsystem should conclude,
|
||||
/// `false` otherwise.
|
||||
#[tracing::instrument(level = "trace", skip(ctx, state), fields(subsystem = LOG_TARGET))]
|
||||
async fn handle_signal(
|
||||
state: &mut State,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -134,10 +135,10 @@ async fn handle_signal(
|
||||
let n_validators = match vals_rx.await? {
|
||||
Ok(v) => v.len(),
|
||||
Err(e) => {
|
||||
log::warn!(
|
||||
tracing::warn!(
|
||||
target: LOG_TARGET,
|
||||
"Error fetching validators from runtime API for active leaf: {:?}",
|
||||
e
|
||||
err = ?e,
|
||||
"Error fetching validators from runtime API for active leaf",
|
||||
);
|
||||
|
||||
// Not adding bookkeeping here might make us behave funny, but we
|
||||
@@ -169,6 +170,7 @@ async fn handle_signal(
|
||||
/// Notify peers that we are awaiting a given PoV hash.
|
||||
///
|
||||
/// This only notifies peers who have the relay parent in their view.
|
||||
#[tracing::instrument(level = "trace", skip(peers, ctx), fields(subsystem = LOG_TARGET))]
|
||||
async fn notify_all_we_are_awaiting(
|
||||
peers: &mut HashMap<PeerId, PeerState>,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -195,6 +197,7 @@ async fn notify_all_we_are_awaiting(
|
||||
}
|
||||
|
||||
/// Notify one peer about everything we're awaiting at a given relay-parent.
|
||||
#[tracing::instrument(level = "trace", skip(ctx, relay_parent_state), fields(subsystem = LOG_TARGET))]
|
||||
async fn notify_one_we_are_awaiting_many(
|
||||
peer: &PeerId,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -219,6 +222,7 @@ async fn notify_one_we_are_awaiting_many(
|
||||
}
|
||||
|
||||
/// Distribute a PoV to peers who are awaiting it.
|
||||
#[tracing::instrument(level = "trace", skip(peers, ctx, metrics, pov), fields(subsystem = LOG_TARGET))]
|
||||
async fn distribute_to_awaiting(
|
||||
peers: &mut HashMap<PeerId, PeerState>,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -255,6 +259,7 @@ async fn distribute_to_awaiting(
|
||||
}
|
||||
|
||||
/// Handles a `FetchPoV` message.
|
||||
#[tracing::instrument(level = "trace", skip(ctx, state, response_sender), fields(subsystem = LOG_TARGET))]
|
||||
async fn handle_fetch(
|
||||
state: &mut State,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -286,8 +291,10 @@ async fn handle_fetch(
|
||||
}
|
||||
|
||||
if relay_parent_state.fetching.len() > 2 * relay_parent_state.n_validators {
|
||||
log::warn!("Other subsystems have requested PoV distribution to \
|
||||
fetch more PoVs than reasonably expected: {}", relay_parent_state.fetching.len());
|
||||
tracing::warn!(
|
||||
relay_parent_state.fetching.len = relay_parent_state.fetching.len(),
|
||||
"other subsystems have requested PoV distribution to fetch more PoVs than reasonably expected",
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -301,6 +308,7 @@ async fn handle_fetch(
|
||||
}
|
||||
|
||||
/// Handles a `DistributePoV` message.
|
||||
#[tracing::instrument(level = "trace", skip(ctx, state, pov), fields(subsystem = LOG_TARGET))]
|
||||
async fn handle_distribute(
|
||||
state: &mut State,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -336,6 +344,7 @@ async fn handle_distribute(
|
||||
}
|
||||
|
||||
/// Report a reputation change for a peer.
|
||||
#[tracing::instrument(level = "trace", skip(ctx), fields(subsystem = LOG_TARGET))]
|
||||
async fn report_peer(
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
peer: PeerId,
|
||||
@@ -345,6 +354,7 @@ async fn report_peer(
|
||||
}
|
||||
|
||||
/// Handle a notification from a peer that they are awaiting some PoVs.
|
||||
#[tracing::instrument(level = "trace", skip(ctx, state), fields(subsystem = LOG_TARGET))]
|
||||
async fn handle_awaiting(
|
||||
state: &mut State,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -359,7 +369,7 @@ async fn handle_awaiting(
|
||||
|
||||
let relay_parent_state = match state.relay_parent_state.get_mut(&relay_parent) {
|
||||
None => {
|
||||
log::warn!("PoV Distribution relay parent state out-of-sync with our view");
|
||||
tracing::warn!("PoV Distribution relay parent state out-of-sync with our view");
|
||||
return Ok(());
|
||||
}
|
||||
Some(s) => s,
|
||||
@@ -399,6 +409,7 @@ async fn handle_awaiting(
|
||||
/// Handle an incoming PoV from our peer. Reports them if unexpected, rewards them if not.
|
||||
///
|
||||
/// Completes any requests awaiting that PoV.
|
||||
#[tracing::instrument(level = "trace", skip(ctx, state, pov), fields(subsystem = LOG_TARGET))]
|
||||
async fn handle_incoming_pov(
|
||||
state: &mut State,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -466,6 +477,7 @@ async fn handle_incoming_pov(
|
||||
}
|
||||
|
||||
/// Handles a network bridge update.
|
||||
#[tracing::instrument(level = "trace", skip(ctx, state), fields(subsystem = LOG_TARGET))]
|
||||
async fn handle_network_update(
|
||||
state: &mut State,
|
||||
ctx: &mut impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
@@ -537,6 +549,7 @@ impl PoVDistribution {
|
||||
Self { metrics }
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self, ctx), fields(subsystem = LOG_TARGET))]
|
||||
async fn run(
|
||||
self,
|
||||
mut ctx: impl SubsystemContext<Message = PoVDistributionMessage>,
|
||||
|
||||
Reference in New Issue
Block a user