httpSamplesPanel.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. import {Fragment, useCallback} from 'react';
  2. import styled from '@emotion/styled';
  3. import * as qs from 'query-string';
  4. import Feature from 'sentry/components/acl/feature';
  5. import ProjectAvatar from 'sentry/components/avatar/projectAvatar';
  6. import {Button} from 'sentry/components/button';
  7. import {CompactSelect} from 'sentry/components/compactSelect';
  8. import SearchBar from 'sentry/components/events/searchBar';
  9. import Link from 'sentry/components/links/link';
  10. import {SegmentedControl} from 'sentry/components/segmentedControl';
  11. import {t} from 'sentry/locale';
  12. import {space} from 'sentry/styles/space';
  13. import {trackAnalytics} from 'sentry/utils/analytics';
  14. import {DurationUnit, RateUnit} from 'sentry/utils/discover/fields';
  15. import {DiscoverDatasets} from 'sentry/utils/discover/types';
  16. import {PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
  17. import {decodeScalar} from 'sentry/utils/queryString';
  18. import {
  19. EMPTY_OPTION_VALUE,
  20. escapeFilterValue,
  21. MutableSearch,
  22. } from 'sentry/utils/tokenizeSearch';
  23. import useLocationQuery from 'sentry/utils/url/useLocationQuery';
  24. import {useLocation} from 'sentry/utils/useLocation';
  25. import useOrganization from 'sentry/utils/useOrganization';
  26. import usePageFilters from 'sentry/utils/usePageFilters';
  27. import useProjects from 'sentry/utils/useProjects';
  28. import useRouter from 'sentry/utils/useRouter';
  29. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  30. import {computeAxisMax} from 'sentry/views/insights/common/components/chart';
  31. import DetailPanel from 'sentry/views/insights/common/components/detailPanel';
  32. import {MetricReadout} from 'sentry/views/insights/common/components/metricReadout';
  33. import * as ModuleLayout from 'sentry/views/insights/common/components/moduleLayout';
  34. import {getTimeSpentExplanation} from 'sentry/views/insights/common/components/tableCells/timeSpentCell';
  35. import {
  36. useSpanMetrics,
  37. useSpansIndexed,
  38. } from 'sentry/views/insights/common/queries/useDiscover';
  39. import {useSpanMetricsSeries} from 'sentry/views/insights/common/queries/useDiscoverSeries';
  40. import {useSpanMetricsTopNSeries} from 'sentry/views/insights/common/queries/useSpanMetricsTopNSeries';
  41. import {AverageValueMarkLine} from 'sentry/views/insights/common/utils/averageValueMarkLine';
  42. import {findSampleFromDataPoint} from 'sentry/views/insights/common/utils/findDataPoint';
  43. import {
  44. DataTitles,
  45. getThroughputTitle,
  46. } from 'sentry/views/insights/common/views/spans/types';
  47. import {useSampleScatterPlotSeries} from 'sentry/views/insights/common/views/spanSummaryPage/sampleList/durationChart/useSampleScatterPlotSeries';
  48. import {DurationChart} from 'sentry/views/insights/http/components/charts/durationChart';
  49. import {ResponseCodeCountChart} from 'sentry/views/insights/http/components/charts/responseCodeCountChart';
  50. import {SpanSamplesTable} from 'sentry/views/insights/http/components/tables/spanSamplesTable';
  51. import {HTTP_RESPONSE_STATUS_CODES} from 'sentry/views/insights/http/data/definitions';
  52. import {useSpanSamples} from 'sentry/views/insights/http/queries/useSpanSamples';
  53. import {Referrer} from 'sentry/views/insights/http/referrers';
  54. import {BASE_FILTERS} from 'sentry/views/insights/http/settings';
  55. import decodePanel from 'sentry/views/insights/http/utils/queryParameterDecoders/panel';
  56. import decodeResponseCodeClass from 'sentry/views/insights/http/utils/queryParameterDecoders/responseCodeClass';
  57. import {useDebouncedState} from 'sentry/views/insights/http/utils/useDebouncedState';
  58. import {
  59. ModuleName,
  60. SpanFunction,
  61. SpanIndexedField,
  62. SpanMetricsField,
  63. type SpanMetricsQueryFilters,
  64. } from 'sentry/views/insights/types';
  65. import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceMetadataHeader';
  66. import {useSpanFieldSupportedTags} from 'sentry/views/performance/utils/useSpanFieldSupportedTags';
  67. export function HTTPSamplesPanel() {
  68. const router = useRouter();
  69. const location = useLocation();
  70. const query = useLocationQuery({
  71. fields: {
  72. project: decodeScalar,
  73. domain: decodeScalar,
  74. transaction: decodeScalar,
  75. transactionMethod: decodeScalar,
  76. panel: decodePanel,
  77. responseCodeClass: decodeResponseCodeClass,
  78. spanSearchQuery: decodeScalar,
  79. },
  80. });
  81. const organization = useOrganization();
  82. const {projects} = useProjects();
  83. const {selection} = usePageFilters();
  84. const supportedTags = useSpanFieldSupportedTags();
  85. const project = projects.find(p => query.project === p.id);
  86. const [highlightedSpanId, setHighlightedSpanId] = useDebouncedState<string | undefined>(
  87. undefined,
  88. [],
  89. SAMPLE_HOVER_DEBOUNCE
  90. );
  91. // `detailKey` controls whether the panel is open. If all required properties are available, concat them to make a key, otherwise set to `undefined` and hide the panel
  92. const detailKey = query.transaction
  93. ? [query.domain, query.transactionMethod, query.transaction].filter(Boolean).join(':')
  94. : undefined;
  95. const handlePanelChange = newPanelName => {
  96. trackAnalytics('performance_views.sample_spans.filter_updated', {
  97. filter: 'panel',
  98. new_state: newPanelName,
  99. organization,
  100. source: ModuleName.HTTP,
  101. });
  102. router.replace({
  103. pathname: location.pathname,
  104. query: {
  105. ...location.query,
  106. panel: newPanelName,
  107. },
  108. });
  109. };
  110. const handleResponseCodeClassChange = newResponseCodeClass => {
  111. trackAnalytics('performance_views.sample_spans.filter_updated', {
  112. filter: 'status_code',
  113. new_state: newResponseCodeClass.value,
  114. organization,
  115. source: ModuleName.HTTP,
  116. });
  117. router.replace({
  118. pathname: location.pathname,
  119. query: {
  120. ...location.query,
  121. responseCodeClass: newResponseCodeClass.value,
  122. },
  123. });
  124. };
  125. const isPanelOpen = Boolean(detailKey);
  126. // The ribbon is above the data selectors, and not affected by them. So, it has its own filters.
  127. const ribbonFilters: SpanMetricsQueryFilters = {
  128. ...BASE_FILTERS,
  129. 'span.domain':
  130. query.domain === '' ? EMPTY_OPTION_VALUE : escapeFilterValue(query.domain),
  131. transaction: query.transaction,
  132. };
  133. // These filters are for the charts and samples tables
  134. const filters: SpanMetricsQueryFilters = {
  135. ...BASE_FILTERS,
  136. 'span.domain':
  137. query.domain === '' ? EMPTY_OPTION_VALUE : escapeFilterValue(query.domain),
  138. transaction: query.transaction,
  139. };
  140. const responseCodeInRange = query.responseCodeClass
  141. ? Object.keys(HTTP_RESPONSE_STATUS_CODES).filter(code =>
  142. code.startsWith(query.responseCodeClass)
  143. )
  144. : [];
  145. if (responseCodeInRange.length > 0) {
  146. // TODO: Allow automatic array parameter concatenation
  147. filters['span.status_code'] = `[${responseCodeInRange.join(',')}]`;
  148. }
  149. const search = MutableSearch.fromQueryObject(filters);
  150. const {
  151. data: domainTransactionMetrics,
  152. isFetching: areDomainTransactionMetricsFetching,
  153. } = useSpanMetrics(
  154. {
  155. search: MutableSearch.fromQueryObject(ribbonFilters),
  156. fields: [
  157. `${SpanFunction.SPM}()`,
  158. `avg(${SpanMetricsField.SPAN_SELF_TIME})`,
  159. `sum(${SpanMetricsField.SPAN_SELF_TIME})`,
  160. 'http_response_rate(3)',
  161. 'http_response_rate(4)',
  162. 'http_response_rate(5)',
  163. `${SpanFunction.TIME_SPENT_PERCENTAGE}()`,
  164. ],
  165. enabled: isPanelOpen,
  166. },
  167. Referrer.SAMPLES_PANEL_METRICS_RIBBON
  168. );
  169. const {
  170. isFetching: isDurationDataFetching,
  171. data: durationData,
  172. error: durationError,
  173. } = useSpanMetricsSeries(
  174. {
  175. search,
  176. yAxis: [`avg(span.self_time)`],
  177. enabled: isPanelOpen && query.panel === 'duration',
  178. },
  179. Referrer.SAMPLES_PANEL_DURATION_CHART
  180. );
  181. const {
  182. isFetching: isResponseCodeDataLoading,
  183. data: responseCodeData,
  184. error: responseCodeError,
  185. } = useSpanMetricsTopNSeries({
  186. search,
  187. fields: ['span.status_code', 'count()'],
  188. yAxis: ['count()'],
  189. topEvents: 5,
  190. enabled: isPanelOpen && query.panel === 'status',
  191. referrer: Referrer.SAMPLES_PANEL_RESPONSE_CODE_CHART,
  192. });
  193. // NOTE: Due to some data confusion, the `domain` column in the spans table can either be `null` or `""`. Searches like `"!has:span.domain"` are turned into the ClickHouse clause `isNull(domain)`, and do not match the empty string. We need a query that matches empty strings _and_ null_ which is `(!has:domain OR domain:[""])`. This hack can be removed in August 2024, once https://github.com/getsentry/snuba/pull/5780 has been deployed for 90 days and all `""` domains have fallen out of the data retention window. Also, `null` domains will become more rare as people upgrade the JS SDK to versions that populate the `server.address` span attribute
  194. const sampleSpansSearch = MutableSearch.fromQueryObject({
  195. ...filters,
  196. 'span.domain': undefined,
  197. });
  198. // filter by key-value filters specified in the search bar query
  199. sampleSpansSearch.addStringMultiFilter(query.spanSearchQuery);
  200. if (query.domain === '') {
  201. sampleSpansSearch.addOp('(');
  202. sampleSpansSearch.addFilterValue('!has', 'span.domain');
  203. sampleSpansSearch.addOp('OR');
  204. // HACK: Use `addOp` to add the condition `'span.domain:[""]'` and avoid escaping the double quotes. Ideally there'd be a way to specify this explicitly, but this whole thing is a hack anyway. Once a plain `!has:span.domain` condition works, this is not necessary
  205. sampleSpansSearch.addOp('span.domain:[""]');
  206. sampleSpansSearch.addOp(')');
  207. } else {
  208. sampleSpansSearch.addFilterValue('span.domain', query.domain);
  209. }
  210. const durationAxisMax = computeAxisMax([durationData?.[`avg(span.self_time)`]]);
  211. const {
  212. data: durationSamplesData,
  213. isFetching: isDurationSamplesDataFetching,
  214. error: durationSamplesDataError,
  215. refetch: refetchDurationSpanSamples,
  216. } = useSpanSamples({
  217. search: sampleSpansSearch,
  218. fields: [
  219. SpanIndexedField.TRACE,
  220. SpanIndexedField.TRANSACTION_ID,
  221. SpanIndexedField.SPAN_DESCRIPTION,
  222. SpanIndexedField.RESPONSE_CODE,
  223. ],
  224. min: 0,
  225. max: durationAxisMax,
  226. enabled: isPanelOpen && query.panel === 'duration' && durationAxisMax > 0,
  227. referrer: Referrer.SAMPLES_PANEL_DURATION_SAMPLES,
  228. });
  229. const {
  230. data: responseCodeSamplesData,
  231. isFetching: isResponseCodeSamplesDataFetching,
  232. error: responseCodeSamplesDataError,
  233. refetch: refetchResponseCodeSpanSamples,
  234. } = useSpansIndexed(
  235. {
  236. search: sampleSpansSearch,
  237. fields: [
  238. SpanIndexedField.PROJECT,
  239. SpanIndexedField.TRACE,
  240. SpanIndexedField.TRANSACTION_ID,
  241. SpanIndexedField.ID,
  242. SpanIndexedField.TIMESTAMP,
  243. SpanIndexedField.SPAN_DESCRIPTION,
  244. SpanIndexedField.RESPONSE_CODE,
  245. ],
  246. sorts: [SPAN_SAMPLES_SORT],
  247. limit: SPAN_SAMPLE_LIMIT,
  248. enabled: isPanelOpen && query.panel === 'status',
  249. },
  250. Referrer.SAMPLES_PANEL_RESPONSE_CODE_SAMPLES
  251. );
  252. const sampledSpanDataSeries = useSampleScatterPlotSeries(
  253. durationSamplesData,
  254. domainTransactionMetrics?.[0]?.['avg(span.self_time)'],
  255. highlightedSpanId
  256. );
  257. const handleSearch = (newSpanSearchQuery: string) => {
  258. router.replace({
  259. pathname: location.pathname,
  260. query: {
  261. ...query,
  262. spanSearchQuery: newSpanSearchQuery,
  263. },
  264. });
  265. };
  266. const handleClose = () => {
  267. router.replace({
  268. pathname: router.location.pathname,
  269. query: {
  270. ...router.location.query,
  271. transaction: undefined,
  272. transactionMethod: undefined,
  273. },
  274. });
  275. };
  276. const handleOpen = useCallback(() => {
  277. if (query.transaction) {
  278. trackAnalytics('performance_views.sample_spans.opened', {
  279. organization,
  280. source: ModuleName.HTTP,
  281. });
  282. }
  283. }, [organization, query.transaction]);
  284. return (
  285. <PageAlertProvider>
  286. <DetailPanel detailKey={detailKey} onClose={handleClose} onOpen={handleOpen}>
  287. <ModuleLayout.Layout>
  288. <ModuleLayout.Full>
  289. <HeaderContainer>
  290. {project && (
  291. <SpanSummaryProjectAvatar
  292. project={project}
  293. direction="left"
  294. size={40}
  295. hasTooltip
  296. tooltip={project.slug}
  297. />
  298. )}
  299. <Title>
  300. <Link
  301. to={normalizeUrl(
  302. `/organizations/${organization.slug}/performance/summary?${qs.stringify(
  303. {
  304. project: query.project,
  305. transaction: query.transaction,
  306. }
  307. )}`
  308. )}
  309. >
  310. {query.transaction &&
  311. query.transactionMethod &&
  312. !query.transaction.startsWith(query.transactionMethod)
  313. ? `${query.transactionMethod} ${query.transaction}`
  314. : query.transaction}
  315. </Link>
  316. </Title>
  317. </HeaderContainer>
  318. </ModuleLayout.Full>
  319. <ModuleLayout.Full>
  320. <MetricsRibbon>
  321. <MetricReadout
  322. align="left"
  323. title={getThroughputTitle('http')}
  324. value={domainTransactionMetrics?.[0]?.[`${SpanFunction.SPM}()`]}
  325. unit={RateUnit.PER_MINUTE}
  326. isLoading={areDomainTransactionMetricsFetching}
  327. />
  328. <MetricReadout
  329. align="left"
  330. title={DataTitles.avg}
  331. value={
  332. domainTransactionMetrics?.[0]?.[
  333. `avg(${SpanMetricsField.SPAN_SELF_TIME})`
  334. ]
  335. }
  336. unit={DurationUnit.MILLISECOND}
  337. isLoading={areDomainTransactionMetricsFetching}
  338. />
  339. <MetricReadout
  340. align="left"
  341. title={t('3XXs')}
  342. value={domainTransactionMetrics?.[0]?.[`http_response_rate(3)`]}
  343. unit="percentage"
  344. isLoading={areDomainTransactionMetricsFetching}
  345. />
  346. <MetricReadout
  347. align="left"
  348. title={t('4XXs')}
  349. value={domainTransactionMetrics?.[0]?.[`http_response_rate(4)`]}
  350. unit="percentage"
  351. isLoading={areDomainTransactionMetricsFetching}
  352. />
  353. <MetricReadout
  354. align="left"
  355. title={t('5XXs')}
  356. value={domainTransactionMetrics?.[0]?.[`http_response_rate(5)`]}
  357. unit="percentage"
  358. isLoading={areDomainTransactionMetricsFetching}
  359. />
  360. <MetricReadout
  361. align="left"
  362. title={DataTitles.timeSpent}
  363. value={domainTransactionMetrics?.[0]?.['sum(span.self_time)']}
  364. unit={DurationUnit.MILLISECOND}
  365. tooltip={getTimeSpentExplanation(
  366. domainTransactionMetrics?.[0]?.['time_spent_percentage()'],
  367. 'http.client'
  368. )}
  369. isLoading={areDomainTransactionMetricsFetching}
  370. />
  371. </MetricsRibbon>
  372. </ModuleLayout.Full>
  373. <ModuleLayout.Full>
  374. <PanelControls>
  375. <SegmentedControl
  376. value={query.panel}
  377. onChange={handlePanelChange}
  378. aria-label={t('Choose breakdown type')}
  379. >
  380. <SegmentedControl.Item key="duration">
  381. {t('By Duration')}
  382. </SegmentedControl.Item>
  383. <SegmentedControl.Item key="status">
  384. {t('By Response Code')}
  385. </SegmentedControl.Item>
  386. </SegmentedControl>
  387. <CompactSelect
  388. value={query.responseCodeClass}
  389. options={HTTP_RESPONSE_CODE_CLASS_OPTIONS}
  390. onChange={handleResponseCodeClassChange}
  391. triggerProps={{
  392. prefix: t('Response Code'),
  393. }}
  394. />
  395. </PanelControls>
  396. </ModuleLayout.Full>
  397. {query.panel === 'duration' && (
  398. <Fragment>
  399. <ModuleLayout.Full>
  400. <DurationChart
  401. series={[
  402. {
  403. ...durationData[`avg(span.self_time)`],
  404. markLine: AverageValueMarkLine(),
  405. },
  406. ]}
  407. scatterPlot={sampledSpanDataSeries}
  408. onHighlight={highlights => {
  409. const firstHighlight = highlights[0];
  410. if (!firstHighlight) {
  411. setHighlightedSpanId(undefined);
  412. return;
  413. }
  414. const sample = findSampleFromDataPoint<
  415. (typeof durationSamplesData)[0]
  416. >(
  417. firstHighlight.dataPoint,
  418. durationSamplesData,
  419. SpanIndexedField.SPAN_SELF_TIME
  420. );
  421. setHighlightedSpanId(sample?.span_id);
  422. }}
  423. isLoading={isDurationDataFetching}
  424. error={durationError}
  425. />
  426. </ModuleLayout.Full>
  427. </Fragment>
  428. )}
  429. {query.panel === 'status' && (
  430. <Fragment>
  431. <ModuleLayout.Full>
  432. <ResponseCodeCountChart
  433. series={Object.values(responseCodeData).filter(Boolean)}
  434. isLoading={isResponseCodeDataLoading}
  435. error={responseCodeError}
  436. />
  437. </ModuleLayout.Full>
  438. </Fragment>
  439. )}
  440. <Feature features="performance-sample-panel-search">
  441. <ModuleLayout.Full>
  442. <SearchBar
  443. searchSource={`${ModuleName.HTTP}-sample-panel`}
  444. query={query.spanSearchQuery}
  445. onSearch={handleSearch}
  446. placeholder={t('Search for span attributes')}
  447. organization={organization}
  448. metricAlert={false}
  449. supportedTags={supportedTags}
  450. dataset={DiscoverDatasets.SPANS_INDEXED}
  451. projectIds={selection.projects}
  452. />
  453. </ModuleLayout.Full>
  454. </Feature>
  455. {query.panel === 'duration' && (
  456. <Fragment>
  457. <ModuleLayout.Full>
  458. <SpanSamplesTable
  459. data={durationSamplesData}
  460. isLoading={isDurationDataFetching || isDurationSamplesDataFetching}
  461. highlightedSpanId={highlightedSpanId}
  462. onSampleMouseOver={sample => setHighlightedSpanId(sample.span_id)}
  463. onSampleMouseOut={() => setHighlightedSpanId(undefined)}
  464. error={durationSamplesDataError}
  465. // TODO: The samples endpoint doesn't provide its own meta, so we need to create it manually
  466. meta={{
  467. fields: {
  468. 'span.response_code': 'number',
  469. },
  470. units: {},
  471. }}
  472. referrer={TraceViewSources.REQUESTS_MODULE}
  473. />
  474. </ModuleLayout.Full>
  475. <ModuleLayout.Full>
  476. <Button
  477. onClick={() => {
  478. trackAnalytics(
  479. 'performance_views.sample_spans.try_different_samples_clicked',
  480. {organization, source: ModuleName.HTTP}
  481. );
  482. refetchDurationSpanSamples();
  483. }}
  484. >
  485. {t('Try Different Samples')}
  486. </Button>
  487. </ModuleLayout.Full>
  488. </Fragment>
  489. )}
  490. {query.panel === 'status' && (
  491. <Fragment>
  492. <ModuleLayout.Full>
  493. <SpanSamplesTable
  494. data={responseCodeSamplesData ?? []}
  495. isLoading={isResponseCodeSamplesDataFetching}
  496. error={responseCodeSamplesDataError}
  497. // TODO: The samples endpoint doesn't provide its own meta, so we need to create it manually
  498. meta={{
  499. fields: {
  500. 'span.response_code': 'number',
  501. },
  502. units: {},
  503. }}
  504. />
  505. </ModuleLayout.Full>
  506. <ModuleLayout.Full>
  507. <Button
  508. onClick={() => {
  509. trackAnalytics(
  510. 'performance_views.sample_spans.try_different_samples_clicked',
  511. {organization, source: ModuleName.HTTP}
  512. );
  513. refetchResponseCodeSpanSamples();
  514. }}
  515. >
  516. {t('Try Different Samples')}
  517. </Button>
  518. </ModuleLayout.Full>
  519. </Fragment>
  520. )}
  521. </ModuleLayout.Layout>
  522. </DetailPanel>
  523. </PageAlertProvider>
  524. );
  525. }
  526. const SAMPLE_HOVER_DEBOUNCE = 10;
  527. const SPAN_SAMPLE_LIMIT = 10;
  528. // This is functionally a random sort, which is what we want
  529. const SPAN_SAMPLES_SORT = {
  530. field: 'span_id',
  531. kind: 'desc' as const,
  532. };
  533. const SpanSummaryProjectAvatar = styled(ProjectAvatar)`
  534. padding-right: ${space(1)};
  535. `;
  536. const HTTP_RESPONSE_CODE_CLASS_OPTIONS = [
  537. {
  538. value: '',
  539. label: t('All'),
  540. },
  541. {
  542. value: '2',
  543. label: t('2XXs'),
  544. },
  545. {
  546. value: '3',
  547. label: t('3XXs'),
  548. },
  549. {
  550. value: '4',
  551. label: t('4XXs'),
  552. },
  553. {
  554. value: '5',
  555. label: t('5XXs'),
  556. },
  557. ];
  558. // TODO - copy of static/app/views/starfish/views/spanSummaryPage/sampleList/index.tsx
  559. const HeaderContainer = styled('div')`
  560. display: grid;
  561. grid-template-rows: auto auto auto;
  562. align-items: center;
  563. @media (min-width: ${p => p.theme.breakpoints.small}) {
  564. grid-template-rows: auto;
  565. grid-template-columns: auto 1fr;
  566. }
  567. `;
  568. const Title = styled('h4')`
  569. overflow: hidden;
  570. text-overflow: ellipsis;
  571. white-space: nowrap;
  572. margin: 0;
  573. `;
  574. const MetricsRibbon = styled('div')`
  575. display: flex;
  576. flex-wrap: wrap;
  577. gap: ${space(4)};
  578. `;
  579. const PanelControls = styled('div')`
  580. display: flex;
  581. justify-content: space-between;
  582. gap: ${space(2)};
  583. `;