Skip to content

Conversation

@lynnagara
Copy link
Member

Make eventstore Event model compatible with SnubaEvent, which will allow
us to deprecate SnubaEvent everywhere and move towards a single Event
model.

Make eventstore Event model compatible with SnubaEvent, which will allow
us to deprecate SnubaEvent everywhere and move towards a single Event
model.
@lynnagara lynnagara force-pushed the snubaevent-compatibility branch 2 times, most recently from f758aeb to cade6f9 Compare December 27, 2019 22:35
Comment on lines 60 to 62
if column in self._snuba_data and self._snuba_data[column]:
return self._snuba_data[column]
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

return self._snuba_data.get(column)

?

self.group_id = group_id
self.message = message
self.data = data
self._snuba_data = snuba_data or {}
Copy link
Contributor

Choose a reason for hiding this comment

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

How long do you expect this to be around ?
Asking because I would like to avoid the concern that the two implementations (this one and the snuba one could diverge)

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you referring to this line or the SnubaEvent class in general? This line will probably stay to hold data fetched from Snuba. SnubaEvent will go away soon, outisde this PR it's only used in a couple of small cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

The snuba event class that has a copy paste of a lot of the logic you added here to the Event class.

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll be able to remove SnubaEvent really soon

self.project_id = project_id
self.event_id = event_id
self.group_id = group_id
self.message = message
Copy link
Contributor

Choose a reason for hiding this comment

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

why was this promoted to a field of the Event class ?

Copy link
Member Author

Choose a reason for hiding this comment

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

The EventManager sets the event.message property to be something else (the full search message) than what event.message is the rest of the time :/ The Django event also had a top level message field that held this value as well. It might be better to give this a distinct name like search_message or something.

Comment on lines +101 to +106
@property
def timestamp(self):
column = self.__get_column_name(Columns.TIMESTAMP)
if column in self._snuba_data:
return self._snuba_data[column]
return self.datetime.isoformat()
Copy link
Contributor

Choose a reason for hiding this comment

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

IS this here just because SnubaEvent has one ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, which part are you referring to?

Copy link
Contributor

Choose a reason for hiding this comment

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

The existence of both datetime and timestamp

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we rely on event.timestamp in various places

Copy link
Contributor

@fpacifici fpacifici left a comment

Choose a reason for hiding this comment

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

Seems there are some test failure around setting the message field on event that are actual issues.

@lynnagara lynnagara merged commit 7a15beb into master Jan 6, 2020
@lynnagara lynnagara deleted the snubaevent-compatibility branch January 6, 2020 22:09
BYK pushed a commit that referenced this pull request Jan 7, 2020
Make eventstore Event model compatible with SnubaEvent, which will allow
us to deprecate SnubaEvent everywhere and move towards a single Event
model.
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants