Skip to content

ref(analytics): Transform analytics events for TET-834 #95214

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

constantinius
Copy link
Contributor

  • Transform event classes to use @analytics.eventclass decorator
  • Transform analytics.record calls to use event class instances
  • Update imports as needed

Closes TET-834

- Transform event classes to use @analytics.eventclass decorator
- Transform analytics.record calls to use event class instances
- Update imports as needed

Closes TET-834
@constantinius constantinius requested review from a team as code owners July 10, 2025 09:16
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 10, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: ID Type Mismatch in Analytics Events

Type mismatch: ID fields (sentry_app_installation_id, sentry_app_id, organization_id) are declared as str in analytics event classes but are consistently passed as integers from Django model IDs in the calling code.

src/sentry/analytics/events/sentry_app_installation_updated.py#L5-L8

class SentryAppInstallationUpdatedEvent(analytics.Event):
sentry_app_installation_id: str
sentry_app_id: str
organization_id: str

src/sentry/analytics/events/sentry_app_token_exchanged.py#L5-L7

class SentryAppTokenExchangedEvent(analytics.Event):
sentry_app_installation_id: str
exchange_type: str

src/sentry/analytics/events/alert_rule_ui_component_webhook_sent.py#L6-L9

# organization_id refers to the organization that installed the sentryapp
organization_id: str
sentry_app_id: str
event: str

Fix in CursorFix in Web


Bug: Incorrect Type Annotations for ID Fields

Type annotations for user_id, organization_id, sentry_app_id, and sentry_app_installation_id fields in various analytics event classes are incorrectly declared as str. These fields actually receive integer values (e.g., user.id, organization.id, sentry_app_installation.id), leading to a type mismatch.

src/sentry/analytics/events/sentry_app_deleted.py#L5-L8

class SentryAppDeletedEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_installation_token_created.py#L5-L9

class SentryAppInstallationTokenCreated(analytics.Event):
user_id: str
organization_id: str
sentry_app_installation_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_installed.py#L5-L8

class SentryAppInstalledEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_updated.py#L5-L8

class SentryAppUpdatedEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/internal_integration_created.py#L5-L8

class InternalIntegrationCreatedEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_uninstalled.py#L5-L8

class SentryAppUninstalledEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_schema_validation_error.py#L6-L11

schema: str
user_id: str
sentry_app_id: str | None = None
sentry_app_name: str
organization_id: str
error_message: str

src/sentry/analytics/events/sentry_app_installation_token_deleted.py#L5-L9

class SentryAppInstallationTokenDeleted(analytics.Event):
user_id: str
organization_id: str
sentry_app_installation_id: str
sentry_app: str

src/sentry/analytics/events/sentry_app_created.py#L5-L8

class SentryAppCreatedEvent(analytics.Event):
user_id: str
organization_id: str
sentry_app: str

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant