-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(analytics): Transform analytics events for TET-827 #95207
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-827
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: Event Constructor Mismatch Causes TypeError
The IntegrationIssueCommentsSyncedEvent
constructor is incorrectly called with a user_id
parameter in src/sentry/integrations/tasks/create_comment.py
and src/sentry/integrations/tasks/update_comment.py
. The IntegrationIssueCommentsSyncedEvent
class definition in src/sentry/integrations/analytics.py
does not include a user_id
field, which will cause a TypeError
when the event is instantiated.
src/sentry/integrations/tasks/create_comment.py#L70-L78
sentry/src/sentry/integrations/tasks/create_comment.py
Lines 70 to 78 in e0fe946
note.save() | |
analytics.record( | |
IntegrationIssueCommentsSyncedEvent( | |
provider=installation.model.provider, | |
id=installation.model.id, | |
organization_id=external_issue.organization_id, | |
user_id=user_id, | |
) | |
) |
src/sentry/integrations/tasks/update_comment.py#L70-L78
sentry/src/sentry/integrations/tasks/update_comment.py
Lines 70 to 78 in e0fe946
installation.update_comment(external_issue.key, user_id, note) | |
analytics.record( | |
IntegrationIssueCommentsSyncedEvent( | |
provider=installation.model.provider, | |
id=installation.model.id, | |
organization_id=external_issue.organization_id, | |
user_id=user_id, | |
) | |
) |
Bug: Event Class Decorator Inheritance Issue
The child class FirstSourcemapsSentEventForProject
still uses the old type
attribute for event definition, while its parent FirstSourcemapsSentEvent
has been updated to use the @analytics.eventclass
decorator. This inconsistency creates a mixed pattern that could prevent the child class from being correctly registered or recognized by the analytics system.
src/sentry/analytics/events/first_sourcemaps_sent.py#L13-L15
sentry/src/sentry/analytics/events/first_sourcemaps_sent.py
Lines 13 to 15 in e0fe946
class FirstSourcemapsSentEventForProject(FirstSourcemapsSentEvent): | |
type = "first_sourcemaps_for_project.sent" |
Bug: Event Constructor Receives Undefined Parameter
The IssueResolvedEvent
constructor is incorrectly passed a provider
parameter. This argument, carried over from the previous analytics.record
call, is not defined in the IssueResolvedEvent
class, causing a TypeError
upon instantiation.
src/sentry/integrations/tasks/sync_status_inbound.py#L295-L307
sentry/src/sentry/integrations/tasks/sync_status_inbound.py
Lines 295 to 307 in e0fe946
analytics.record( | |
IssueResolvedEvent( | |
project_id=group.project.id, | |
default_user_id="Sentry Jira", | |
organization_id=organization_id, | |
group_id=group.id, | |
resolution_type="with_third_party_app", | |
provider=provider.key, | |
issue_type=group.issue_type.slug, | |
issue_category=group.issue_category.name.lower(), | |
) | |
) |
Was this report helpful? Give feedback by reacting with 👍 or 👎
❌ 19 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-827