Browse Source

chore(issues-search): make issue type searches more human readable (#65810)

Described in #45195 

When using the `issues:type` tag in search, each option in the dropdown
menu will include a section to the right that is more human readable.
Previous:                              |  New:
:-------------------------:|:-------------------------:
<img width="707" alt="image"
src="https://github.com/getsentry/sentry/assets/55160142/e97062e2-1b20-4a5b-9b37-057913174b34">
| <img width="633" alt="image"
src="https://github.com/getsentry/sentry/assets/55160142/efcf9b95-dbe2-4645-bf80-c03c4a1a040f">


Extras:
- Updated `IssueTitle` enum in `group.tsx` to include all issue types.
Descriptions were copy pasted from the backend (`grouptype.py`), which
included previously absent issue titles.
Michael Sun 1 year ago
parent
commit
41e259d3ea
2 changed files with 51 additions and 1 deletions
  1. 2 1
      static/app/components/smartSearchBar/index.tsx
  2. 49 0
      static/app/types/group.tsx

+ 2 - 1
static/app/components/smartSearchBar/index.tsx

@@ -41,7 +41,7 @@ import {t} from 'sentry/locale';
 import MemberListStore from 'sentry/stores/memberListStore';
 import {space} from 'sentry/styles/space';
 import type {Organization, Tag, TagCollection, User} from 'sentry/types';
-import {SavedSearchType} from 'sentry/types';
+import {getIssueTitleFromType, SavedSearchType} from 'sentry/types';
 import {defined} from 'sentry/utils';
 import {trackAnalytics} from 'sentry/utils/analytics';
 import type {FieldDefinition} from 'sentry/utils/fields';
@@ -1312,6 +1312,7 @@ class SmartSearchBar extends Component<DefaultProps & Props, State> {
         return {
           value: escapedValue,
           desc: escapedValue,
+          documentation: getIssueTitleFromType(escapedValue) ?? '',
           type: ItemType.TAG_VALUE,
           ignoreMaxSearchItems: tag.maxSuggestedValues
             ? i < tag.maxSuggestedValues

+ 49 - 0
static/app/types/group.tsx

@@ -98,6 +98,7 @@ export enum IssueType {
 }
 
 export enum IssueTitle {
+  // Performance
   PERFORMANCE_CONSECUTIVE_DB_QUERIES = 'Consecutive DB Queries',
   PERFORMANCE_CONSECUTIVE_HTTP = 'Consecutive HTTP',
   PERFORMANCE_FILE_IO_MAIN_THREAD = 'File IO on Main Thread',
@@ -110,6 +111,54 @@ export enum IssueTitle {
   PERFORMANCE_LARGE_HTTP_PAYLOAD = 'Large HTTP payload',
   PERFORMANCE_HTTP_OVERHEAD = 'HTTP/1.1 Overhead',
   PERFORMANCE_DURATION_REGRESSION = 'Duration Regression',
+  PERFORMANCE_ENDPOINT_REGRESSION = 'Endpoint Regression',
+
+  // Profile
+  PROFILE_FILE_IO_MAIN_THREAD = 'File I/O on Main Thread',
+  PROFILE_IMAGE_DECODE_MAIN_THREAD = 'Image Decoding on Main Thread',
+  PROFILE_JSON_DECODE_MAIN_THREAD = 'JSON Decoding on Main Thread',
+  PROFILE_REGEX_MAIN_THREAD = 'Regex on Main Thread',
+  PROFILE_FRAME_DROP = 'Frame Drop',
+  PROFILE_FRAME_DROP_EXPERIMENTAL = 'Frame Drop',
+  PROFILE_FUNCTION_REGRESSION = 'Function Regression',
+  PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL = 'Function Duration Regression (Experimental)',
+
+  // Replay
+  REPLAY_RAGE_CLICK = 'Rage Click Detected',
+}
+
+const ISSUE_TYPE_TO_ISSUE_TITLE = {
+  performance_consecutive_db_queries: IssueTitle.PERFORMANCE_CONSECUTIVE_DB_QUERIES,
+  performance_consecutive_http: IssueTitle.PERFORMANCE_CONSECUTIVE_HTTP,
+  performance_file_io_main_thread: IssueTitle.PERFORMANCE_FILE_IO_MAIN_THREAD,
+  performance_db_main_thread: IssueTitle.PERFORMANCE_DB_MAIN_THREAD,
+  performance_n_plus_one_api_calls: IssueTitle.PERFORMANCE_N_PLUS_ONE_API_CALLS,
+  performance_n_plus_one_db_queries: IssueTitle.PERFORMANCE_N_PLUS_ONE_DB_QUERIES,
+  performance_slow_db_query: IssueTitle.PERFORMANCE_SLOW_DB_QUERY,
+  performance_render_blocking_asset_span: IssueTitle.PERFORMANCE_RENDER_BLOCKING_ASSET,
+  performance_uncompressed_assets: IssueTitle.PERFORMANCE_UNCOMPRESSED_ASSET,
+  performance_large_http_payload: IssueTitle.PERFORMANCE_LARGE_HTTP_PAYLOAD,
+  performance_http_overhead: IssueTitle.PERFORMANCE_HTTP_OVERHEAD,
+  performance_duration_regression: IssueTitle.PERFORMANCE_DURATION_REGRESSION,
+  performance_p95_endpoint_regression: IssueTitle.PERFORMANCE_ENDPOINT_REGRESSION,
+
+  profile_file_io_main_thread: IssueTitle.PROFILE_FILE_IO_MAIN_THREAD,
+  profile_image_decode_main_thread: IssueTitle.PROFILE_IMAGE_DECODE_MAIN_THREAD,
+  profile_json_decode_main_thread: IssueTitle.PROFILE_JSON_DECODE_MAIN_THREAD,
+  profile_regex_main_thread: IssueTitle.PROFILE_REGEX_MAIN_THREAD,
+  profile_frame_drop: IssueTitle.PROFILE_FRAME_DROP,
+  profile_frame_drop_experimental: IssueTitle.PROFILE_FRAME_DROP_EXPERIMENTAL,
+  profile_function_regression: IssueTitle.PROFILE_FUNCTION_REGRESSION,
+  profile_function_regression_exp: IssueTitle.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL,
+
+  replay_click_rage: IssueTitle.REPLAY_RAGE_CLICK,
+};
+
+export function getIssueTitleFromType(issueType: string): IssueTitle | undefined {
+  if (issueType in ISSUE_TYPE_TO_ISSUE_TITLE) {
+    return ISSUE_TYPE_TO_ISSUE_TITLE[issueType];
+  }
+  return undefined;
 }
 
 const OCCURRENCE_TYPE_TO_ISSUE_TYPE = {