-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(analytics): Transform analytics events for TET-837 #95216
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
base: master
Are you sure you want to change the base?
Conversation
- Transform event classes to use @analytics.eventclass decorator - Transform analytics.record calls to use event class instances - Update imports as needed Closes TET-837
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.
Bug: String Annotations with Integer Values
creator_id
and owner_id
are annotated as str
but integer user IDs (e.g., request.user.id
, owner.id
) are passed directly, causing a type mismatch.
src/sentry/analytics/events/relocation_created.py#L5-L7
sentry/src/sentry/analytics/events/relocation_created.py
Lines 5 to 7 in fad2ec5
class RelocationCreatedEvent(analytics.Event): | |
creator_id: str | |
owner_id: str |
src/sentry/analytics/events/relocation_forked.py#L5-L7
sentry/src/sentry/analytics/events/relocation_forked.py
Lines 5 to 7 in fad2ec5
class RelocationForkedEvent(analytics.Event): | |
creator_id: str | |
owner_id: str |
Bug: Refactor Issues: Type Mismatch, Inconsistent Event Class Usage
The refactor of UserSignUpEvent
introduced two issues:
- The
user_id
attribute is typed asstr
, but an integeruser.id
is passed by calling code, causing a type mismatch. RelocationUserSignUpEvent
inherits fromUserSignUpEvent
but inconsistently uses the oldtype
attribute instead of the new@analytics.eventclass
decorator pattern.
src/sentry/analytics/events/user_signup.py#L5-L13
sentry/src/sentry/analytics/events/user_signup.py
Lines 5 to 13 in fad2ec5
class UserSignUpEvent(analytics.Event): | |
user_id: str | |
source: str | |
provider: str | None = None | |
referrer: str | None = None | |
class RelocationUserSignUpEvent(UserSignUpEvent): | |
type = "relocation.user_signup" |
Was this report helpful? Give feedback by reacting with 👍 or 👎
❌ 27 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Closes TET-837