diff --git a/requirements-base.txt b/requirements-base.txt index 39121ad79c0745..a834c6154f574f 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -56,7 +56,7 @@ rfc3986-validator==0.1.1 # [end] jsonschema format validators sentry-arroyo==0.0.16 sentry-relay==0.8.12 -sentry-sdk>=1.4.3,<1.6.0 +sentry-sdk>=1.5.12,<1.6.0 snuba-sdk==1.0.0 simplejson==3.17.2 statsd==3.3 diff --git a/src/sentry/api/endpoints/organization_group_index.py b/src/sentry/api/endpoints/organization_group_index.py index 488bf6fb9d3f8b..2395f197301bb8 100644 --- a/src/sentry/api/endpoints/organization_group_index.py +++ b/src/sentry/api/endpoints/organization_group_index.py @@ -6,6 +6,7 @@ from rest_framework.exceptions import ParseError, PermissionDenied from rest_framework.request import Request from rest_framework.response import Response +from sentry_sdk import Hub from sentry import features, search from sentry.api.bases import OrganizationEventPermission, OrganizationEventsEndpointBase @@ -345,6 +346,10 @@ def get(self, request: Request, organization) -> Response: self.add_cursor_headers(request, response, cursor_result) # TODO(jess): add metrics that are similar to project endpoint here + transaction = Hub.current.scope.transaction + if transaction: + transaction.set_measurement("issues.unresolved", len(cursor_result)) + return response @track_slo_response("workflow") diff --git a/src/sentry/api/endpoints/organization_issues_count.py b/src/sentry/api/endpoints/organization_issues_count.py index 2bdae71f482d41..10b80c6068d4dd 100644 --- a/src/sentry/api/endpoints/organization_issues_count.py +++ b/src/sentry/api/endpoints/organization_issues_count.py @@ -1,6 +1,7 @@ from rest_framework.exceptions import ParseError from rest_framework.request import Request from rest_framework.response import Response +from sentry_sdk import Hub from sentry import features, search from sentry.api.bases import OrganizationEventsEndpointBase @@ -11,9 +12,13 @@ from sentry.types.ratelimit import RateLimit, RateLimitCategory ERR_INVALID_STATS_PERIOD = "Invalid stats_period. Valid choices are '', '24h', and '14d'" - - ISSUES_COUNT_MAX_HITS_LIMIT = 100 +QUERY_NAMES = { + "is:unresolved is:for_review assigned_or_suggested:[me, none]": "for_review", + "is:unresolved": "unresolved", + "is:ignored": "ignored", + "is:reprocessing": "reprocessing", +} class OrganizationIssuesCountEndpoint(OrganizationEventsEndpointBase): @@ -73,6 +78,7 @@ def get(self, request: Request, organization) -> Response: {"detail": "You do not have the multi project stream feature enabled"}, status=400 ) + transaction = Hub.current.scope.transaction queries = request.GET.getlist("query") response = {} for query in queries: @@ -86,6 +92,10 @@ def get(self, request: Request, organization) -> Response: {"count_hits": True, "date_to": end, "date_from": start}, ) response[query] = count + query_name = QUERY_NAMES.get(query, None) + if transaction and query_name and count: + transaction.set_measurement(f"issues.{query_name}", count) + except (ValidationError, discover.InvalidSearchQuery) as exc: return Response({"detail": str(exc)}, status=400) diff --git a/src/sentry/utils/sdk.py b/src/sentry/utils/sdk.py index fd28c99157a71b..a17854881265cc 100644 --- a/src/sentry/utils/sdk.py +++ b/src/sentry/utils/sdk.py @@ -340,6 +340,9 @@ def _capture_anything(self, method_name, *args, **kwargs): RedisIntegration(), ThreadingIntegration(propagate_hub=True), ], + _experiments={ + "custom_measurements": True, + }, **sdk_options, )