Browse Source

feat(starfish): remove timerange filter limit from starfish (#52640)

Allows up to 90d queries in starfish
edwardgou-sentry 1 year ago
parent
commit
44d0936d22

+ 0 - 11
static/app/views/starfish/components/datePicker.tsx

@@ -1,22 +1,11 @@
 import DatePageFilter from 'sentry/components/datePageFilter';
-import {t} from 'sentry/locale';
 import {trackAnalytics} from 'sentry/utils/analytics';
 import useOrganization from 'sentry/utils/useOrganization';
-import {MAXIMUM_DATE_RANGE} from 'sentry/views/starfish/components/pageFilterContainer';
 
 function StarfishDatePicker() {
   const organization = useOrganization();
   return (
     <DatePageFilter
-      maxDateRange={MAXIMUM_DATE_RANGE}
-      disallowArbitraryRelativeRanges
-      relativeOptions={{
-        '1h': t('Last hour'),
-        '12h': t('Last 12 hours'),
-        '24h': t('Last 24 hours'),
-        '3d': t('Last 3 days'),
-        '7d': t('Last 7 days'),
-      }}
       defaultPeriod="24h"
       alignDropdown="left"
       onChange={({start, end, relative}) => {

+ 0 - 48
static/app/views/starfish/components/pageFilterContainer.tsx

@@ -1,48 +0,0 @@
-import {LocationDescriptorObject} from 'history';
-
-import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
-import {PageFilters} from 'sentry/types';
-import {useLocation} from 'sentry/utils/useLocation';
-import usePageFilters from 'sentry/utils/usePageFilters';
-import useRouter from 'sentry/utils/useRouter';
-import {getDateFilters} from 'sentry/views/starfish/utils/getDateFilters';
-
-export const MAXIMUM_DATE_RANGE = 7;
-export const DEFAULT_STATS_PERIOD = '24h';
-
-function StarfishPageFilterContainer(props: {children: React.ReactNode}) {
-  const router = useRouter();
-  const location = useLocation();
-  const {selection} = usePageFilters();
-  const datetime = selection.datetime;
-  const {end, start, statsPeriod} = location.query;
-
-  const {endTime, startTime} = getDateFilters({
-    datetime: {end, start, period: statsPeriod},
-  } as PageFilters);
-  const invalidDateFilters = endTime.diff(startTime, 'days') > MAXIMUM_DATE_RANGE;
-  if (invalidDateFilters) {
-    datetime.period = DEFAULT_STATS_PERIOD;
-    datetime.start = null;
-    datetime.end = null;
-    const query: LocationDescriptorObject['query'] = {
-      ...location.query,
-      statsPeriod: DEFAULT_STATS_PERIOD,
-    };
-    delete query.start;
-    delete query.end;
-
-    router.replace({
-      pathname: location.pathname,
-      query,
-    });
-  }
-
-  if (invalidDateFilters) {
-    return null;
-  }
-
-  return <PageFiltersContainer>{props.children}</PageFiltersContainer>;
-}
-
-export default StarfishPageFilterContainer;

+ 3 - 3
static/app/views/starfish/modules/DBModule.tsx

@@ -1,10 +1,10 @@
 import * as Layout from 'sentry/components/layouts/thirds';
+import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
 import {t} from 'sentry/locale';
 import {
   PageErrorAlert,
   PageErrorProvider,
 } from 'sentry/utils/performance/contexts/pageError';
-import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 import {ModuleName} from 'sentry/views/starfish/types';
 import SpansView from 'sentry/views/starfish/views/spans/spansView';
 
@@ -21,9 +21,9 @@ export default function DBModule() {
         <Layout.Body>
           <Layout.Main fullWidth>
             <PageErrorAlert />
-            <StarfishPageFilterContainer>
+            <PageFiltersContainer>
               <SpansView moduleName={ModuleName.DB} />
-            </StarfishPageFilterContainer>
+            </PageFiltersContainer>
           </Layout.Main>
         </Layout.Body>
       </PageErrorProvider>

+ 3 - 3
static/app/views/starfish/modules/HTTPModule.tsx

@@ -1,10 +1,10 @@
 import * as Layout from 'sentry/components/layouts/thirds';
+import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
 import {t} from 'sentry/locale';
 import {
   PageErrorAlert,
   PageErrorProvider,
 } from 'sentry/utils/performance/contexts/pageError';
-import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 import {ModuleName} from 'sentry/views/starfish/types';
 import SpansView from 'sentry/views/starfish/views/spans/spansView';
 
@@ -21,9 +21,9 @@ export default function HTTPModule() {
         <Layout.Body>
           <Layout.Main fullWidth>
             <PageErrorAlert />
-            <StarfishPageFilterContainer>
+            <PageFiltersContainer>
               <SpansView moduleName={ModuleName.HTTP} />
-            </StarfishPageFilterContainer>
+            </PageFiltersContainer>
           </Layout.Main>
         </Layout.Body>
       </PageErrorProvider>

+ 3 - 3
static/app/views/starfish/views/definitionsView/index.tsx

@@ -1,14 +1,14 @@
 import * as Layout from 'sentry/components/layouts/thirds';
+import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
 import {
   PageErrorAlert,
   PageErrorProvider,
 } from 'sentry/utils/performance/contexts/pageError';
-import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 
 function DefinitionsView() {
   return (
     <Layout.Page>
-      <StarfishPageFilterContainer>
+      <PageFiltersContainer>
         <PageErrorProvider>
           <Layout.Header>
             <Layout.HeaderContent>
@@ -27,7 +27,7 @@ function DefinitionsView() {
             </Layout.Main>
           </Layout.Body>
         </PageErrorProvider>
-      </StarfishPageFilterContainer>
+      </PageFiltersContainer>
     </Layout.Page>
   );
 }

+ 3 - 3
static/app/views/starfish/views/spanSummaryPage/index.tsx

@@ -5,6 +5,7 @@ import * as qs from 'query-string';
 
 import Breadcrumbs, {Crumb} from 'sentry/components/breadcrumbs';
 import * as Layout from 'sentry/components/layouts/thirds';
+import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
 import {Panel, PanelBody} from 'sentry/components/panels';
 import QuestionTooltip from 'sentry/components/questionTooltip';
 import {t} from 'sentry/locale';
@@ -21,7 +22,6 @@ import {ERRORS_COLOR, P95_COLOR, THROUGHPUT_COLOR} from 'sentry/views/starfish/c
 import Chart, {useSynchronizeCharts} from 'sentry/views/starfish/components/chart';
 import ChartPanel from 'sentry/views/starfish/components/chartPanel';
 import StarfishDatePicker from 'sentry/views/starfish/components/datePicker';
-import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 import {SpanDescription} from 'sentry/views/starfish/components/spanDescription';
 import {CountCell} from 'sentry/views/starfish/components/tableCells/countCell';
 import DurationCell from 'sentry/views/starfish/components/tableCells/durationCell';
@@ -132,7 +132,7 @@ function SpanSummaryPage({params, location}: Props) {
 
   return (
     <Layout.Page>
-      <StarfishPageFilterContainer>
+      <PageFiltersContainer>
         <PageErrorProvider>
           <Layout.Header>
             <Layout.HeaderContent>
@@ -280,7 +280,7 @@ function SpanSummaryPage({params, location}: Props) {
             </Layout.Main>
           </Layout.Body>
         </PageErrorProvider>
-      </StarfishPageFilterContainer>
+      </PageFiltersContainer>
     </Layout.Page>
   );
 }

+ 3 - 3
static/app/views/starfish/views/spans/index.tsx

@@ -1,11 +1,11 @@
 import * as Layout from 'sentry/components/layouts/thirds';
+import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
 import {t} from 'sentry/locale';
 import {
   PageErrorAlert,
   PageErrorProvider,
 } from 'sentry/utils/performance/contexts/pageError';
 import {useLocation} from 'sentry/utils/useLocation';
-import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 import {ModuleName} from 'sentry/views/starfish/types';
 
 import SpansView from './spansView';
@@ -38,9 +38,9 @@ export default function Spans() {
         <Layout.Body>
           <Layout.Main fullWidth>
             <PageErrorAlert />
-            <StarfishPageFilterContainer>
+            <PageFiltersContainer>
               <SpansView moduleName={moduleName} spanCategory={spanCategory} />
-            </StarfishPageFilterContainer>
+            </PageFiltersContainer>
           </Layout.Main>
         </Layout.Body>
       </PageErrorProvider>

+ 3 - 3
static/app/views/starfish/views/webServiceView/endpointOverview/index.tsx

@@ -9,6 +9,7 @@ import _EventsRequest from 'sentry/components/charts/eventsRequest';
 import {getInterval} from 'sentry/components/charts/utils';
 import * as Layout from 'sentry/components/layouts/thirds';
 import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
+import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
 import {PerformanceLayoutBodyRow} from 'sentry/components/performance/layouts';
 import Placeholder from 'sentry/components/placeholder';
 import {SegmentedControl} from 'sentry/components/segmentedControl';
@@ -31,7 +32,6 @@ import {SidebarSpacer} from 'sentry/views/performance/transactionSummary/utils';
 import {ERRORS_COLOR, P95_COLOR, THROUGHPUT_COLOR} from 'sentry/views/starfish/colours';
 import Chart, {useSynchronizeCharts} from 'sentry/views/starfish/components/chart';
 import StarfishDatePicker from 'sentry/views/starfish/components/datePicker';
-import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 import {TransactionSamplesTable} from 'sentry/views/starfish/components/samplesTable/transactionSamplesTable';
 import {ModuleName} from 'sentry/views/starfish/types';
 import formatThroughput from 'sentry/views/starfish/utils/chartValueFormatters/formatThroughput';
@@ -264,7 +264,7 @@ export default function EndpointOverview() {
   useSynchronizeCharts();
 
   return (
-    <StarfishPageFilterContainer>
+    <PageFiltersContainer>
       <Layout.Page>
         <Layout.Header>
           <Layout.HeaderContent>
@@ -364,7 +364,7 @@ export default function EndpointOverview() {
           </Layout.Side>
         </Layout.Body>
       </Layout.Page>
-    </StarfishPageFilterContainer>
+    </PageFiltersContainer>
   );
 }
 

+ 3 - 3
static/app/views/starfish/views/webServiceView/index.tsx

@@ -4,6 +4,7 @@ import {Location} from 'history';
 import isEqual from 'lodash/isEqual';
 
 import {loadOrganizationTags} from 'sentry/actionCreators/tags';
+import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
 import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
 import {t} from 'sentry/locale';
 import {PageFilters} from 'sentry/types';
@@ -12,7 +13,6 @@ import useApi from 'sentry/utils/useApi';
 import useOrganization from 'sentry/utils/useOrganization';
 import usePrevious from 'sentry/utils/usePrevious';
 import withPageFilters from 'sentry/utils/withPageFilters';
-import StarfishPageFilterContainer from 'sentry/views/starfish/components/pageFilterContainer';
 
 import {generateWebServiceEventView} from '../../utils/generatePerformanceEventView';
 
@@ -51,7 +51,7 @@ function WebServiceView({selection, location, router}: Props) {
 
   return (
     <SentryDocumentTitle title={t('Web Service')} orgSlug={organization.slug}>
-      <StarfishPageFilterContainer>
+      <PageFiltersContainer>
         <StarfishLanding
           router={router}
           eventView={eventView}
@@ -60,7 +60,7 @@ function WebServiceView({selection, location, router}: Props) {
           selection={selection}
           withStaticFilters={withStaticFilters}
         />
-      </StarfishPageFilterContainer>
+      </PageFiltersContainer>
     </SentryDocumentTitle>
   );
 }