content.tsx 24 KB

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