content.tsx 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. import {Fragment, useCallback, useEffect, useMemo} from 'react';
  2. import styled from '@emotion/styled';
  3. import type {Location} from 'history';
  4. import {Alert} from 'sentry/components/alert';
  5. import {Button} from 'sentry/components/button';
  6. import SearchBar from 'sentry/components/events/searchBar';
  7. import FeedbackWidgetButton from 'sentry/components/feedback/widget/feedbackWidgetButton';
  8. import * as Layout from 'sentry/components/layouts/thirds';
  9. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  10. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  11. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  12. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  13. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  14. import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  15. import Pagination from 'sentry/components/pagination';
  16. import {
  17. ProfilingAM1OrMMXUpgrade,
  18. ProfilingBetaAlertBanner,
  19. ProfilingUpgradeButton,
  20. } from 'sentry/components/profiling/billing/alerts';
  21. import {ProfileEventsTable} from 'sentry/components/profiling/profileEventsTable';
  22. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  23. import {SidebarPanelKey} from 'sentry/components/sidebar/types';
  24. import type {SmartSearchBarProps} from 'sentry/components/smartSearchBar';
  25. import {TabList, Tabs} from 'sentry/components/tabs';
  26. import {MAX_QUERY_LENGTH} from 'sentry/constants';
  27. import {ALL_ACCESS_PROJECTS} from 'sentry/constants/pageFilters';
  28. import {t} from 'sentry/locale';
  29. import SidebarPanelStore from 'sentry/stores/sidebarPanelStore';
  30. import {space} from 'sentry/styles/space';
  31. import {trackAnalytics} from 'sentry/utils/analytics';
  32. import {browserHistory} from 'sentry/utils/browserHistory';
  33. import {useProfileEvents} from 'sentry/utils/profiling/hooks/useProfileEvents';
  34. import {formatError, formatSort} from 'sentry/utils/profiling/hooks/utils';
  35. import {decodeScalar} from 'sentry/utils/queryString';
  36. import {useLocation} from 'sentry/utils/useLocation';
  37. import useOrganization from 'sentry/utils/useOrganization';
  38. import usePageFilters from 'sentry/utils/usePageFilters';
  39. import useProjects from 'sentry/utils/useProjects';
  40. import {LandingAggregateFlamegraph} from 'sentry/views/profiling/landingAggregateFlamegraph';
  41. import {DEFAULT_PROFILING_DATETIME_SELECTION} from 'sentry/views/profiling/utils';
  42. import {LandingWidgetSelector} from './landing/landingWidgetSelector';
  43. import {ProfilesChart} from './landing/profileCharts';
  44. import {ProfilesChartWidget} from './landing/profilesChartWidget';
  45. import {ProfilingSlowestTransactionsPanel} from './landing/profilingSlowestTransactionsPanel';
  46. import {ProfilingOnboardingPanel} from './profilingOnboardingPanel';
  47. const LEFT_WIDGET_CURSOR = 'leftCursor';
  48. const RIGHT_WIDGET_CURSOR = 'rightCursor';
  49. const CURSOR_PARAMS = [LEFT_WIDGET_CURSOR, RIGHT_WIDGET_CURSOR];
  50. interface ProfilingContentProps {
  51. location: Location;
  52. }
  53. function ProfilingContentLegacy({location}: ProfilingContentProps) {
  54. const organization = useOrganization();
  55. const {selection} = usePageFilters();
  56. const cursor = decodeScalar(location.query.cursor);
  57. const query = decodeScalar(location.query.query, '');
  58. const fields = ALL_FIELDS;
  59. const sort = formatSort<FieldType>(decodeScalar(location.query.sort), fields, {
  60. key: 'count()',
  61. order: 'desc',
  62. });
  63. const {projects} = useProjects();
  64. const transactions = useProfileEvents<FieldType>({
  65. cursor,
  66. fields,
  67. query,
  68. sort,
  69. referrer: 'api.profiling.landing-table',
  70. });
  71. const transactionsError =
  72. transactions.status === 'error' ? formatError(transactions.error) : null;
  73. useEffect(() => {
  74. trackAnalytics('profiling_views.landing', {
  75. organization,
  76. });
  77. }, [organization]);
  78. const handleSearch: SmartSearchBarProps['onSearch'] = useCallback(
  79. (searchQuery: string) => {
  80. browserHistory.push({
  81. ...location,
  82. query: {
  83. ...location.query,
  84. cursor: undefined,
  85. query: searchQuery || undefined,
  86. },
  87. });
  88. },
  89. [location]
  90. );
  91. // Open the modal on demand
  92. const onSetupProfilingClick = useCallback(() => {
  93. trackAnalytics('profiling_views.onboarding', {
  94. organization,
  95. });
  96. SidebarPanelStore.activatePanel(SidebarPanelKey.PROFILING_ONBOARDING);
  97. }, [organization]);
  98. const shouldShowProfilingOnboardingPanel = useMemo((): boolean => {
  99. // if it's My Projects or All projects, only show onboarding if we can't
  100. // find any projects with profiles
  101. if (
  102. selection.projects.length === 0 ||
  103. selection.projects[0] === ALL_ACCESS_PROJECTS
  104. ) {
  105. return projects.every(project => !project.hasProfiles);
  106. }
  107. // otherwise, only show onboarding if we can't find any projects with profiles
  108. // from those that were selected
  109. const projectsWithProfiles = new Set(
  110. projects.filter(project => project.hasProfiles).map(project => project.id)
  111. );
  112. return selection.projects.every(
  113. project => !projectsWithProfiles.has(String(project))
  114. );
  115. }, [selection.projects, projects]);
  116. return (
  117. <SentryDocumentTitle title={t('Profiling')} orgSlug={organization.slug}>
  118. <PageFiltersContainer
  119. defaultSelection={{datetime: DEFAULT_PROFILING_DATETIME_SELECTION}}
  120. >
  121. <Layout.Page>
  122. <ProfilingBetaAlertBanner organization={organization} />
  123. <Layout.Header>
  124. <StyledHeaderContent>
  125. <Layout.Title>
  126. {t('Profiling')}
  127. <PageHeadingQuestionTooltip
  128. docsUrl="https://docs.sentry.io/product/profiling/"
  129. title={t(
  130. 'Profiling collects detailed information in production about the functions executing in your application and how long they take to run, giving you code-level visibility into your hot paths.'
  131. )}
  132. />
  133. </Layout.Title>
  134. <FeedbackWidgetButton />
  135. </StyledHeaderContent>
  136. </Layout.Header>
  137. <Layout.Body>
  138. <Layout.Main fullWidth>
  139. {transactionsError && (
  140. <Alert type="error" showIcon>
  141. {transactionsError}
  142. </Alert>
  143. )}
  144. <ActionBar>
  145. <PageFilterBar condensed>
  146. <ProjectPageFilter resetParamsOnChange={CURSOR_PARAMS} />
  147. <EnvironmentPageFilter resetParamsOnChange={CURSOR_PARAMS} />
  148. <DatePageFilter resetParamsOnChange={CURSOR_PARAMS} />
  149. </PageFilterBar>
  150. <SearchBar
  151. searchSource="profile_landing"
  152. organization={organization}
  153. projectIds={selection.projects}
  154. query={query}
  155. onSearch={handleSearch}
  156. maxQueryLength={MAX_QUERY_LENGTH}
  157. />
  158. </ActionBar>
  159. {shouldShowProfilingOnboardingPanel ? (
  160. <Fragment>
  161. <ProfilingOnboardingPanel
  162. content={
  163. // If user is on m2, show default
  164. <ProfilingAM1OrMMXUpgrade
  165. organization={organization}
  166. fallback={
  167. <Fragment>
  168. <h3>{t('Function level insights')}</h3>
  169. <p>
  170. {t(
  171. 'Discover slow-to-execute or resource intensive functions within your application'
  172. )}
  173. </p>
  174. </Fragment>
  175. }
  176. />
  177. }
  178. >
  179. <ProfilingUpgradeButton
  180. data-test-id="profiling-upgrade"
  181. organization={organization}
  182. priority="primary"
  183. onClick={onSetupProfilingClick}
  184. fallback={
  185. <Button onClick={onSetupProfilingClick} priority="primary">
  186. {t('Set Up Profiling')}
  187. </Button>
  188. }
  189. >
  190. {t('Set Up Profiling')}
  191. </ProfilingUpgradeButton>
  192. <Button href="https://docs.sentry.io/product/profiling/" external>
  193. {t('Read Docs')}
  194. </Button>
  195. </ProfilingOnboardingPanel>
  196. </Fragment>
  197. ) : (
  198. <Fragment>
  199. {organization.features.includes(
  200. 'profiling-global-suspect-functions'
  201. ) ? (
  202. <Fragment>
  203. <ProfilesChartWidget
  204. chartHeight={150}
  205. referrer="api.profiling.landing-chart"
  206. userQuery={query}
  207. selection={selection}
  208. />
  209. <WidgetsContainer>
  210. <LandingWidgetSelector
  211. cursorName={LEFT_WIDGET_CURSOR}
  212. widgetHeight="340px"
  213. defaultWidget="slowest functions"
  214. query={query}
  215. storageKey="profiling-landing-widget-0"
  216. />
  217. <LandingWidgetSelector
  218. cursorName={RIGHT_WIDGET_CURSOR}
  219. widgetHeight="340px"
  220. defaultWidget="regressed functions"
  221. query={query}
  222. storageKey="profiling-landing-widget-1"
  223. />
  224. </WidgetsContainer>
  225. </Fragment>
  226. ) : (
  227. <PanelsGrid>
  228. <ProfilingSlowestTransactionsPanel />
  229. <ProfilesChart
  230. referrer="api.profiling.landing-chart"
  231. query={query}
  232. selection={selection}
  233. hideCount
  234. />
  235. </PanelsGrid>
  236. )}
  237. <ProfileEventsTable
  238. columns={fields.slice()}
  239. data={transactions.status === 'success' ? transactions.data : null}
  240. error={
  241. transactions.status === 'error'
  242. ? t('Unable to load profiles')
  243. : null
  244. }
  245. isLoading={transactions.status === 'loading'}
  246. sort={sort}
  247. sortableColumns={new Set(fields)}
  248. />
  249. <Pagination
  250. pageLinks={
  251. transactions.status === 'success'
  252. ? transactions.getResponseHeader?.('Link') ?? null
  253. : null
  254. }
  255. />
  256. </Fragment>
  257. )}
  258. </Layout.Main>
  259. </Layout.Body>
  260. </Layout.Page>
  261. </PageFiltersContainer>
  262. </SentryDocumentTitle>
  263. );
  264. }
  265. function validateTab(tab: unknown): tab is 'flamegraph' | 'transactions' {
  266. return tab === 'flamegraph' || tab === 'transactions';
  267. }
  268. function decodeTab(tab: unknown): 'flamegraph' | 'transactions' {
  269. // Fallback to transactions if tab is invalid. We default to transactions
  270. // because that is going to be the most common perf setup when we release.
  271. return validateTab(tab) ? tab : 'transactions';
  272. }
  273. function ProfilingContent({location}: ProfilingContentProps) {
  274. const organization = useOrganization();
  275. const {selection} = usePageFilters();
  276. const {projects} = useProjects();
  277. const tab = decodeTab(location.query.tab);
  278. useEffect(() => {
  279. trackAnalytics('profiling_views.landing', {
  280. organization,
  281. });
  282. }, [organization]);
  283. const onTabChange = useCallback(
  284. (newTab: 'flamegraph' | 'transactions') => {
  285. browserHistory.push({
  286. ...location,
  287. query: {
  288. ...location.query,
  289. tab: newTab,
  290. },
  291. });
  292. },
  293. [location]
  294. );
  295. const shouldShowProfilingOnboardingPanel = useMemo((): boolean => {
  296. // if it's My Projects or All projects, only show onboarding if we can't
  297. // find any projects with profiles
  298. if (
  299. selection.projects.length === 0 ||
  300. selection.projects[0] === ALL_ACCESS_PROJECTS
  301. ) {
  302. return projects.every(project => !project.hasProfiles);
  303. }
  304. // otherwise, only show onboarding if we can't find any projects with profiles
  305. // from those that were selected
  306. const projectsWithProfiles = new Set(
  307. projects.filter(project => project.hasProfiles).map(project => project.id)
  308. );
  309. return selection.projects.every(
  310. project => !projectsWithProfiles.has(String(project))
  311. );
  312. }, [selection.projects, projects]);
  313. return (
  314. <SentryDocumentTitle title={t('Profiling')} orgSlug={organization.slug}>
  315. <PageFiltersContainer
  316. defaultSelection={{datetime: DEFAULT_PROFILING_DATETIME_SELECTION}}
  317. >
  318. <Layout.Page>
  319. <ProfilingBetaAlertBanner organization={organization} />
  320. <ProfilingContentPageHeader tab={tab} onTabChange={onTabChange} />
  321. <Layout.Body>
  322. {tab === 'flamegraph' ? (
  323. <ProfilingFlamegraphTabContent
  324. tab={tab}
  325. shouldShowProfilingOnboardingPanel={shouldShowProfilingOnboardingPanel}
  326. />
  327. ) : tab === 'transactions' ? (
  328. <ProfilingTransactionsContent
  329. tab={tab}
  330. shouldShowProfilingOnboardingPanel={shouldShowProfilingOnboardingPanel}
  331. />
  332. ) : null}
  333. </Layout.Body>
  334. </Layout.Page>
  335. </PageFiltersContainer>
  336. </SentryDocumentTitle>
  337. );
  338. }
  339. interface ProfilingTabContentProps {
  340. shouldShowProfilingOnboardingPanel: boolean;
  341. tab: 'flamegraph' | 'transactions';
  342. }
  343. function ProfilingFlamegraphTabContent(props: ProfilingTabContentProps) {
  344. return (
  345. <Layout.Main fullWidth>
  346. <ActionBar>
  347. <PageFilterBar condensed>
  348. <ProjectPageFilter resetParamsOnChange={CURSOR_PARAMS} />
  349. <EnvironmentPageFilter resetParamsOnChange={CURSOR_PARAMS} />
  350. <DatePageFilter resetParamsOnChange={CURSOR_PARAMS} />
  351. </PageFilterBar>
  352. </ActionBar>
  353. {props.shouldShowProfilingOnboardingPanel ? (
  354. <ProfilingOnboardingCTA />
  355. ) : (
  356. <LandingAggregateFlamegraphContainer>
  357. <LandingAggregateFlamegraph />
  358. </LandingAggregateFlamegraphContainer>
  359. )}
  360. </Layout.Main>
  361. );
  362. }
  363. function ProfilingTransactionsContent(props: ProfilingTabContentProps) {
  364. const organization = useOrganization();
  365. const location = useLocation();
  366. const {selection} = usePageFilters();
  367. const fields = ALL_FIELDS;
  368. const sort = formatSort<FieldType>(decodeScalar(location.query.sort), fields, {
  369. key: 'count()',
  370. order: 'desc',
  371. });
  372. const cursor = decodeScalar(location.query.cursor);
  373. const query = decodeScalar(location.query.query, '');
  374. const continuousProfilingCompat = organization.features.includes(
  375. 'continuous-profiling-compat'
  376. );
  377. const transactions = useProfileEvents<FieldType>({
  378. cursor,
  379. fields,
  380. query,
  381. sort,
  382. referrer: 'api.profiling.landing-table',
  383. continuousProfilingCompat,
  384. });
  385. const transactionsError =
  386. transactions.status === 'error' ? formatError(transactions.error) : null;
  387. const handleSearch: SmartSearchBarProps['onSearch'] = useCallback(
  388. (searchQuery: string) => {
  389. browserHistory.push({
  390. ...location,
  391. query: {
  392. ...location.query,
  393. cursor: undefined,
  394. query: searchQuery || undefined,
  395. },
  396. });
  397. },
  398. [location]
  399. );
  400. return (
  401. <Layout.Main fullWidth>
  402. {transactionsError && (
  403. <Alert type="error" showIcon>
  404. {transactionsError}
  405. </Alert>
  406. )}
  407. <ActionBar>
  408. <PageFilterBar condensed>
  409. <ProjectPageFilter resetParamsOnChange={CURSOR_PARAMS} />
  410. <EnvironmentPageFilter resetParamsOnChange={CURSOR_PARAMS} />
  411. <DatePageFilter resetParamsOnChange={CURSOR_PARAMS} />
  412. </PageFilterBar>
  413. <SearchBar
  414. searchSource="profile_landing"
  415. organization={organization}
  416. projectIds={selection.projects}
  417. query={query}
  418. onSearch={handleSearch}
  419. maxQueryLength={MAX_QUERY_LENGTH}
  420. />
  421. </ActionBar>
  422. {props.shouldShowProfilingOnboardingPanel ? (
  423. <ProfilingOnboardingCTA />
  424. ) : (
  425. <Fragment>
  426. {organization.features.includes('profiling-global-suspect-functions') ? (
  427. <Fragment>
  428. <ProfilesChartWidget
  429. chartHeight={150}
  430. referrer="api.profiling.landing-chart"
  431. userQuery={query}
  432. selection={selection}
  433. continuousProfilingCompat={continuousProfilingCompat}
  434. />
  435. <WidgetsContainer>
  436. <LandingWidgetSelector
  437. cursorName={LEFT_WIDGET_CURSOR}
  438. widgetHeight="340px"
  439. defaultWidget="slowest functions"
  440. query={query}
  441. storageKey="profiling-landing-widget-0"
  442. />
  443. <LandingWidgetSelector
  444. cursorName={RIGHT_WIDGET_CURSOR}
  445. widgetHeight="340px"
  446. defaultWidget="regressed functions"
  447. query={query}
  448. storageKey="profiling-landing-widget-1"
  449. />
  450. </WidgetsContainer>
  451. </Fragment>
  452. ) : (
  453. <PanelsGrid>
  454. <ProfilingSlowestTransactionsPanel />
  455. <ProfilesChart
  456. referrer="api.profiling.landing-chart"
  457. query={query}
  458. selection={selection}
  459. hideCount
  460. />
  461. </PanelsGrid>
  462. )}
  463. <Fragment>
  464. <ProfileEventsTable
  465. columns={fields.slice()}
  466. data={transactions.status === 'success' ? transactions.data : null}
  467. error={
  468. transactions.status === 'error' ? t('Unable to load profiles') : null
  469. }
  470. isLoading={transactions.status === 'loading'}
  471. sort={sort}
  472. sortableColumns={new Set(fields)}
  473. />
  474. <Pagination
  475. pageLinks={
  476. transactions.status === 'success'
  477. ? transactions.getResponseHeader?.('Link') ?? null
  478. : null
  479. }
  480. />
  481. </Fragment>
  482. </Fragment>
  483. )}
  484. </Layout.Main>
  485. );
  486. }
  487. function ProfilingOnboardingCTA() {
  488. const organization = useOrganization();
  489. // Open the modal on demand
  490. const onSetupProfilingClick = useCallback(() => {
  491. trackAnalytics('profiling_views.onboarding', {
  492. organization,
  493. });
  494. SidebarPanelStore.activatePanel(SidebarPanelKey.PROFILING_ONBOARDING);
  495. }, [organization]);
  496. return (
  497. <Fragment>
  498. <ProfilingOnboardingPanel
  499. content={
  500. // If user is on m2, show default
  501. <ProfilingAM1OrMMXUpgrade
  502. organization={organization}
  503. fallback={
  504. <Fragment>
  505. <h3>{t('Function level insights')}</h3>
  506. <p>
  507. {t(
  508. 'Discover slow-to-execute or resource intensive functions within your application'
  509. )}
  510. </p>
  511. </Fragment>
  512. }
  513. />
  514. }
  515. >
  516. <ProfilingUpgradeButton
  517. data-test-id="profiling-upgrade"
  518. organization={organization}
  519. priority="primary"
  520. onClick={onSetupProfilingClick}
  521. fallback={
  522. <Button onClick={onSetupProfilingClick} priority="primary">
  523. {t('Set Up Profiling')}
  524. </Button>
  525. }
  526. >
  527. {t('Set Up Profiling')}
  528. </ProfilingUpgradeButton>
  529. <Button href="https://docs.sentry.io/product/profiling/" external>
  530. {t('Read Docs')}
  531. </Button>
  532. </ProfilingOnboardingPanel>
  533. </Fragment>
  534. );
  535. }
  536. interface ProfilingContentPageHeaderProps {
  537. onTabChange: (newTab: 'flamegraph' | 'transactions') => void;
  538. tab: 'flamegraph' | 'transactions';
  539. }
  540. function ProfilingContentPageHeader(props: ProfilingContentPageHeaderProps) {
  541. return (
  542. <StyledLayoutHeader>
  543. <StyledHeaderContent>
  544. <Layout.Title>
  545. {t('Profiling')}
  546. <PageHeadingQuestionTooltip
  547. docsUrl="https://docs.sentry.io/product/profiling/"
  548. title={t(
  549. 'Profiling collects detailed information in production about the functions executing in your application and how long they take to run, giving you code-level visibility into your hot paths.'
  550. )}
  551. />
  552. </Layout.Title>
  553. <FeedbackWidgetButton />
  554. </StyledHeaderContent>
  555. <div>
  556. <Tabs value={props.tab} onChange={props.onTabChange}>
  557. <TabList hideBorder>
  558. <TabList.Item key="transactions">{t('Transactions')}</TabList.Item>
  559. <TabList.Item key="flamegraph">{t('Flamegraph')}</TabList.Item>
  560. </TabList>
  561. </Tabs>
  562. </div>
  563. </StyledLayoutHeader>
  564. );
  565. }
  566. const ALL_FIELDS = [
  567. 'transaction',
  568. 'project.id',
  569. 'last_seen()',
  570. 'p50()',
  571. 'p75()',
  572. 'p95()',
  573. 'p99()',
  574. 'count()',
  575. ] as const;
  576. type FieldType = (typeof ALL_FIELDS)[number];
  577. const LandingAggregateFlamegraphContainer = styled('div')`
  578. height: 40vh;
  579. min-height: 300px;
  580. position: relative;
  581. border: 1px solid ${p => p.theme.border};
  582. border-radius: ${p => p.theme.borderRadius};
  583. margin-bottom: ${space(2)};
  584. `;
  585. const StyledLayoutHeader = styled(Layout.Header)`
  586. display: block;
  587. `;
  588. const StyledHeaderContent = styled(Layout.HeaderContent)`
  589. display: flex;
  590. align-items: center;
  591. justify-content: space-between;
  592. flex-direction: row;
  593. `;
  594. const ActionBar = styled('div')`
  595. display: grid;
  596. gap: ${space(2)};
  597. grid-template-columns: min-content auto;
  598. margin-bottom: ${space(2)};
  599. `;
  600. // TODO: another simple primitive that can easily be <Grid columns={2} />
  601. const PanelsGrid = styled('div')`
  602. display: grid;
  603. grid-template-columns: minmax(0, 1fr) 1fr;
  604. gap: ${space(2)};
  605. @media (max-width: ${p => p.theme.breakpoints.small}) {
  606. grid-template-columns: minmax(0, 1fr);
  607. }
  608. `;
  609. const WidgetsContainer = styled('div')`
  610. display: grid;
  611. grid-template-columns: 1fr 1fr;
  612. gap: ${space(2)};
  613. @media (max-width: ${p => p.theme.breakpoints.small}) {
  614. grid-template-columns: 1fr;
  615. }
  616. `;
  617. function ProfilingContentWrapper(props: ProfilingContentProps) {
  618. const organization = useOrganization();
  619. if (organization.features.includes('continuous-profiling-compat')) {
  620. return <ProfilingContent {...props} />;
  621. }
  622. return <ProfilingContentLegacy {...props} />;
  623. }
  624. export default ProfilingContentWrapper;