Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Correct inaccurate event model relationships #1777

Merged
merged 4 commits into from
Mar 30, 2022
Merged

Correct inaccurate event model relationships #1777

merged 4 commits into from
Mar 30, 2022

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Mar 29, 2022

As described in #1776 and discussed in #1773, error events shouldn't be the parent of transaction events. They're both variants of the core event type with their unique attributes. So this PR corrects the currently inaccurate inheritance relationship.

Close #1776

@st0012 st0012 added this to the 5.3.0 milestone Mar 29, 2022
@st0012 st0012 self-assigned this Mar 29, 2022
@st0012 st0012 added this to In progress in 5.x via automation Mar 29, 2022
class Event
TYPE = "event"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sl0thentr0py By giving all events a default "event" type, I think we can remove many fallback code that deals with nil type. I think the events can still be accepted without any issue. Let me know if that'll cause any problem?

Copy link
Member

Choose a reason for hiding this comment

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

oh yea that's perfect, this always felt like a code smell

@@ -71,8 +69,6 @@ def initialize(configuration:, integration_meta: nil, message: nil)
@rack_env_whitelist = configuration.rack_env_whitelist

@message = (message || "").byteslice(0..MAX_MESSAGE_SIZE_IN_BYTES)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ideally, message should be moved to ErrorEvent as well. But since that'll require changing Event#initialize as well and doesn't provide much benefit. I decided not to go this far.

Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

nice and clean! don't see any obvious problems

Since all event will now have "event" type by default, the fallback
logics aren't needed anymore.
@st0012 st0012 merged commit 0f66522 into master Mar 30, 2022
5.x automation moved this from In progress to Done Mar 30, 2022
@st0012 st0012 deleted the implement-#1776 branch March 30, 2022 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
5.x
Done
Development

Successfully merging this pull request may close these issues.

Clean up Event and TransactionEvent inheritance logic
2 participants