Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Include outlier status in str(event) for V2/V3 events #10879

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10879.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Include outlier status when we log V2 or V3 events.
34 changes: 12 additions & 22 deletions synapse/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,18 @@ def freeze(self):
# this will be a no-op if the event dict is already frozen.
self._dict = freeze(self._dict)

def __str__(self):
return self.__repr__()

def __repr__(self):
return "<%s event_id=%r, type=%r, state_key=%r, outlier=%s>" % (
self.__class__.__name__,
self.event_id,
self.get("type", None),
self.get("state_key", None),
self.internal_metadata.is_outlier(),
)


class FrozenEvent(EventBase):
format_version = EventFormatVersions.V1 # All events of this type are V1
Expand Down Expand Up @@ -392,17 +404,6 @@ def __init__(
def event_id(self) -> str:
return self._event_id

def __str__(self):
return self.__repr__()

def __repr__(self):
return "<FrozenEvent event_id=%r, type=%r, state_key=%r, outlier=%s>" % (
self.get("event_id", None),
self.get("type", None),
self.get("state_key", None),
self.internal_metadata.is_outlier(),
)


class FrozenEventV2(EventBase):
format_version = EventFormatVersions.V2 # All events of this type are V2
Expand Down Expand Up @@ -478,17 +479,6 @@ def auth_event_ids(self):
"""
return self.auth_events

def __str__(self):
return self.__repr__()

def __repr__(self):
return "<%s event_id=%r, type=%r, state_key=%r>" % (
self.__class__.__name__,
self.event_id,
self.get("type", None),
self.get("state_key", None),
)


class FrozenEventV3(FrozenEventV2):
"""FrozenEventV3, which differs from FrozenEventV2 only in the event_id format"""
Expand Down