Repository: getsentry/sentry

Issue:
Replay preview with the "> Open Replay" button is setting up expectations that the preview will just play
### Current Preview & Problem:

![Screenshot 2023-01-12 at 12 26 39 PM](https://user-images.githubusercontent.com/187460/212193441-e142c6d5-ed2c-4ed8-a3c3-28989b4805c7.png)


> i expected it to play without taking me out of the issue i was looking through [...] just a thought considering i want to keep looking at breadcrumbs
> its like hitting a youtube video play icon and being taken out of your page


### Suggestions:

> would you possibly consider 2 buttons? 1 for playing in the issue detail itself just to see what that feels like and 1 for going to replay details?



![Image](https://user-images.githubusercontent.com/187460/212192968-9f85ffbe-5e66-4658-97b7-96a1371fb001.png)



the play icon is like a logo in this case
> not like i expect an icon logo for every button i have. replay is not its own company





Discussion:

Resolving patch:
diff --git a/src/sentry/types/issues.py b/src/sentry/types/issues.py
--- a/src/sentry/types/issues.py
+++ b/src/sentry/types/issues.py
@@ -11,7 +11,7 @@ class GroupType(Enum):
     PERFORMANCE_SLOW_SPAN = 1001
     PERFORMANCE_RENDER_BLOCKING_ASSET_SPAN = 1004
     PERFORMANCE_N_PLUS_ONE_DB_QUERIES = 1006
-    PERFORMANCE_CONSECUTIVE_DB_OP = 1007
+    PERFORMANCE_CONSECUTIVE_DB_QUERIES = 1007
     PERFORMANCE_FILE_IO_MAIN_THREAD = 1008
     PERFORMANCE_N_PLUS_ONE_API_CALLS = 1010
     PERFORMANCE_M_N_PLUS_ONE_DB_QUERIES = 1011
@@ -30,7 +30,7 @@ class GroupCategory(Enum):
 
 GROUP_TYPE_TO_CATEGORY = {
     GroupType.ERROR: GroupCategory.ERROR,
-    GroupType.PERFORMANCE_CONSECUTIVE_DB_OP: GroupCategory.PERFORMANCE,
+    GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES: GroupCategory.PERFORMANCE,
     GroupType.PERFORMANCE_SLOW_SPAN: GroupCategory.PERFORMANCE,
     GroupType.PERFORMANCE_RENDER_BLOCKING_ASSET_SPAN: GroupCategory.PERFORMANCE,
     GroupType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES: GroupCategory.PERFORMANCE,
@@ -43,7 +43,7 @@ class GroupCategory(Enum):
 
 GROUP_TYPE_TO_TEXT = {
     GroupType.ERROR: "Error",
-    GroupType.PERFORMANCE_CONSECUTIVE_DB_OP: "Consecutive DB Queries",
+    GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES: "Consecutive DB Queries",
     GroupType.PERFORMANCE_SLOW_SPAN: "Slow Span",
     GroupType.PERFORMANCE_RENDER_BLOCKING_ASSET_SPAN: "Render Blocking Asset Span",
     GroupType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES: "N+1 Query",
diff --git a/src/sentry/utils/performance_issues/performance_detection.py b/src/sentry/utils/performance_issues/performance_detection.py
--- a/src/sentry/utils/performance_issues/performance_detection.py
+++ b/src/sentry/utils/performance_issues/performance_detection.py
@@ -69,7 +69,7 @@ class DetectorType(Enum):
     DetectorType.N_PLUS_ONE_DB_QUERIES: GroupType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
     DetectorType.N_PLUS_ONE_DB_QUERIES_EXTENDED: GroupType.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
     DetectorType.N_PLUS_ONE_API_CALLS: GroupType.PERFORMANCE_N_PLUS_ONE_API_CALLS,
-    DetectorType.CONSECUTIVE_DB_OP: GroupType.PERFORMANCE_CONSECUTIVE_DB_OP,
+    DetectorType.CONSECUTIVE_DB_OP: GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
     DetectorType.FILE_IO_MAIN_THREAD: GroupType.PERFORMANCE_FILE_IO_MAIN_THREAD,
     DetectorType.M_N_PLUS_ONE_DB: GroupType.PERFORMANCE_M_N_PLUS_ONE_DB_QUERIES,
     DetectorType.UNCOMPRESSED_ASSETS: GroupType.PERFORMANCE_UNCOMPRESSED_ASSETS,
@@ -874,15 +874,16 @@ def _validate_and_store_performance_problem(self):
 
     def _store_performance_problem(self) -> None:
         fingerprint = self._fingerprint()
-        offender_span_ids = [span.get("span_id", None) for span in self.consecutive_db_spans]
+        offender_span_ids = [span.get("span_id", None) for span in self.independent_db_spans]
+        cause_span_ids = [span.get("span_id", None) for span in self.consecutive_db_spans]
         query: str = self.independent_db_spans[0].get("description", None)
 
         self.stored_problems[fingerprint] = PerformanceProblem(
             fingerprint,
             "db",
             desc=query,  # TODO - figure out which query to use for description
-            type=GroupType.PERFORMANCE_CONSECUTIVE_DB_OP,
-            cause_span_ids=None,
+            type=GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
+            cause_span_ids=cause_span_ids,
             parent_span_ids=None,
             offender_span_ids=offender_span_ids,
         )
@@ -957,7 +958,7 @@ def _is_db_query(self, span: Span) -> bool:
 
     def _fingerprint(self) -> str:
         hashed_spans = fingerprint_spans(self.consecutive_db_spans)
-        return f"1-{GroupType.PERFORMANCE_CONSECUTIVE_DB_OP.value}-{hashed_spans}"
+        return f"1-{GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES.value}-{hashed_spans}"
 
     def on_complete(self) -> None:
         self._validate_and_store_performance_problem()


Test patch:
diff --git a/tests/sentry/utils/performance_issues/test_consecutive_db_detector.py b/tests/sentry/utils/performance_issues/test_consecutive_db_detector.py
--- a/tests/sentry/utils/performance_issues/test_consecutive_db_detector.py
+++ b/tests/sentry/utils/performance_issues/test_consecutive_db_detector.py
@@ -51,10 +51,10 @@ def test_detects_consecutive_db_spans(self):
                 fingerprint="1-1007-e6a9fc04320a924f46c7c737432bb0389d9dd095",
                 op="db",
                 desc="SELECT `order`.`id` FROM `books_author`",
-                type=GroupType.PERFORMANCE_CONSECUTIVE_DB_OP,
+                type=GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
                 parent_span_ids=None,
-                cause_span_ids=None,
-                offender_span_ids=["bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb"],
+                cause_span_ids=["bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb"],
+                offender_span_ids=["bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb"],
             )
         ]
 
@@ -148,10 +148,10 @@ def test_detects_consecutive_db_in_query_waterfall_event(self):
                 fingerprint="1-1007-0700523cc3ca755e447329779e50aeb19549e74f",
                 op="db",
                 desc="SELECT `books_book`.`id`, `books_book`.`title`, `books_book`.`author_id` FROM `books_book` ORDER BY `books_book`.`id` ASC LIMIT 1",
-                type=GroupType.PERFORMANCE_CONSECUTIVE_DB_OP,
+                type=GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
                 parent_span_ids=None,
-                cause_span_ids=None,
-                offender_span_ids=["abca1c35669c11f2", "a6e7c330f656df7f", "857ee9ba7db8cd31"],
+                cause_span_ids=["abca1c35669c11f2", "a6e7c330f656df7f", "857ee9ba7db8cd31"],
+                offender_span_ids=["857ee9ba7db8cd31"],
             )
         ]
 
@@ -204,9 +204,9 @@ def test_detects_consecutive_db_with_high_time_saving(self):
                 fingerprint="1-1007-e6a9fc04320a924f46c7c737432bb0389d9dd095",
                 op="db",
                 desc="SELECT COUNT(*) FROM `products`",
-                type=GroupType.PERFORMANCE_CONSECUTIVE_DB_OP,
+                type=GroupType.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
                 parent_span_ids=None,
-                cause_span_ids=None,
-                offender_span_ids=["bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb"],
+                cause_span_ids=["bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbb"],
+                offender_span_ids=["bbbbbbbbbbbbbbbb"],
             )
         ]