Skip to content

Commit 42e7e29

Browse files
committed
ref(analytics): Transform analytics events for 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
1 parent 986ceec commit 42e7e29

21 files changed

+150
-146
lines changed
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("alert_rule_ui_component_webhook.sent")
45
class AlertRuleUiComponentWebhookSentEvent(analytics.Event):
5-
type = "alert_rule_ui_component_webhook.sent"
6-
7-
attributes = (
8-
# organization_id refers to the organization that installed the sentryapp
9-
analytics.Attribute("organization_id"),
10-
analytics.Attribute("sentry_app_id"),
11-
analytics.Attribute("event"),
12-
)
6+
# organization_id refers to the organization that installed the sentryapp
7+
organization_id: str
8+
sentry_app_id: str
9+
event: str
1310

1411

1512
analytics.register(AlertRuleUiComponentWebhookSentEvent)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("internal_integration.created")
45
class InternalIntegrationCreatedEvent(analytics.Event):
5-
type = "internal_integration.created"
6-
7-
attributes = (
8-
analytics.Attribute("user_id"),
9-
analytics.Attribute("organization_id"),
10-
analytics.Attribute("sentry_app"),
11-
)
6+
user_id: str
7+
organization_id: str
8+
sentry_app: str
129

1310

1411
analytics.register(InternalIntegrationCreatedEvent)
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app.created")
45
class SentryAppCreatedEvent(analytics.Event):
5-
type = "sentry_app.created"
6-
7-
attributes = (
8-
analytics.Attribute("user_id"),
9-
analytics.Attribute("organization_id"),
10-
analytics.Attribute("sentry_app"),
11-
analytics.Attribute("created_alert_rule_ui_component", type=bool, required=False),
12-
)
6+
user_id: str
7+
organization_id: str
8+
sentry_app: str
9+
created_alert_rule_ui_component: bool | None = None
1310

1411

1512
analytics.register(SentryAppCreatedEvent)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app.deleted")
45
class SentryAppDeletedEvent(analytics.Event):
5-
type = "sentry_app.deleted"
6-
7-
attributes = (
8-
analytics.Attribute("user_id"),
9-
analytics.Attribute("organization_id"),
10-
analytics.Attribute("sentry_app"),
11-
)
6+
user_id: str
7+
organization_id: str
8+
sentry_app: str
129

1310

1411
analytics.register(SentryAppDeletedEvent)
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app_installation_token.created")
45
class SentryAppInstallationTokenCreated(analytics.Event):
5-
type = "sentry_app_installation_token.created"
6-
7-
attributes = (
8-
analytics.Attribute("user_id"),
9-
analytics.Attribute("organization_id"),
10-
analytics.Attribute("sentry_app_installation_id"),
11-
analytics.Attribute("sentry_app"),
12-
)
6+
user_id: str
7+
organization_id: str
8+
sentry_app_installation_id: str
9+
sentry_app: str
1310

1411

1512
analytics.register(SentryAppInstallationTokenCreated)
Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app_installation_token.deleted")
45
class SentryAppInstallationTokenDeleted(analytics.Event):
5-
type = "sentry_app_installation_token.deleted"
6-
7-
attributes = (
8-
analytics.Attribute("user_id"),
9-
analytics.Attribute("organization_id"),
10-
analytics.Attribute("sentry_app_installation_id"),
11-
analytics.Attribute("sentry_app"),
12-
)
6+
user_id: str
7+
organization_id: str
8+
sentry_app_installation_id: str
9+
sentry_app: str
1310

1411

1512
analytics.register(SentryAppInstallationTokenDeleted)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app_installation.updated")
45
class SentryAppInstallationUpdatedEvent(analytics.Event):
5-
type = "sentry_app_installation.updated"
6-
7-
attributes = (
8-
analytics.Attribute("sentry_app_installation_id"),
9-
analytics.Attribute("sentry_app_id"),
10-
analytics.Attribute("organization_id"),
11-
)
6+
sentry_app_installation_id: str
7+
sentry_app_id: str
8+
organization_id: str
129

1310

1411
analytics.register(SentryAppInstallationUpdatedEvent)
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app.installed")
45
class SentryAppInstalledEvent(analytics.Event):
5-
type = "sentry_app.installed"
6-
7-
attributes = (
8-
analytics.Attribute("user_id"),
9-
analytics.Attribute("organization_id"),
10-
analytics.Attribute("sentry_app"),
11-
)
6+
user_id: str
7+
organization_id: str
8+
sentry_app: str
129

1310

1411
analytics.register(SentryAppInstalledEvent)
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app.schema_validation_error")
45
class SentryAppSchemaValidationError(analytics.Event):
5-
type = "sentry_app.schema_validation_error"
6-
7-
attributes = (
8-
analytics.Attribute("schema"),
9-
analytics.Attribute("user_id"),
10-
analytics.Attribute("sentry_app_id", required=False),
11-
analytics.Attribute("sentry_app_name"),
12-
analytics.Attribute("organization_id"),
13-
analytics.Attribute("error_message"),
14-
)
6+
schema: str
7+
user_id: str
8+
sentry_app_id: str | None = None
9+
sentry_app_name: str
10+
organization_id: str
11+
error_message: str
1512

1613

1714
analytics.register(SentryAppSchemaValidationError)
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
from sentry import analytics
22

33

4+
@analytics.eventclass("sentry_app.token_exchanged")
45
class SentryAppTokenExchangedEvent(analytics.Event):
5-
type = "sentry_app.token_exchanged"
6-
7-
attributes = (
8-
analytics.Attribute("sentry_app_installation_id"),
9-
analytics.Attribute("exchange_type"),
10-
)
6+
sentry_app_installation_id: str
7+
exchange_type: str
118

129

1310
analytics.register(SentryAppTokenExchangedEvent)

0 commit comments

Comments
 (0)