diff --git a/network-p2p/src/request_responses.rs b/network-p2p/src/request_responses.rs index 25eb02a45e..c93d8082a8 100644 --- a/network-p2p/src/request_responses.rs +++ b/network-p2p/src/request_responses.rs @@ -273,8 +273,8 @@ impl RequestResponsesBehaviour { (protocol_name.to_string().into(), request_id).into(), (Instant::now(), pending_response), ); - info!( - "[network-p2p] req-resp send request {} {} {} {}", + info!(target:"network-rpc-client", + "{} {} {} {}", request_id, target, protocol_name, len, ); debug_assert!(prev_req_id.is_none(), "Expect request id to be unique."); @@ -581,22 +581,18 @@ impl NetworkBehaviour for RequestResponsesBehaviour { }, .. } => { - let (started, delivered) = match self + let (started, delivered, response_len) = match self .pending_requests .remove(&(protocol.clone(), request_id).into()) { Some((started, pending_response)) => { - if let Ok(response) = &response { - info!( - "[network-p2p] req-resp received response {} {}", - request_id, - response.len() - ); - }; + let response_len = + response.as_ref().map(|resp| resp.len()).unwrap_or(0); let delivered = pending_response .send(response.map_err(|()| RequestFailure::Refused)) .map_err(|_| RequestFailure::Obsolete); - (started, delivered) + + (started, delivered, response_len) } None => { log::warn!( @@ -609,6 +605,16 @@ impl NetworkBehaviour for RequestResponsesBehaviour { } }; + info!(target: + "network-rpc-client", + "{} {} {} {} {}", + request_id, + protocol, + response_len, + delivered.is_ok(), + started.elapsed().as_millis(), + ); + let out = Event::RequestFinished { peer, protocol: protocol.clone(),