index.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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_OP,
  24. SPAN_DESCRIPTION,
  25. HTTP_DECODED_RESPONSE_BODY_LENGTH,
  26. HTTP_RESPONSE_CONTENT_LENGTH,
  27. HTTP_RESPONSE_TRANSFER_SIZE,
  28. } = SpanMetricsField;
  29. function ResourceSummary() {
  30. const organization = useOrganization();
  31. const {groupId} = useParams();
  32. const {
  33. query: {transaction},
  34. } = useLocation();
  35. const {data: spanMetrics} = useSpanMetrics(groupId, {}, [
  36. `avg(${SPAN_SELF_TIME})`,
  37. `avg(${HTTP_RESPONSE_CONTENT_LENGTH})`,
  38. `avg(${HTTP_DECODED_RESPONSE_BODY_LENGTH})`,
  39. `avg(${HTTP_RESPONSE_TRANSFER_SIZE})`,
  40. 'spm()',
  41. SPAN_OP,
  42. SPAN_DESCRIPTION,
  43. ]);
  44. return (
  45. <ModulePageProviders
  46. title={[t('Performance'), t('Resources'), t('Resource Summary')].join(' — ')}
  47. >
  48. <Layout.Header>
  49. <Layout.HeaderContent>
  50. <Breadcrumbs
  51. crumbs={[
  52. {
  53. label: 'Performance',
  54. to: normalizeUrl(`/organizations/${organization.slug}/performance/`),
  55. preservePageFilters: true,
  56. },
  57. {
  58. label: 'Resources',
  59. to: normalizeUrl(
  60. `/organizations/${organization.slug}/performance/browser/resources/`
  61. ),
  62. preservePageFilters: true,
  63. },
  64. {
  65. label: 'Resource Summary',
  66. },
  67. ]}
  68. />
  69. <Layout.Title>
  70. {spanMetrics[SpanMetricsField.SPAN_DESCRIPTION]}
  71. <FeatureBadge type="alpha" />
  72. </Layout.Title>
  73. </Layout.HeaderContent>
  74. </Layout.Header>
  75. <Layout.Body>
  76. <Layout.Main fullWidth>
  77. <HeaderContainer>
  78. <PaddedContainer>
  79. <PageFilterBar condensed>
  80. <ProjectPageFilter />
  81. <DatePageFilter />
  82. </PageFilterBar>
  83. </PaddedContainer>
  84. <ResourceInfo
  85. avgContentLength={spanMetrics['avg(http.response_content_length)']}
  86. avgDecodedContentLength={
  87. spanMetrics['avg(http.decoded_response_body_length)']
  88. }
  89. avgTransferSize={spanMetrics['avg(http.response_transfer_size)']}
  90. avgDuration={spanMetrics[`avg(${SPAN_SELF_TIME})`]}
  91. throughput={spanMetrics['spm()']}
  92. />
  93. </HeaderContainer>
  94. <ResourceSummaryCharts groupId={groupId} />
  95. <ResourceSummaryTable />
  96. <SampleList
  97. transactionRoute="/performance/browser/pageloads/"
  98. groupId={groupId}
  99. transactionName={transaction as string}
  100. />
  101. </Layout.Main>
  102. </Layout.Body>
  103. </ModulePageProviders>
  104. );
  105. }
  106. const HeaderContainer = styled('div')`
  107. display: flex;
  108. justify-content: space-between;
  109. flex-wrap: wrap;
  110. `;
  111. export default ResourceSummary;