Browse Source

chore(insights): Remove rollout flag checks (#72885)

Best enjoyed with whitespace off. Rollout is complete, remove the flag
checks.
George Gritsouk 8 months ago
parent
commit
69abdb3c88

+ 3 - 47
static/app/components/sidebar/index.spec.tsx

@@ -346,52 +346,8 @@ describe('Sidebar', function () {
     });
 
     it('in regular mode, also shows links to Performance and Crons', async function () {
-      renderSidebarWithFeatures(ALL_AVAILABLE_FEATURES);
-
-      await waitFor(function () {
-        expect(apiMocks.broadcasts).toHaveBeenCalled();
-      });
-
-      const links = screen.getAllByRole('link');
-      expect(links).toHaveLength(29);
-
-      [
-        'Issues',
-        'Projects',
-        /Performance/,
-        'Queries',
-        'Requests',
-        /Caches/,
-        'Web Vitals',
-        /Queues/,
-        'Screen Loads',
-        'App Starts',
-        'Assets',
-        /Mobile UI/,
-        /Traces/,
-        'Profiling',
-        /Metrics/,
-        'Replays',
-        /LLM Monitoring/,
-        'User Feedback',
-        'Crons',
-        'Alerts',
-        'Discover',
-        'Dashboards',
-        'Releases',
-        'Stats',
-        'Settings',
-        'Help',
-        /What's new/,
-        'Service status',
-      ].forEach((title, index) => {
-        expect(links[index]).toHaveAccessibleName(title);
-      });
-    });
-
-    it('if Insights are on, shows links to Explore and Insights', async function () {
       localStorage.setItem('sidebar-accordion-insights:expanded', 'true');
-      renderSidebarWithFeatures([...ALL_AVAILABLE_FEATURES, 'performance-insights']);
+      renderSidebarWithFeatures([...ALL_AVAILABLE_FEATURES]);
 
       await waitFor(function () {
         expect(apiMocks.broadcasts).toHaveBeenCalled();
@@ -438,14 +394,14 @@ describe('Sidebar', function () {
 
     it('should not render floating accordion when expanded', async () => {
       renderSidebarWithFeatures(ALL_AVAILABLE_FEATURES);
-      await userEvent.click(screen.getByTestId('sidebar-accordion-performance-item'));
+      await userEvent.click(screen.getByTestId('sidebar-accordion-insights-item'));
       expect(screen.queryByTestId('floating-accordion')).not.toBeInTheDocument();
     });
 
     it('should render floating accordion when collapsed', async () => {
       renderSidebarWithFeatures(ALL_AVAILABLE_FEATURES);
       await userEvent.click(screen.getByTestId('sidebar-collapse'));
-      await userEvent.click(screen.getByTestId('sidebar-accordion-performance-item'));
+      await userEvent.click(screen.getByTestId('sidebar-accordion-insights-item'));
       expect(await screen.findByTestId('floating-accordion')).toBeInTheDocument();
     });
   });

+ 14 - 78
static/app/components/sidebar/index.tsx

@@ -23,8 +23,6 @@ import {
   IconIssues,
   IconLightning,
   IconMegaphone,
-  IconPlay,
-  IconProfiling,
   IconProject,
   IconReleases,
   IconSearch,
@@ -32,10 +30,8 @@ import {
   IconSiren,
   IconStats,
   IconSupport,
-  IconTelescope,
   IconTimer,
 } from 'sentry/icons';
-import {IconRobot} from 'sentry/icons/iconRobot';
 import {t} from 'sentry/locale';
 import ConfigStore from 'sentry/stores/configStore';
 import DemoWalkthroughStore from 'sentry/stores/demoWalkthroughStore';
@@ -198,10 +194,6 @@ function Sidebar() {
     organization,
   };
 
-  // New hierarchy organizes current links into two accordions: "Explore" and "Insights". This means setting up different sidebar groupings, and changing some link icons to small dots, since they now live under an accordion
-  const hasNewSidebarHierarchy =
-    hasOrganization && organization.features.includes('performance-insights');
-
   const sidebarAnchor = isDemoWalkthrough() ? (
     <GuideAnchor target="projects" disabled={!DemoWalkthroughStore.get('sidebar')}>
       {t('Projects')}
@@ -240,7 +232,7 @@ function Sidebar() {
     >
       <SidebarItem
         {...sidebarItemProps}
-        icon={hasNewSidebarHierarchy ? <SubitemDot collapsed /> : <IconTelescope />}
+        icon={<SubitemDot collapsed />}
         label={<GuideAnchor target="discover">{t('Discover')}</GuideAnchor>}
         to={getDiscoverLandingUrl(organization)}
         id="discover-v2"
@@ -394,7 +386,7 @@ function Sidebar() {
     <Feature features={['insights-entry-points']} organization={organization}>
       <SidebarItem
         {...sidebarItemProps}
-        icon={hasNewSidebarHierarchy ? <SubitemDot collapsed /> : <IconRobot />}
+        icon={<SubitemDot collapsed />}
         label={MODULE_TITLES.ai}
         {...LLMModuleBadgeProps}
         to={`/organizations/${organization.slug}/${moduleURLBuilder('ai')}/`}
@@ -409,47 +401,13 @@ function Sidebar() {
       features="performance-view"
       organization={organization}
     >
-      {(() => {
-        // If the client has the old sidebar hierarchy _and_ something to show inside the Performance dropdown, render an accordion.
-        if (
-          !hasNewSidebarHierarchy &&
-          (organization.features.includes('insights-entry-points') ||
-            organization.features.includes('performance-trace-explorer'))
-        ) {
-          return (
-            <SidebarAccordion
-              {...sidebarItemProps}
-              icon={<IconLightning />}
-              label={<GuideAnchor target="performance">{t('Performance')}</GuideAnchor>}
-              to={`/organizations/${organization.slug}/performance/`}
-              id="performance"
-              exact={!shouldAccordionFloat}
-            >
-              {queries}
-              {requests}
-              {caches}
-              {webVitals}
-              {queues}
-              {screenLoads}
-              {appStarts}
-              {resources}
-              {mobileUI}
-              {traces}
-            </SidebarAccordion>
-          );
-        }
-
-        // Otherwise, show a regular sidebar link to the Performance landing page
-        return (
-          <SidebarItem
-            {...sidebarItemProps}
-            icon={<IconLightning />}
-            label={<GuideAnchor target="performance">{t('Performance')}</GuideAnchor>}
-            to={`/organizations/${organization.slug}/performance/`}
-            id="performance"
-          />
-        );
-      })()}
+      <SidebarItem
+        {...sidebarItemProps}
+        icon={<IconLightning />}
+        label={<GuideAnchor target="performance">{t('Performance')}</GuideAnchor>}
+        to={`/organizations/${organization.slug}/performance/`}
+        id="performance"
+      />
     </Feature>
   );
 
@@ -517,7 +475,7 @@ function Sidebar() {
     >
       <SidebarItem
         {...sidebarItemProps}
-        icon={hasNewSidebarHierarchy ? <SubitemDot collapsed /> : <IconPlay />}
+        icon={<SubitemDot collapsed />}
         label={t('Replays')}
         to={`/organizations/${organization.slug}/replays/`}
         id="replays"
@@ -530,7 +488,7 @@ function Sidebar() {
   const metrics = hasOrganization && hasCustomMetrics(organization) && (
     <SidebarItem
       {...sidebarItemProps}
-      icon={hasNewSidebarHierarchy ? <SubitemDot collapsed /> : <IconGraph />}
+      icon={<SubitemDot collapsed />}
       label={t('Metrics')}
       to={metricsPath}
       search={location?.pathname === normalizeUrl(metricsPath) ? location.search : ''}
@@ -567,8 +525,8 @@ function Sidebar() {
       <SidebarItem
         {...sidebarItemProps}
         index
-        icon={hasNewSidebarHierarchy ? <SubitemDot collapsed /> : <IconProfiling />}
-        label={hasNewSidebarHierarchy ? t('Profiles') : t('Profiling')}
+        icon={<SubitemDot collapsed />}
+        label={t('Profiles')}
         to={`/organizations/${organization.slug}/profiling/`}
         id="profiling"
       />
@@ -658,7 +616,7 @@ function Sidebar() {
                   {projects}
                 </SidebarSection>
 
-                {hasNewSidebarHierarchy && !isSelfHostedErrorsOnly && (
+                {!isSelfHostedErrorsOnly && (
                   <Fragment>
                     <SidebarSection>
                       {explore}
@@ -676,28 +634,6 @@ function Sidebar() {
                   </Fragment>
                 )}
 
-                {!hasNewSidebarHierarchy && !isSelfHostedErrorsOnly && (
-                  <Fragment>
-                    <SidebarSection>
-                      {performance}
-                      {profiling}
-                      {metrics}
-                      {replays}
-                      {llmMonitoring}
-                      {feedback}
-                      {monitors}
-                      {alerts}
-                    </SidebarSection>
-
-                    <SidebarSection>
-                      {discover2}
-                      {dashboards}
-                      {releases}
-                      {userFeedback}
-                    </SidebarSection>
-                  </Fragment>
-                )}
-
                 {isSelfHostedErrorsOnly && (
                   <Fragment>
                     <SidebarSection>

+ 6 - 5
static/app/routes.tsx

@@ -19,6 +19,7 @@ import IssueListOverview from 'sentry/views/issueList/overview';
 import OrganizationContainer from 'sentry/views/organizationContainer';
 import OrganizationLayout from 'sentry/views/organizationLayout';
 import OrganizationRoot from 'sentry/views/organizationRoot';
+import {INSIGHTS_BASE_URL} from 'sentry/views/performance/settings';
 import {MODULE_BASE_URLS} from 'sentry/views/performance/utils/useModuleURL';
 import ProjectEventRedirect from 'sentry/views/projectEventRedirect';
 import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute';
@@ -1447,12 +1448,12 @@ function buildRoutes() {
   const llmMonitoringRedirects = USING_CUSTOMER_DOMAIN ? (
     <Redirect
       from="/llm-monitoring/"
-      to={`/insights/${MODULE_BASE_URLS[ModuleName.AI]}/`}
+      to={`/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.AI]}/`}
     />
   ) : (
     <Redirect
       from="/organizations/:orgId/llm-monitoring/"
-      to={`/organizations/:orgId/insights/${MODULE_BASE_URLS[ModuleName.AI]}/`}
+      to={`/organizations/:orgId/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.AI]}/`}
     />
   );
 
@@ -1463,14 +1464,14 @@ function buildRoutes() {
           <Redirect
             key={moduleBaseURL}
             from={`${moduleBaseURL}`}
-            to={`/insights/${moduleBaseURL}/`}
+            to={`/${INSIGHTS_BASE_URL}/${moduleBaseURL}/`}
           />
         )
     )
     .filter(Boolean);
 
   const insightsRoutes = (
-    <Route path="/insights/" withOrgPath>
+    <Route path={`/${INSIGHTS_BASE_URL}/`} withOrgPath>
       <Route path={`${MODULE_BASE_URLS[ModuleName.DB]}/`}>
         <IndexRoute
           component={make(
@@ -1690,7 +1691,7 @@ function buildRoutes() {
       {insightsRedirects}
       <Redirect
         from="browser/resources"
-        to={`/insights/${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}
+        to={`/${INSIGHTS_BASE_URL}/${MODULE_BASE_URLS[ModuleName.RESOURCE]}/`}
       />
       <Route
         path=":eventSlug/"

+ 1 - 1
static/app/views/performance/cache/cacheLandingPage.spec.tsx

@@ -24,7 +24,7 @@ const requestMocks = {
 };
 
 describe('CacheLandingPage', function () {
-  const organization = OrganizationFixture({features: ['performance-insights']});
+  const organization = OrganizationFixture();
 
   jest.mocked(usePageFilters).mockReturnValue({
     isReady: true,

+ 1 - 1
static/app/views/performance/database/databaseSpanSummaryPage.spec.tsx

@@ -334,7 +334,7 @@ describe('DatabaseSpanSummaryPage', function () {
     expect(screen.getByRole('cell', {name: 'GET /api/users'})).toBeInTheDocument();
     expect(screen.getByRole('link', {name: 'GET /api/users'})).toHaveAttribute(
       'href',
-      '/organizations/org-slug/performance/database/spans/span/1756baf8fd19c116?statsPeriod=10d&transaction=%2Fapi%2Fusers&transactionMethod=GET&transactionsCursor=0%3A25%3A0'
+      '/organizations/org-slug/insights/database/spans/span/1756baf8fd19c116?statsPeriod=10d&transaction=%2Fapi%2Fusers&transactionMethod=GET&transactionsCursor=0%3A25%3A0'
     );
     expect(screen.getByRole('cell', {name: '17.9/s'})).toBeInTheDocument();
     expect(screen.getByRole('cell', {name: '204.50ms'})).toBeInTheDocument();

+ 1 - 1
static/app/views/performance/http/httpDomainSummaryPage.spec.tsx

@@ -296,7 +296,7 @@ describe('HTTPSummaryPage', function () {
     expect(screen.getByRole('cell', {name: 'GET /api/users'})).toBeInTheDocument();
     expect(screen.getByRole('link', {name: 'GET /api/users'})).toHaveAttribute(
       'href',
-      '/organizations/org-slug/performance/http/domains/?domain=%2A.sentry.dev&project=8&statsPeriod=10d&transaction=%2Fapi%2Fusers&transactionMethod=GET&transactionsCursor=0%3A20%3A0'
+      '/organizations/org-slug/insights/http/domains/?domain=%2A.sentry.dev&project=8&statsPeriod=10d&transaction=%2Fapi%2Fusers&transactionMethod=GET&transactionsCursor=0%3A20%3A0'
     );
     expect(screen.getByRole('cell', {name: '17.9/s'})).toBeInTheDocument();
     expect(screen.getByRole('cell', {name: '97%'})).toBeInTheDocument();

+ 1 - 1
static/app/views/performance/http/httpLandingPage.spec.tsx

@@ -290,7 +290,7 @@ describe('HTTPLandingPage', function () {
     expect(screen.getByRole('cell', {name: '*.sentry.io'})).toBeInTheDocument();
     expect(screen.getByRole('link', {name: '*.sentry.io'})).toHaveAttribute(
       'href',
-      '/organizations/org-slug/performance/http/domains/?domain=%2A.sentry.io&project=1&statsPeriod=10d'
+      '/organizations/org-slug/insights/http/domains/?domain=%2A.sentry.io&project=1&statsPeriod=10d'
     );
     expect(screen.getByRole('cell', {name: 'backend'})).toBeInTheDocument();
     expect(screen.getByRole('link', {name: 'backend'})).toHaveAttribute(

+ 4 - 4
static/app/views/performance/landing/widgets/components/widgetContainer.spec.tsx

@@ -869,7 +869,7 @@ describe('Performance > Widgets > WidgetContainer', function () {
     );
     expect(await screen.findByRole('button', {name: 'View All'})).toHaveAttribute(
       'href',
-      '/performance/database/'
+      '/insights/database/'
     );
     expect(eventsMock).toHaveBeenCalledTimes(1);
     expect(eventsMock).toHaveBeenNthCalledWith(
@@ -915,7 +915,7 @@ describe('Performance > Widgets > WidgetContainer', function () {
     );
     expect(await screen.findByRole('button', {name: 'View All'})).toHaveAttribute(
       'href',
-      '/performance/http/'
+      '/insights/http/'
     );
     expect(eventsMock).toHaveBeenCalledTimes(1);
     expect(eventsMock).toHaveBeenNthCalledWith(
@@ -943,7 +943,7 @@ describe('Performance > Widgets > WidgetContainer', function () {
   });
 
   it('Most time consuming resources widget', async function () {
-    const data = initializeData(undefined, {features: ['performance-insights']});
+    const data = initializeData();
 
     wrapper = render(
       <MEPSettingProvider forceTransactions>
@@ -1008,7 +1008,7 @@ describe('Performance > Widgets > WidgetContainer', function () {
     );
     expect(await screen.findByRole('button', {name: 'View All'})).toHaveAttribute(
       'href',
-      '/performance/caches/'
+      '/insights/caches/'
     );
     expect(eventsMock).toHaveBeenCalledTimes(1);
     expect(eventsMock).toHaveBeenNthCalledWith(

+ 1 - 1
static/app/views/performance/mobile/appStarts/screenSummary/spanOperationTable.spec.tsx

@@ -94,7 +94,7 @@ describe('SpanOpSelector', function () {
 
     expect(screen.getByRole('link', {name: 'Application Init'})).toHaveAttribute(
       'href',
-      '/organizations/org-slug/performance/mobile/app-startup/spans/?spanDescription=Application%20Init&spanGroup=7f4be68f08c0455f&spanOp=app.start.warm&transaction=foo-bar'
+      '/organizations/org-slug/insights/mobile/app-startup/spans/?spanDescription=Application%20Init&spanGroup=7f4be68f08c0455f&spanOp=app.start.warm&transaction=foo-bar'
     );
   });
 

+ 2 - 3
static/app/views/performance/modulePageProviders.tsx

@@ -7,7 +7,7 @@ import PageFiltersContainer from 'sentry/components/organizations/pageFilters/co
 import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
 import useOrganization from 'sentry/utils/useOrganization';
 import {NoAccess} from 'sentry/views/performance/database/noAccess';
-import {useInsightsTitle} from 'sentry/views/performance/utils/useInsightsTitle';
+import {INSIGHTS_TITLE} from 'sentry/views/performance/settings';
 import {useModuleTitle} from 'sentry/views/performance/utils/useModuleTitle';
 import type {ModuleName} from 'sentry/views/starfish/types';
 
@@ -24,10 +24,9 @@ interface Props {
 export function ModulePageProviders({moduleName, pageTitle, children, features}: Props) {
   const organization = useOrganization();
 
-  const insightsTitle = useInsightsTitle();
   const moduleTitle = useModuleTitle(moduleName);
 
-  const fullPageTitle = [pageTitle, moduleTitle, insightsTitle]
+  const fullPageTitle = [pageTitle, moduleTitle, INSIGHTS_TITLE]
     .filter(Boolean)
     .join(' — ');
 

Some files were not shown because too many files changed in this diff