Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Adding some more logs (#6455)
Browse files Browse the repository at this point in the history
* Adding some more logs

More logs are always better! Joke aside, these logs help to debug
certain issues.

* Apply suggestions from code review
  • Loading branch information
bkchr authored Dec 17, 2022
1 parent eea7770 commit 1959598
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,17 @@ impl RunningTask {
&mut self,
validator: &AuthorityDiscoveryId,
) -> std::result::Result<ChunkFetchingResponse, TaskError> {
gum::trace!(
target: LOG_TARGET,
origin = ?validator,
relay_parent = ?self.relay_parent,
group_index = ?self.group_index,
session_index = ?self.session_index,
chunk_index = ?self.request.index,
candidate_hash = ?self.request.candidate_hash,
"Starting chunk request",
);

let (full_request, response_recv) =
OutgoingRequest::new(Recipient::Authority(validator.clone()), self.request);
let requests = Requests::ChunkFetchingV1(full_request);
Expand All @@ -346,35 +357,35 @@ impl RunningTask {
Err(RequestError::InvalidResponse(err)) => {
gum::warn!(
target: LOG_TARGET,
origin= ?validator,
origin = ?validator,
relay_parent = ?self.relay_parent,
group_index = ?self.group_index,
session_index = ?self.session_index,
chunk_index = ?self.request.index,
candidate_hash = ?self.request.candidate_hash,
err= ?err,
err = ?err,
"Peer sent us invalid erasure chunk data"
);
Err(TaskError::PeerError)
},
Err(RequestError::NetworkError(err)) => {
gum::debug!(
target: LOG_TARGET,
origin= ?validator,
origin = ?validator,
relay_parent = ?self.relay_parent,
group_index = ?self.group_index,
session_index = ?self.session_index,
chunk_index = ?self.request.index,
candidate_hash = ?self.request.candidate_hash,
err= ?err,
err = ?err,
"Some network error occurred when fetching erasure chunk"
);
Err(TaskError::PeerError)
},
Err(RequestError::Canceled(oneshot::Canceled)) => {
gum::debug!(
target: LOG_TARGET,
origin= ?validator,
origin = ?validator,
relay_parent = ?self.relay_parent,
group_index = ?self.group_index,
session_index = ?self.session_index,
Expand Down
14 changes: 14 additions & 0 deletions node/network/bridge/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ impl Network for Arc<NetworkService<Block, Hash>> {
let peer_id = match peer {
Recipient::Peer(peer_id) => Some(peer_id),
Recipient::Authority(authority) => {
gum::trace!(
target: LOG_TARGET,
?authority,
"Searching for peer id to connect to authority",
);

let mut found_peer_id = None;
// Note: `get_addresses_by_authority_id` searched in a cache, and it thus expected
// to be very quick.
Expand Down Expand Up @@ -196,6 +202,14 @@ impl Network for Arc<NetworkService<Block, Hash>> {
Some(peer_id) => peer_id,
};

gum::trace!(
target: LOG_TARGET,
%peer_id,
protocol = %req_protocol_names.get_name(protocol),
?if_disconnected,
"Starting request",
);

NetworkService::start_request(
self,
peer_id,
Expand Down

0 comments on commit 1959598

Please sign in to comment.