Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Format some logs better #157

Merged
merged 3 commits into from
Oct 27, 2021
Merged

Format some logs better #157

merged 3 commits into from
Oct 27, 2021

Conversation

lithp
Copy link
Contributor

@lithp lithp commented Oct 26, 2021

A stab at #150:

Before:

Oct 25 23:42:11.079 DEBUG trin_core::portalnet::events: Got discv5 event NodeInserted { node_id: NodeId { raw: [5, 208, 240, 167, 153, 116, 216, 224, 160, 101, 80, 229, 154, 206, 113, 239, 182, 109, 181, 137, 16, 96, 251, 63, 85, 223, 235, 208, 3, 242, 175, 11] }, replaced: None }    
Oct 25 23:42:11.079 DEBUG trin_core::portalnet::events: Got discv5 event TalkRequest(TalkRequest { id: RequestId([226, 151, 109, 239, 115, 223, 116, 109]), node_address: NodeAddress { socket_addr: 127.0.0.1:4568, node_id: NodeId { raw: [5, 208, 240, 167, 153, 116, 216, 224, 160, 101, 80, 229, 154, 206, 113, 239, 182, 109, 181, 137, 16, 96, 251, 63, 85, 223, 235, 208, 3, 242, 175, 11] } }, protocol: [115, 116, 97, 116, 101], body: [1, 1, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0], sender: Some(UnboundedSender { chan: Tx { inner: Chan { tx: Tx { block_tail: 0x55c4fe611290, tail_position: 1 }, semaphore: 0, rx_waker: AtomicWaker, tx_count: 2, rx_fields: "..." } } }) })    
Oct 25 23:42:11.079 DEBUG trin_state::events: Got state request TalkRequest { id: RequestId([226, 151, 109, 239, 115, 223, 116, 109]), node_address: NodeAddress { socket_addr: 127.0.0.1:4568, node_id: NodeId { raw: [5, 208, 240, 167, 153, 116, 216, 224, 160, 101, 80, 229, 154, 206, 113, 239, 182, 109, 181, 137, 16, 96, 251, 63, 85, 223, 235, 208, 3, 242, 175, 11] } }, protocol: [115, 116, 97, 116, 101], body: [1, 1, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 1, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0], sender: Some(UnboundedSender { chan: Tx { inner: Chan { tx: Tx { block_tail: 0x55c4fe611290, tail_position: 1 }, semaphore: 0, rx_waker: AtomicWaker, tx_count: 2, rx_fields: "..." } } }) }    
Oct 25 23:42:11.079 DEBUG trin_core::portalnet::overlay: Got overlay ping request Ping(Ping { enr_seq: 1, payload: Some(CustomPayload { data_radius: 18446744073709551615, payload: None }) })    

After:

Oct 25 23:43:02.373 DEBUG trin_core::portalnet::events: Received NodeInserted(node_id=0x2db0..25ea)    
Oct 25 23:43:02.373 DEBUG trin_core::portalnet::overlay: Received Ping(enr_seq=1, radius=18446744073709551615)    
Oct 25 23:43:02.373 DEBUG trin_core::portalnet::overlay: Sending Pong(enr_seq=1, radius=18446744073709551615)    
Oct 25 23:43:02.373 DEBUG trin_state::events: Sending reply: Pong(Pong { enr_seq: 1, payload: Some(CustomPayload { data_radius: 18446744073709551615, payload: None }) })    

@lithp lithp requested a review from njgheorghita October 26, 2021 03:45
Copy link
Collaborator

@jacobkaufmann jacobkaufmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Is it worth standardizing some logging conventions in the contributing guidelines?

@@ -82,7 +97,12 @@ impl PortalnetEvents {
self.process_utp_byte_stream().await;
}
_ => {
warn!("Non supported protocol : {}", protocol);
warn!(
"Received TalkRequest on uknown protocol from={} protocol={} body={}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "unknown" is misspelled.

Copy link
Collaborator

@njgheorghita njgheorghita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks way better! Just a thought, but if it's not too cumbersome to also include which overlay network the incoming/outgoing messages are on (state/history/etc.) that would be useful imo

@@ -24,7 +22,10 @@ impl StateEvents {
.process_one_request(&talk_request)
.await
{
Ok(r) => Message::Response(r).to_bytes(),
Ok(r) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it's worth replicating these changes over in trin-history?

@njgheorghita
Copy link
Collaborator

Is it worth standardizing some logging conventions in the contributing guidelines?

For sure! I'm just not sure exactly how / what style we want to go with. But if anybody has thoughts, or an initial structure in mind, go ahead and open a pr and we can continue the discussion there.

@lithp
Copy link
Contributor Author

lithp commented Oct 27, 2021

@njgheorghita Just pushed ee29540 which tries to add which network each message came in on, the output now looks like this:

Oct 27 13:01:50.079 DEBUG trin_core::portalnet::events: Received NodeInserted(node_id=0x1e0c..8df2)    
Oct 27 13:01:50.079 DEBUG state_network: trin_core::portalnet::overlay: Received Ping(enr_seq=1, radius=18446744073709551615)
Oct 27 13:01:50.079 DEBUG state_network: trin_core::portalnet::overlay: Sending Pong(enr_seq=1, radius=18446744073709551615)
Oct 27 13:01:50.079 DEBUG trin_state::events: Sending reply: Pong(Pong { enr_seq: 1, payload: Some(CustomPayload { data_radius: 18446744073709551615, payload: None }) })

This isn't a trivial change so giving you one last look before merging!

@njgheorghita
Copy link
Collaborator

Looks great! lgtm!

@lithp lithp merged commit fe27f76 into ethereum:master Oct 27, 2021
@lithp lithp deleted the lithp/improve-logging branch October 27, 2021 18:51
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants