-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Clean up some logging #6515
Clean up some logging #6515
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Clean up some logging when handling incoming events over federation. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,7 +182,7 @@ def on_receive_pdu(self, origin, pdu, sent_to_us_directly=False): | |
room_id = pdu.room_id | ||
event_id = pdu.event_id | ||
|
||
logger.info("[%s %s] handling received PDU: %s", room_id, event_id, pdu) | ||
logger.info("handling received PDU: %s", pdu) | ||
|
||
# We reprocess pdus when we have seen them only as outliers | ||
existing = yield self.store.get_event( | ||
|
@@ -278,9 +278,15 @@ def on_receive_pdu(self, origin, pdu, sent_to_us_directly=False): | |
len(missing_prevs), | ||
) | ||
|
||
yield self._get_missing_events_for_pdu( | ||
origin, pdu, prevs, min_depth | ||
) | ||
try: | ||
yield self._get_missing_events_for_pdu( | ||
origin, pdu, prevs, min_depth | ||
) | ||
except Exception as e: | ||
raise Exception( | ||
"Error fetching missing prev_events for %s: %s" | ||
% (event_id, e) | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be tempted to not include (I assume we've checked that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I tried that. It made for remarkably unreadable errors, not least because the exception chain is epic. Exception chaining happens by default when you raise an exception from an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
well: first, I've looked at the places Then going down through |
||
|
||
# Update the set of things we've seen after trying to | ||
# fetch the missing stuff | ||
|
@@ -292,14 +298,6 @@ def on_receive_pdu(self, origin, pdu, sent_to_us_directly=False): | |
room_id, | ||
event_id, | ||
) | ||
elif missing_prevs: | ||
logger.info( | ||
"[%s %s] Not recursively fetching %d missing prev_events: %s", | ||
room_id, | ||
event_id, | ||
len(missing_prevs), | ||
shortstr(missing_prevs), | ||
) | ||
|
||
if prevs - seen: | ||
# We've still not been able to get all of the prev_events for this event. | ||
|
@@ -344,6 +342,12 @@ def on_receive_pdu(self, origin, pdu, sent_to_us_directly=False): | |
affected=pdu.event_id, | ||
) | ||
|
||
logger.info( | ||
"Event %s is missing prev_events: calculating state for a " | ||
"backwards extremity", | ||
event_id, | ||
) | ||
|
||
# Calculate the state after each of the previous events, and | ||
# resolve them to find the correct state at the current event. | ||
auth_chains = set() | ||
|
@@ -364,10 +368,7 @@ def on_receive_pdu(self, origin, pdu, sent_to_us_directly=False): | |
# know about | ||
for p in prevs - seen: | ||
logger.info( | ||
"[%s %s] Requesting state at missing prev_event %s", | ||
room_id, | ||
event_id, | ||
p, | ||
"Requesting state at missing prev_event %s", event_id, | ||
) | ||
|
||
room_version = yield self.store.get_room_version(room_id) | ||
|
@@ -611,8 +612,8 @@ def _get_state_for_room(self, destination, room_id, event_id): | |
failed_to_fetch = desired_events - event_map.keys() | ||
if failed_to_fetch: | ||
logger.warning( | ||
"Failed to fetch missing state/auth events for %s: %s", | ||
room_id, | ||
"Failed to fetch missing state/auth events for %s %s", | ||
event_id, | ||
failed_to_fetch, | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the prefixing? I find it quite useful to track how we're processing an event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it's in the logcontext anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so it is. I had forgotten the log context isn't the generic request one. Carry on.