-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(analytics): Transform analytics events for TET-838 #95217
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-838
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: Type Mismatch in Event Subclasses
Type annotation mismatch in analytics.Event
subclasses. The organization_id
, project_id
, and user_id
fields are annotated as str
or str | None
, but are consistently passed integer values (Django model primary keys) from call sites. This change from the more permissive analytics.Attribute
definitions to strict type annotations could lead to runtime errors or type checking failures if strict type validation is enforced.
src/sentry/analytics/events/first_profile_sent.py#L5-L9
sentry/src/sentry/analytics/events/first_profile_sent.py
Lines 5 to 9 in 3f9158b
class FirstProfileSentEvent(analytics.Event): | |
organization_id: str | |
project_id: str | |
platform: str | None = None | |
user_id: str | None = None |
src/sentry/analytics/events/eventuser_endpoint_request.py#L5-L7
class EventUserEndpointRequest(analytics.Event): | |
endpoint: str | |
project_id: str | None = None |
Bug: Type Mismatch in `project_id` Field
The project_id
field in EventUserEndpointRequest
is annotated as str | None
, but calling code passes integer values (e.g., project.id
, group.project_id
), leading to a type mismatch that could cause runtime errors or type checking failures.
src/sentry/analytics/events/eventuser_endpoint_request.py#L6-L7
endpoint: str | |
project_id: str | None = None |
Was this report helpful? Give feedback by reacting with 👍 or 👎
❌ 6 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-838