Repository: getsentry/sentry

Issue:
Allow group events endpoint to query issue platform events
This endpoint powers the old version of issue event search. I don't think it's required since we use discover there now, but it's probably still worthwhile to get this to work with the issues platform.

Should be fairly easy to do so, I think we just need to make a change here:
https://github.com/getsentry/sentry/blob/c28d9b7abe002f1f18765dba36e4c273fd691276/src/sentry/api/helpers/events.py#L58-L59


Discussion:

Resolving patch:
diff --git a/src/sentry/api/helpers/events.py b/src/sentry/api/helpers/events.py
--- a/src/sentry/api/helpers/events.py
+++ b/src/sentry/api/helpers/events.py
@@ -53,9 +53,11 @@ def get_direct_hit_response(
 def get_query_builder_for_group(
     query: str, snuba_params: Mapping[str, Any], group: Group, limit: int, offset: int
 ) -> QueryBuilder:
-    dataset = Dataset.Events
+    dataset = Dataset.IssuePlatform
     if group.issue_category == GroupCategory.PERFORMANCE:
         dataset = Dataset.Transactions
+    elif group.issue_category == GroupCategory.ERROR:
+        dataset = Dataset.Events
     return QueryBuilder(
         dataset=dataset,
         query=f"issue:{group.qualified_short_id} {query}",
diff --git a/src/sentry/search/events/builder/discover.py b/src/sentry/search/events/builder/discover.py
--- a/src/sentry/search/events/builder/discover.py
+++ b/src/sentry/search/events/builder/discover.py
@@ -320,7 +320,12 @@ def load_config(
         Mapping[str, Callable[[Direction], OrderBy]],
     ]:
         self.config: DatasetConfig
-        if self.dataset in [Dataset.Discover, Dataset.Transactions, Dataset.Events]:
+        if self.dataset in [
+            Dataset.Discover,
+            Dataset.Transactions,
+            Dataset.Events,
+            Dataset.IssuePlatform,
+        ]:
             self.config = DiscoverDatasetConfig(self)
         elif self.dataset == Dataset.Sessions:
             self.config = SessionsDatasetConfig(self)


Test patch:
diff --git a/tests/snuba/api/endpoints/test_group_events.py b/tests/snuba/api/endpoints/test_group_events.py
--- a/tests/snuba/api/endpoints/test_group_events.py
+++ b/tests/snuba/api/endpoints/test_group_events.py
@@ -8,10 +8,12 @@
 from sentry.testutils.helpers import parse_link_header
 from sentry.testutils.helpers.datetime import before_now, iso_format
 from sentry.testutils.silo import region_silo_test
+from sentry.types.issues import GroupType
+from tests.sentry.issues.test_utils import SearchIssueTestMixin
 
 
 @region_silo_test
-class GroupEventsTest(APITestCase, SnubaTestCase, PerformanceIssueTestCase):
+class GroupEventsTest(APITestCase, SnubaTestCase, SearchIssueTestMixin, PerformanceIssueTestCase):
     def setUp(self):
         super().setUp()
         self.min_ago = before_now(minutes=1)
@@ -432,3 +434,29 @@ def test_perf_issue(self):
         assert sorted(map(lambda x: x["eventID"], response.data)) == sorted(
             [str(event_1.event_id), str(event_2.event_id)]
         )
+
+    def test_generic_issue(self):
+        event_1, _, group_info = self.store_search_issue(
+            self.project.id,
+            self.user.id,
+            [f"{GroupType.PROFILE_BLOCKED_THREAD.value}-group1"],
+            "prod",
+            timezone.now().replace(hour=0, minute=0, second=0) + timedelta(minutes=1),
+        )
+        event_2, _, _ = self.store_search_issue(
+            self.project.id,
+            self.user.id,
+            [f"{GroupType.PROFILE_BLOCKED_THREAD.value}-group1"],
+            "prod",
+            timezone.now().replace(hour=0, minute=0, second=0) + timedelta(minutes=1),
+        )
+
+        self.login_as(user=self.user)
+
+        url = f"/api/0/issues/{group_info.group.id}/events/"
+        response = self.do_request(url)
+
+        assert response.status_code == 200, response.content
+        assert sorted(map(lambda x: x["eventID"], response.data)) == sorted(
+            [str(event_1.event_id), str(event_2.event_id)]
+        )