-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(analytics): Transform analytics events for TET-829 #95209
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-829
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 Annotations Mismatch in Analytics Event
The IntegrationServerlessSetup
analytics event has incorrect type annotations. The user_id
, organization_id
, success_count
, and failure_count
fields are typed as str
but should be int
. These fields receive integer values (e.g., user/organization IDs, counts from len()
operations) as demonstrated in src/sentry/integrations/aws_lambda/integration.py
. This type mismatch can lead to runtime errors.
src/sentry/analytics/events/integration_serverless_setup.py#L5-L10
class IntegrationServerlessSetup(analytics.Event): | |
user_id: str | |
organization_id: str | |
integration: str | |
success_count: str | |
failure_count: str |
Bug: Analytics ID Fields Incorrectly Typed
Several analytics event classes incorrectly type ID fields (user_id
, organization_id
, project_id
, codeowners_id
) as str
or str | None
. These fields should be typed as int
or int | None
as they consistently receive integer values from Django model ID attributes.
src/sentry/analytics/events/first_feedback_sent.py#L5-L9
sentry/src/sentry/analytics/events/first_feedback_sent.py
Lines 5 to 9 in ec49ed7
class FirstFeedbackSentEvent(analytics.Event): | |
organization_id: str | |
project_id: str | |
platform: str | None = None | |
user_id: str | None = None |
src/sentry/analytics/events/project_issue_searched.py#L5-L9
sentry/src/sentry/analytics/events/project_issue_searched.py
Lines 5 to 9 in ec49ed7
class ProjectIssueSearchEvent(analytics.Event): | |
user_id: str | None = None | |
organization_id: str | |
project_id: str | |
query: str |
src/sentry/analytics/events/codeowners_updated.py#L5-L9
sentry/src/sentry/analytics/events/codeowners_updated.py
Lines 5 to 9 in ec49ed7
class CodeownersUpdated(analytics.Event): | |
user_id: str | None = None | |
organization_id: str | |
project_id: str | |
codeowners_id: str |
src/sentry/analytics/events/first_flag_sent.py#L5-L8
sentry/src/sentry/analytics/events/first_flag_sent.py
Lines 5 to 8 in ec49ed7
class FirstFlagSentEvent(analytics.Event): | |
organization_id: str | |
project_id: str | |
platform: str | None = None |
src/sentry/analytics/events/first_release_tag_sent.py#L5-L8
sentry/src/sentry/analytics/events/first_release_tag_sent.py
Lines 5 to 8 in ec49ed7
class FirstReleaseTagSentEvent(analytics.Event): | |
user_id: str | |
organization_id: str | |
project_id: str |
src/sentry/analytics/events/first_replay_sent.py#L5-L9
sentry/src/sentry/analytics/events/first_replay_sent.py
Lines 5 to 9 in ec49ed7
class FirstReplaySentEvent(analytics.Event): | |
organization_id: str | |
project_id: str | |
platform: str | None = None | |
user_id: str | None = None |
src/sentry/analytics/events/second_platform_added.py#L5-L9
sentry/src/sentry/analytics/events/second_platform_added.py
Lines 5 to 9 in ec49ed7
class SecondPlatformAddedEvent(analytics.Event): | |
user_id: str | |
organization_id: str | |
project_id: str | |
platform: str | None = None |
src/sentry/analytics/events/weekly_report.py#L5-L9
sentry/src/sentry/analytics/events/weekly_report.py
Lines 5 to 9 in ec49ed7
class WeeklyReportSent(analytics.Event): | |
organization_id: str | |
user_id: str | |
notification_uuid: str | |
user_project_count: int |
Bug: Type Mismatch in `num_groups` Field
The num_groups
field in IssueForecastSaved
is typed as str
but should be int
. It receives an integer value from len(group_counts.keys())
in src/sentry/issues/escalating/forecasts.py
.
src/sentry/issues/analytics.py#L5-L6
sentry/src/sentry/issues/analytics.py
Lines 5 to 6 in ec49ed7
class IssueForecastSaved(analytics.Event): | |
num_groups: str |
Was this report helpful? Give feedback by reacting with 👍 or 👎
❌ 34 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-829