Skip to content

Commit 08da8bd

Browse files
authored
ref(perf): Add projects tag to sdk update endpoint (#27408)
* ref(perf): Add projects tag to sdk update endpoint Having looked at some performance profiles, sdk-updates seems to be heavily affected by the number of passed projects. This will add a tag to the transaction so that it will show up in suspect tags and can be analyzed using the tag page.
1 parent d0a4754 commit 08da8bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/sentry/api/endpoints/organization_sdk_updates.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
from distutils.version import LooseVersion
33
from itertools import chain, groupby
44

5+
import sentry_sdk
56
from django.utils import timezone
67
from rest_framework.response import Response
78

89
from sentry.api.bases import OrganizationEventsEndpointBase
910
from sentry.sdk_updates import SdkIndexState, SdkSetupState, get_suggested_updates
1011
from sentry.snuba import discover
12+
from sentry.utils.numbers import format_grouped_length
1113

1214

1315
def by_sdk_name(sdk):
@@ -63,6 +65,11 @@ def get(self, request, organization):
6365

6466
project_ids = self.get_requested_project_ids(request)
6567
projects = self.get_projects(request, organization, project_ids)
68+
69+
len_projects = len(project_ids)
70+
sentry_sdk.set_tag("query.num_projects", len_projects)
71+
sentry_sdk.set_tag("query.num_projects.grouped", format_grouped_length(len_projects))
72+
6673
if len(projects) == 0:
6774
return Response([])
6875

0 commit comments

Comments
 (0)