index.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import styled from '@emotion/styled';
  2. import Breadcrumbs from 'sentry/components/breadcrumbs';
  3. import FeatureBadge from 'sentry/components/featureBadge';
  4. import * as Layout from 'sentry/components/layouts/thirds';
  5. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  6. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  7. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  8. import {t} from 'sentry/locale';
  9. import {useLocation} from 'sentry/utils/useLocation';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. import {useParams} from 'sentry/utils/useParams';
  12. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  13. import {PaddedContainer} from 'sentry/views/performance/browser/resources';
  14. import ResourceInfo from 'sentry/views/performance/browser/resources/resourceSummaryPage/resourceInfo';
  15. import ResourceSummaryCharts from 'sentry/views/performance/browser/resources/resourceSummaryPage/resourceSummaryCharts';
  16. import ResourceSummaryTable from 'sentry/views/performance/browser/resources/resourceSummaryPage/resourceSummaryTable';
  17. import {ModulePageProviders} from 'sentry/views/performance/database/modulePageProviders';
  18. import {useSpanMetrics} from 'sentry/views/starfish/queries/useSpanMetrics';
  19. import {SpanMetricsField} from 'sentry/views/starfish/types';
  20. import {SampleList} from 'sentry/views/starfish/views/spanSummaryPage/sampleList';
  21. const {
  22. SPAN_SELF_TIME,
  23. SPAN_DESCRIPTION,
  24. HTTP_DECODED_RESPONSE_CONTENT_LENGTH,
  25. HTTP_RESPONSE_CONTENT_LENGTH,
  26. HTTP_RESPONSE_TRANSFER_SIZE,
  27. } = SpanMetricsField;
  28. function ResourceSummary() {
  29. const organization = useOrganization();
  30. const {groupId} = useParams();
  31. const {
  32. query: {transaction},
  33. } = useLocation();
  34. const {data: spanMetrics} = useSpanMetrics(groupId, {}, [
  35. `avg(${SPAN_SELF_TIME})`,
  36. `avg(${HTTP_RESPONSE_CONTENT_LENGTH})`,
  37. `avg(${HTTP_DECODED_RESPONSE_CONTENT_LENGTH})`,
  38. `avg(${HTTP_RESPONSE_TRANSFER_SIZE})`,
  39. 'spm()',
  40. SPAN_DESCRIPTION,
  41. ]);
  42. return (
  43. <ModulePageProviders
  44. title={[t('Performance'), t('Resources'), t('Resource Summary')].join(' — ')}
  45. >
  46. <Layout.Header>
  47. <Layout.HeaderContent>
  48. <Breadcrumbs
  49. crumbs={[
  50. {
  51. label: 'Performance',
  52. to: normalizeUrl(`/organizations/${organization.slug}/performance/`),
  53. preservePageFilters: true,
  54. },
  55. {
  56. label: 'Resources',
  57. to: normalizeUrl(
  58. `/organizations/${organization.slug}/performance/browser/resources/`
  59. ),
  60. preservePageFilters: true,
  61. },
  62. {
  63. label: 'Resource Summary',
  64. },
  65. ]}
  66. />
  67. <Layout.Title>
  68. {spanMetrics[SpanMetricsField.SPAN_DESCRIPTION]}
  69. <FeatureBadge type="alpha" />
  70. </Layout.Title>
  71. </Layout.HeaderContent>
  72. </Layout.Header>
  73. <Layout.Body>
  74. <Layout.Main fullWidth>
  75. <HeaderContainer>
  76. <PaddedContainer>
  77. <PageFilterBar condensed>
  78. <ProjectPageFilter />
  79. <DatePageFilter />
  80. </PageFilterBar>
  81. </PaddedContainer>
  82. <ResourceInfo
  83. avgContentLength={spanMetrics[`avg(${HTTP_RESPONSE_CONTENT_LENGTH})`]}
  84. avgDecodedContentLength={
  85. spanMetrics[`avg(${HTTP_DECODED_RESPONSE_CONTENT_LENGTH})`]
  86. }
  87. avgTransferSize={spanMetrics[`avg(${HTTP_RESPONSE_TRANSFER_SIZE})`]}
  88. avgDuration={spanMetrics[`avg(${SPAN_SELF_TIME})`]}
  89. throughput={spanMetrics['spm()']}
  90. />
  91. </HeaderContainer>
  92. <ResourceSummaryCharts groupId={groupId} />
  93. <ResourceSummaryTable />
  94. <SampleList
  95. transactionRoute="/performance/browser/pageloads/"
  96. groupId={groupId}
  97. transactionName={transaction as string}
  98. />
  99. </Layout.Main>
  100. </Layout.Body>
  101. </ModulePageProviders>
  102. );
  103. }
  104. const HeaderContainer = styled('div')`
  105. display: flex;
  106. justify-content: space-between;
  107. flex-wrap: wrap;
  108. `;
  109. export default ResourceSummary;