Skip to content

Commit 786861a

Browse files
authored
feat(preprod): Add analytics to the assemble endpoint (#93871)
Adds some simple analytics to our endpoint so we can begin building a dashboard in Amplitude.
1 parent de377a6 commit 786861a

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

src/sentry/preprod/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .analytics import * # NOQA

src/sentry/preprod/analytics.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from sentry import analytics
2+
3+
4+
class PreprodArtifactApiAssembleEvent(analytics.Event):
5+
type = "preprod_artifact.api.assemble"
6+
7+
attributes = (
8+
analytics.Attribute("organization_id"),
9+
analytics.Attribute("project_id"),
10+
analytics.Attribute("user_id", required=False),
11+
)
12+
13+
14+
analytics.register(PreprodArtifactApiAssembleEvent)

src/sentry/preprod/api/endpoints/organization_preprod_artifact_assemble.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from rest_framework.request import Request
55
from rest_framework.response import Response
66

7-
from sentry import features
7+
from sentry import analytics, features
88
from sentry.api.api_owners import ApiOwner
99
from sentry.api.api_publish_status import ApiPublishStatus
1010
from sentry.api.base import region_silo_endpoint
@@ -77,6 +77,14 @@ def post(self, request: Request, project) -> Response:
7777
"""
7878
Assembles a preprod artifact (mobile build, etc.) and stores it in the database.
7979
"""
80+
81+
analytics.record(
82+
"preprod_artifact.api.assemble",
83+
organization_id=project.organization_id,
84+
project_id=project.id,
85+
user_id=request.user.id,
86+
)
87+
8088
if not features.has(
8189
"organizations:preprod-artifact-assemble", project.organization, actor=request.user
8290
):

0 commit comments

Comments
 (0)