Просмотр исходного кода

fix(profiling): Remove dependency on version for profile summary page (#35151)

The dependency on having a version makes this page difficult to work with. This
change removes the dependency and follows the new response format.
Tony Xiao 2 лет назад
Родитель
Сommit
3b835447d8

+ 0 - 2
static/app/components/profiling/breadcrumb.tsx

@@ -53,7 +53,6 @@ function trailToCrumb(
           orgSlug: organization.slug,
           projectSlug: trail.payload.projectSlug,
           transaction: trail.payload.transaction,
-          version: trail.payload.version,
         }),
         label: t('Profile Summary'),
         preservePageFilters: true,
@@ -84,7 +83,6 @@ type ProfileSummaryTrail = {
   payload: {
     projectSlug: Project['slug'];
     transaction: string;
-    version: string;
   };
   type: 'profile summary';
 };

+ 0 - 3
static/app/components/profiling/profilesTable.tsx

@@ -136,9 +136,6 @@ function ProfilesTableCell({column, dataRow}: ProfilesTableCellProps) {
         orgSlug: organization.slug,
         projectSlug: project.slug,
         transaction: dataRow.transaction_name,
-        version: dataRow.version_code
-          ? `${dataRow.version_name} (build ${dataRow.version_code})`
-          : `${dataRow.version_name}`,
       });
 
       return (

+ 2 - 17
static/app/utils/profiling/hooks/useFunctions.tsx

@@ -14,7 +14,6 @@ interface UseFunctionsOptions {
   project: Project;
   query: string;
   transaction: string;
-  version: string;
   selection?: PageFilters;
 }
 
@@ -22,7 +21,6 @@ function useFunctions({
   project,
   query,
   transaction,
-  version,
   selection,
 }: UseFunctionsOptions): RequestState<FunctionCall[]> {
   const api = useApi();
@@ -44,12 +42,11 @@ function useFunctions({
       query,
       selection,
       transaction,
-      version,
     })
       .then(functions => {
         setRequestState({
           type: 'resolved',
-          data: functions.Versions[version]?.FunctionCalls ?? [],
+          data: functions.functions ?? [],
         });
       })
       .catch(err => {
@@ -58,16 +55,7 @@ function useFunctions({
       });
 
     return () => api.clear();
-  }, [
-    api,
-    organization,
-    project.slug,
-    query,
-    selection,
-    transaction,
-    version,
-    setRequestState,
-  ]);
+  }, [api, organization, project.slug, query, selection, transaction]);
 
   return requestState;
 }
@@ -80,18 +68,15 @@ function fetchFunctions(
     query,
     selection,
     transaction,
-    version,
   }: {
     projectSlug: Project['slug'];
     query: string;
     selection: PageFilters;
     transaction: string;
-    version: string;
   }
 ) {
   const conditions = new MutableSearch(query);
   conditions.setFilterValues('transaction_name', [transaction]);
-  conditions.setFilterValues('version', [version]);
 
   return api.requestPromise(
     `/projects/${organization.slug}/${projectSlug}/profiling/functions/`,

+ 0 - 3
static/app/utils/profiling/routes.tsx

@@ -66,12 +66,10 @@ export function generateProfileSummaryRouteWithQuery({
   projectSlug,
   transaction,
   query,
-  version,
 }: {
   orgSlug: Organization['slug'];
   projectSlug: Project['slug'];
   transaction: string;
-  version: string;
   location?: Location;
   query?: Location['query'];
 }): LocationDescriptor {
@@ -82,7 +80,6 @@ export function generateProfileSummaryRouteWithQuery({
       ...location?.query,
       ...query,
       transaction,
-      version,
     },
   };
 }

+ 0 - 2
static/app/views/profiling/profileSummary/content.tsx

@@ -28,7 +28,6 @@ interface ProfileSummaryContentProps {
   project: Project;
   query: string;
   transaction: string;
-  version: string;
   selection?: PageFilters;
 }
 
@@ -50,7 +49,6 @@ function ProfileSummaryContent(props: ProfileSummaryContentProps) {
     query: props.query,
     selection: props.selection,
     transaction: props.transaction,
-    version: props.version,
   });
 
   return (

+ 5 - 20
static/app/views/profiling/profileSummary/index.tsx

@@ -14,7 +14,7 @@ import {Breadcrumb} from 'sentry/components/profiling/breadcrumb';
 import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
 import SmartSearchBar, {SmartSearchBarProps} from 'sentry/components/smartSearchBar';
 import {MAX_QUERY_LENGTH} from 'sentry/constants';
-import {t, tct} from 'sentry/locale';
+import {t} from 'sentry/locale';
 import space from 'sentry/styles/space';
 import {PageFilters, Project} from 'sentry/types';
 import {defined} from 'sentry/utils';
@@ -46,8 +46,6 @@ function ProfileSummaryPage(props: ProfileSummaryPageProps) {
   const project = projects.length === 1 ? projects[0] : null;
 
   const transaction = decodeScalar(props.location.query.transaction);
-  // TODO: version should not be required on this page at all, it should be a search filter
-  const version = decodeScalar(props.location.query.version);
 
   const rawQuery = useMemo(
     () => decodeScalar(props.location.query.query, ''),
@@ -61,12 +59,8 @@ function ProfileSummaryPage(props: ProfileSummaryPageProps) {
       search.setFilterValues('transaction_name', [transaction]);
     }
 
-    if (defined(version)) {
-      search.setFilterValues('version', [version]);
-    }
-
     return search.formatString();
-  }, [rawQuery, transaction, version]);
+  }, [rawQuery, transaction]);
 
   const filtersQuery = useMemo(() => {
     // To avoid querying for the filters each time the query changes,
@@ -77,12 +71,8 @@ function ProfileSummaryPage(props: ProfileSummaryPageProps) {
       search.setFilterValues('transaction_name', [transaction]);
     }
 
-    if (defined(version)) {
-      search.setFilterValues('version', [version]);
-    }
-
     return search.formatString();
-  }, [transaction, version]);
+  }, [transaction]);
 
   const profileFilters = useProfileFilters({
     query: filtersQuery,
@@ -117,7 +107,7 @@ function ProfileSummaryPage(props: ProfileSummaryPageProps) {
         hideGlobalHeader
       >
         <NoProjectMessage organization={organization}>
-          {project && transaction && version && (
+          {project && transaction && (
             <Fragment>
               <Layout.Header>
                 <Layout.HeaderContent>
@@ -131,7 +121,6 @@ function ProfileSummaryPage(props: ProfileSummaryPageProps) {
                         payload: {
                           projectSlug: project.slug,
                           transaction,
-                          version,
                         },
                       },
                     ]}
@@ -144,10 +133,7 @@ function ProfileSummaryPage(props: ProfileSummaryPageProps) {
                         hideName
                         avatarProps={{hasTooltip: true, tooltip: project.slug}}
                       />
-                      {tct('[transaction] \u2014 [version]', {
-                        transaction,
-                        version,
-                      })}
+                      {transaction}
                     </Title>
                   </Layout.Title>
                 </Layout.HeaderContent>
@@ -174,7 +160,6 @@ function ProfileSummaryPage(props: ProfileSummaryPageProps) {
                     project={project}
                     selection={props.selection}
                     transaction={transaction}
-                    version={version}
                     query={query}
                   />
                 </Layout.Main>

+ 1 - 7
tests/js/spec/utils/profiling/hooks/useFunctions.spec.tsx

@@ -42,7 +42,6 @@ describe('useFunctions', function () {
           project,
           query: '',
           transaction: '',
-          version: '',
         }),
       {wrapper: TestContext}
     );
@@ -53,11 +52,7 @@ describe('useFunctions', function () {
     MockApiClient.addMockResponse({
       url: `/projects/org-slug/${project.slug}/profiling/functions/`,
       body: {
-        Versions: {
-          '': {
-            FunctionCalls: [],
-          },
-        },
+        functions: [],
       },
     });
 
@@ -67,7 +62,6 @@ describe('useFunctions', function () {
           project,
           query: '',
           transaction: '',
-          version: '',
           selection,
         }),
       {wrapper: TestContext}