diff --git a/static/app/components/events/interfaces/spans/spanSummaryButton.tsx b/static/app/components/events/interfaces/spans/spanSummaryButton.tsx index 19fa2b9571873b..30d15bfa6312b9 100644 --- a/static/app/components/events/interfaces/spans/spanSummaryButton.tsx +++ b/static/app/components/events/interfaces/spans/spanSummaryButton.tsx @@ -1,12 +1,17 @@ import {LinkButton} from 'sentry/components/button'; import type {SpanType} from 'sentry/components/events/interfaces/spans/types'; -import {t} from 'sentry/locale'; +import {t, tct} from 'sentry/locale'; import type {EventTransaction, Organization} from 'sentry/types'; import {useLocation} from 'sentry/utils/useLocation'; +import { + DATA_TYPE as RESOURCE_DATA_TYPE, + PERFORMANCE_DATA_TYPE as PERFORMANCE_RESOURCE_DATA_TYPE, +} from 'sentry/views/performance/browser/resources/settings'; import { querySummaryRouteWithQuery, resourceSummaryRouteWithQuery, } from 'sentry/views/performance/transactionSummary/transactionSpans/spanDetails/utils'; +import {useModuleURL} from 'sentry/views/performance/utils/useModuleURL'; import {ModuleName} from 'sentry/views/starfish/types'; import {resolveSpanModule} from 'sentry/views/starfish/utils/resolveSpanModule'; @@ -18,6 +23,7 @@ interface Props { function SpanSummaryButton(props: Props) { const location = useLocation(); + const resourceBaseUrl = useModuleURL(ModuleName.RESOURCE); const {event, organization, span} = props; @@ -27,6 +33,11 @@ function SpanSummaryButton(props: Props) { } const resolvedModule = resolveSpanModule(sentryTags.op, sentryTags.category); + const isInsightsEnabled = organization.features.includes('performance-insights'); + + const resourceDataType = isInsightsEnabled + ? RESOURCE_DATA_TYPE + : PERFORMANCE_RESOURCE_DATA_TYPE; if ( organization.features.includes('spans-first-ui') && @@ -56,13 +67,13 @@ function SpanSummaryButton(props: Props) { - {t('View Resource Summary')} + {tct('View [dataType] Summary', {dataType: resourceDataType})} ); } diff --git a/static/app/components/sidebar/index.tsx b/static/app/components/sidebar/index.tsx index 1d9fac8316eb47..784b65e243af1a 100644 --- a/static/app/components/sidebar/index.tsx +++ b/static/app/components/sidebar/index.tsx @@ -58,8 +58,12 @@ import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import MetricsOnboardingSidebar from 'sentry/views/metrics/ddmOnboarding/sidebar'; import {releaseLevelAsBadgeProps as CacheModuleBadgeProps} from 'sentry/views/performance/cache/settings'; import {releaseLevelAsBadgeProps as QueuesModuleBadgeProps} from 'sentry/views/performance/queues/settings'; -import {MODULE_TITLES} from 'sentry/views/performance/utils/useModuleTitle'; +import { + MODULE_TITLES, + useModuleTitle, +} from 'sentry/views/performance/utils/useModuleTitle'; import {useModuleURLBuilder} from 'sentry/views/performance/utils/useModuleURL'; +import {ModuleName} from 'sentry/views/starfish/types'; import {ProfilingOnboardingSidebar} from '../profiling/ProfilingOnboarding/profilingOnboardingSidebar'; @@ -124,6 +128,7 @@ function Sidebar() { const activePanel = useLegacyStore(SidebarPanelStore); const organization = useOrganization({allowNull: true}); const {shouldAccordionFloat} = useContext(ExpandedContext); + const resourceModuleTitle = useModuleTitle(ModuleName.RESOURCE); const collapsed = !!preferences.collapsed; const horizontal = useMedia(`(max-width: ${theme.breakpoints.medium})`); @@ -358,7 +363,7 @@ function Sidebar() { {MODULE_TITLES.resource}} + label={{resourceModuleTitle}} to={`/organizations/${organization.slug}/${moduleURLBuilder('resource')}/`} id="performance-browser-resources" icon={} diff --git a/static/app/routes.tsx b/static/app/routes.tsx index e400c47dbbcf0c..2e067891079ab3 100644 --- a/static/app/routes.tsx +++ b/static/app/routes.tsx @@ -19,6 +19,7 @@ import IssueListOverview from 'sentry/views/issueList/overview'; import OrganizationContainer from 'sentry/views/organizationContainer'; import OrganizationLayout from 'sentry/views/organizationLayout'; import OrganizationRoot from 'sentry/views/organizationRoot'; +import {PERFORMANCE_BASE_URL as PERFORMANCE_RESOURCE_BASE_URL} from 'sentry/views/performance/browser/resources/settings'; import {MODULE_BASE_URLS} from 'sentry/views/performance/utils/useModuleURL'; import ProjectEventRedirect from 'sentry/views/projectEventRedirect'; import redirectDeprecatedProjectRoute from 'sentry/views/projects/redirectDeprecatedProjectRoute'; @@ -1505,6 +1506,22 @@ function buildRoutes() { )} /> + + import('sentry/views/performance/browser/resources/index') + )} + /> + + import( + 'sentry/views/performance/browser/resources/resourceSummaryPage/index' + ) + )} + /> + @@ -48,10 +54,12 @@ function ResourcesLandingPage() { - {MODULE_TITLE} + {moduleTitle} diff --git a/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx b/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx index 8dc1d4d5ec2d98..c184206bc865b4 100644 --- a/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx +++ b/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx @@ -9,9 +9,10 @@ import {DatePageFilter} from 'sentry/components/organizations/datePageFilter'; import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter'; import PageFilterBar from 'sentry/components/organizations/pageFilterBar'; import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter'; -import {t} from 'sentry/locale'; +import {t, tct} from 'sentry/locale'; import {MutableSearch} from 'sentry/utils/tokenizeSearch'; import {useLocation} from 'sentry/utils/useLocation'; +import useOrganization from 'sentry/utils/useOrganization'; import {useParams} from 'sentry/utils/useParams'; import {Referrer} from 'sentry/views/performance/browser/resources/referrer'; import ResourceInfo from 'sentry/views/performance/browser/resources/resourceSummaryPage/resourceInfo'; @@ -19,6 +20,10 @@ import ResourceSummaryCharts from 'sentry/views/performance/browser/resources/re import ResourceSummaryTable from 'sentry/views/performance/browser/resources/resourceSummaryPage/resourceSummaryTable'; import SampleImages from 'sentry/views/performance/browser/resources/resourceSummaryPage/sampleImages'; import {FilterOptionsContainer} from 'sentry/views/performance/browser/resources/resourceView'; +import { + DATA_TYPE, + PERFORMANCE_DATA_TYPE, +} from 'sentry/views/performance/browser/resources/settings'; import {IMAGE_FILE_EXTENSIONS} from 'sentry/views/performance/browser/resources/shared/constants'; import RenderBlockingSelector from 'sentry/views/performance/browser/resources/shared/renderBlockingSelector'; import {ResourceSpanOps} from 'sentry/views/performance/browser/resources/shared/types'; @@ -42,6 +47,7 @@ const { function ResourceSummary() { const webVitalsModuleURL = useModuleURL('vital'); + const organization = useOrganization(); const {groupId} = useParams(); const filters = useResourceModuleFilters(); const selectedSpanOp = filters[SPAN_OP]; @@ -83,6 +89,9 @@ function ResourceSummary() { const crumbs = useModuleBreadcrumbs('resource'); + const isInsightsEnabled = organization.features.includes('performance-insights'); + const resourceDataType = isInsightsEnabled ? DATA_TYPE : PERFORMANCE_DATA_TYPE; + return ( @@ -91,7 +100,7 @@ function ResourceSummary() { crumbs={[ ...crumbs, { - label: 'Resource Summary', + label: tct('[dataType] Summary', {dataType: resourceDataType}), }, ]} /> @@ -148,10 +157,14 @@ function ResourceSummary() { } function PageWithProviders() { + const organization = useOrganization(); + + const isInsightsEnabled = organization.features.includes('performance-insights'); + const resourceDataType = isInsightsEnabled ? DATA_TYPE : PERFORMANCE_DATA_TYPE; return ( diff --git a/static/app/views/performance/browser/resources/resourceSummaryPage/resourceSummaryCharts.tsx b/static/app/views/performance/browser/resources/resourceSummaryPage/resourceSummaryCharts.tsx index a51a44c401cad9..774ab48ab34c1d 100644 --- a/static/app/views/performance/browser/resources/resourceSummaryPage/resourceSummaryCharts.tsx +++ b/static/app/views/performance/browser/resources/resourceSummaryPage/resourceSummaryCharts.tsx @@ -1,10 +1,15 @@ -import {t} from 'sentry/locale'; +import {t, tct} from 'sentry/locale'; import {formatBytesBase2} from 'sentry/utils'; import {formatRate} from 'sentry/utils/formatters'; import getDynamicText from 'sentry/utils/getDynamicText'; import {MutableSearch} from 'sentry/utils/tokenizeSearch'; +import useOrganization from 'sentry/utils/useOrganization'; import {RESOURCE_THROUGHPUT_UNIT} from 'sentry/views/performance/browser/resources'; import {Referrer} from 'sentry/views/performance/browser/resources/referrer'; +import { + DATA_TYPE, + PERFORMANCE_DATA_TYPE, +} from 'sentry/views/performance/browser/resources/settings'; import {useResourceModuleFilters} from 'sentry/views/performance/browser/resources/utils/useResourceFilters'; import {AVG_COLOR, THROUGHPUT_COLOR} from 'sentry/views/starfish/colors'; import Chart, {ChartType} from 'sentry/views/starfish/components/chart'; @@ -28,6 +33,10 @@ const { function ResourceSummaryCharts(props: {groupId: string}) { const filters = useResourceModuleFilters(); + const organization = useOrganization(); + + const isInsightsEnabled = organization.features.includes('performance-insights'); + const resourceDataType = isInsightsEnabled ? DATA_TYPE : PERFORMANCE_DATA_TYPE; const {data: spanMetricsSeriesData, isLoading: areSpanMetricsSeriesLoading} = useSpanMetricsSeries( @@ -96,7 +105,7 @@ function ResourceSummaryCharts(props: {groupId: string}) { - + [] = [ - {key: SPAN_DESCRIPTION, width: COL_WIDTH_UNDEFINED, name: t('Resource Description')}, + { + key: SPAN_DESCRIPTION, + width: COL_WIDTH_UNDEFINED, + name: `${resourceDataType} ${t('Description')}`, + }, { key: `${SPM}()`, width: COL_WIDTH_UNDEFINED, diff --git a/static/app/views/performance/browser/resources/settings.ts b/static/app/views/performance/browser/resources/settings.ts index 1bb4214e67a445..a79c3510dfd2b7 100644 --- a/static/app/views/performance/browser/resources/settings.ts +++ b/static/app/views/performance/browser/resources/settings.ts @@ -1,9 +1,17 @@ import {t} from 'sentry/locale'; -export const MODULE_TITLE = t('Resources'); -export const BASE_URL = 'browser/resources'; - +export const MODULE_TITLE = t('Assets'); +export const DATA_TYPE = t('Asset'); +export const BASE_URL = 'browser/assets'; // Name of the data shown (singular) export const MODULE_DESCRIPTION = t( 'Find large and slow-to-load resources used by your application and understand their impact on page performance.' ); + +export const PERFORMANCE_MODULE_TITLE = t('Resources'); +export const PERFORMANCE_BASE_URL = 'browser/resources'; +export const PERFORMANCE_DATA_TYPE = t('Resource'); +export const PERFORMANCE_MODULE_DESCRIPTION = t( + 'Find large and slow-to-load resources used by your application and understand their impact on page performance.' +); + export const MODULE_DOC_LINK = 'https://docs.sentry.io/product/performance/resources/'; diff --git a/static/app/views/performance/landing/widgets/components/widgetContainer.spec.tsx b/static/app/views/performance/landing/widgets/components/widgetContainer.spec.tsx index 0d6f1ff2af9c52..74f3039afd7a35 100644 --- a/static/app/views/performance/landing/widgets/components/widgetContainer.spec.tsx +++ b/static/app/views/performance/landing/widgets/components/widgetContainer.spec.tsx @@ -943,7 +943,7 @@ describe('Performance > Widgets > WidgetContainer', function () { }); it('Most time consuming resources widget', async function () { - const data = initializeData(); + const data = initializeData(undefined, {features: ['performance-insights']}); wrapper = render( @@ -955,11 +955,11 @@ describe('Performance > Widgets > WidgetContainer', function () { ); expect(await screen.findByTestId('performance-widget-title')).toHaveTextContent( - 'Most Time Consuming Resources' + 'Most Time-Consuming Assets' ); expect(await screen.findByRole('button', {name: 'View All'})).toHaveAttribute( 'href', - '/performance/browser/resources/' + '/insights/browser/assets/' ); expect(eventsMock).toHaveBeenCalledTimes(1); expect(eventsMock).toHaveBeenNthCalledWith( diff --git a/static/app/views/performance/landing/widgets/components/widgetHeader.tsx b/static/app/views/performance/landing/widgets/components/widgetHeader.tsx index bf523d5e0ebdf0..97537960bcc4ad 100644 --- a/static/app/views/performance/landing/widgets/components/widgetHeader.tsx +++ b/static/app/views/performance/landing/widgets/components/widgetHeader.tsx @@ -24,16 +24,11 @@ export function WidgetHeader( PerformanceWidgetSetting.OVERALL_PERFORMANCE_SCORE, ].includes(chartSetting); - const isResourcesWidget = - chartSetting === PerformanceWidgetSetting.MOST_TIME_CONSUMING_RESOURCES; - const isCacheWidget = chartSetting === PerformanceWidgetSetting.HIGHEST_CACHE_MISS_RATE_TRANSACTIONS; const featureBadge = - isWebVitalsWidget || isResourcesWidget || isCacheWidget ? ( - - ) : null; + isWebVitalsWidget || isCacheWidget ? : null; return ( diff --git a/static/app/views/performance/landing/widgets/widgetDefinitions.tsx b/static/app/views/performance/landing/widgets/widgetDefinitions.tsx index 7e3c18503d5a39..761bb63c8b13a0 100644 --- a/static/app/views/performance/landing/widgets/widgetDefinitions.tsx +++ b/static/app/views/performance/landing/widgets/widgetDefinitions.tsx @@ -2,6 +2,8 @@ import {CHART_PALETTE} from 'sentry/constants/chartPalette'; import {t} from 'sentry/locale'; import type {Organization} from 'sentry/types/organization'; import {SPAN_OP_BREAKDOWN_FIELDS} from 'sentry/utils/discover/fields'; +import {useModuleTitle} from 'sentry/views/performance/utils/useModuleTitle'; +import {ModuleName} from 'sentry/views/starfish/types'; import {getTermHelp, PerformanceTerm} from '../../data'; @@ -82,355 +84,362 @@ export const WIDGET_DEFINITIONS: ({ organization, }: { organization: Organization; -}) => ({ - [PerformanceWidgetSetting.DURATION_HISTOGRAM]: { - title: t('Duration Distribution'), - titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), - fields: ['transaction.duration'], - dataType: GenericPerformanceWidgetDataType.HISTOGRAM, - chartColor: WIDGET_PALETTE[5], - }, - [PerformanceWidgetSetting.LCP_HISTOGRAM]: { - title: t('LCP Distribution'), - titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), - fields: ['measurements.lcp'], - dataType: GenericPerformanceWidgetDataType.HISTOGRAM, - chartColor: WIDGET_PALETTE[5], - }, - [PerformanceWidgetSetting.FCP_HISTOGRAM]: { - title: t('FCP Distribution'), - titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), - fields: ['measurements.fcp'], - dataType: GenericPerformanceWidgetDataType.HISTOGRAM, - chartColor: WIDGET_PALETTE[5], - }, - [PerformanceWidgetSetting.FID_HISTOGRAM]: { - title: t('FID Distribution'), - titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), - fields: ['measurements.fid'], - dataType: GenericPerformanceWidgetDataType.HISTOGRAM, - chartColor: WIDGET_PALETTE[5], - }, - [PerformanceWidgetSetting.WORST_LCP_VITALS]: { - title: t('Worst LCP Web Vitals'), - titleTooltip: getTermHelp(organization, PerformanceTerm.LCP), - fields: ['measurements.lcp'], - vitalStops: { - poor: 4000, - meh: 2500, - }, - dataType: GenericPerformanceWidgetDataType.VITALS, - }, - [PerformanceWidgetSetting.WORST_FCP_VITALS]: { - title: t('Worst FCP Web Vitals'), - titleTooltip: getTermHelp(organization, PerformanceTerm.FCP), - fields: ['measurements.fcp'], - vitalStops: { - poor: 3000, - meh: 1000, - }, - dataType: GenericPerformanceWidgetDataType.VITALS, - }, - [PerformanceWidgetSetting.WORST_FID_VITALS]: { - title: t('Worst FID Web Vitals'), - titleTooltip: getTermHelp(organization, PerformanceTerm.FID), - fields: ['measurements.fid'], - vitalStops: { - poor: 300, - meh: 100, - }, - dataType: GenericPerformanceWidgetDataType.VITALS, - }, - [PerformanceWidgetSetting.WORST_CLS_VITALS]: { - title: t('Worst CLS Web Vitals'), - titleTooltip: getTermHelp(organization, PerformanceTerm.CLS), - fields: ['measurements.cls'], - vitalStops: { - poor: 0.25, - meh: 0.1, - }, - dataType: GenericPerformanceWidgetDataType.VITALS, - }, - [PerformanceWidgetSetting.TPM_AREA]: { - title: t('Transactions Per Minute'), - titleTooltip: getTermHelp(organization, PerformanceTerm.TPM), - fields: ['tpm()'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[1], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.APDEX_AREA]: { - title: t('Apdex'), - titleTooltip: getTermHelp(organization, PerformanceTerm.APDEX), - fields: ['apdex()'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[4], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.P50_DURATION_AREA]: { - title: t('p50 Duration'), - titleTooltip: getTermHelp(organization, PerformanceTerm.P50), - fields: ['p50(transaction.duration)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[3], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.P75_DURATION_AREA]: { - title: t('p75 Duration'), - titleTooltip: getTermHelp(organization, PerformanceTerm.P75), - fields: ['p75(transaction.duration)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[3], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.P95_DURATION_AREA]: { - title: t('p95 Duration'), - titleTooltip: getTermHelp(organization, PerformanceTerm.P95), - fields: ['p95(transaction.duration)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[3], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.P99_DURATION_AREA]: { - title: t('p99 Duration'), - titleTooltip: getTermHelp(organization, PerformanceTerm.P99), - fields: ['p99(transaction.duration)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[3], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.P75_LCP_AREA]: { - title: t('p75 LCP'), - titleTooltip: getTermHelp(organization, PerformanceTerm.P75), - fields: ['p75(measurements.lcp)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[1], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.FAILURE_RATE_AREA]: { - title: t('Failure Rate'), - titleTooltip: getTermHelp(organization, PerformanceTerm.FAILURE_RATE), - fields: ['failure_rate()'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[2], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.USER_MISERY_AREA]: { - title: t('User Misery'), - titleTooltip: getTermHelp(organization, PerformanceTerm.USER_MISERY), - fields: [`user_misery()`], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[0], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.COLD_STARTUP_AREA]: { - title: t('Cold Startup Time'), - titleTooltip: getTermHelp(organization, PerformanceTerm.APP_START_COLD), - fields: ['p75(measurements.app_start_cold)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[4], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.WARM_STARTUP_AREA]: { - title: t('Warm Startup Time'), - titleTooltip: getTermHelp(organization, PerformanceTerm.APP_START_WARM), - fields: ['p75(measurements.app_start_warm)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[3], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.SLOW_FRAMES_AREA]: { - title: t('Slow Frames'), - titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_FRAMES), - fields: ['p75(measurements.frames_slow_rate)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[0], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.FROZEN_FRAMES_AREA]: { - title: t('Frozen Frames'), - titleTooltip: getTermHelp(organization, PerformanceTerm.FROZEN_FRAMES), - fields: ['p75(measurements.frames_frozen_rate)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[5], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.MOST_RELATED_ERRORS]: { - title: t('Most Related Errors'), - titleTooltip: getTermHelp(organization, PerformanceTerm.MOST_ERRORS), - fields: [`failure_count()`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.MOST_RELATED_ISSUES]: { - title: t('Most Related Issues'), - titleTooltip: getTermHelp(organization, PerformanceTerm.MOST_ISSUES), - fields: [`count()`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.MOST_TIME_SPENT_DB_QUERIES]: { - title: t('Most Time-Consuming Queries'), - subTitle: t('Top queries by total duration'), - titleTooltip: getTermHelp(organization, PerformanceTerm.MOST_TIME_SPENT_DB_QUERIES), - fields: [`time_spent_percentage()`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.MOST_TIME_CONSUMING_RESOURCES]: { - title: t('Most Time Consuming Resources'), - subTitle: t('Render blocking for pages'), - titleTooltip: getTermHelp( - organization, - PerformanceTerm.MOST_TIME_CONSUMING_RESOURCES - ), - fields: [`time_spent_percentage()`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.HIGHEST_CACHE_MISS_RATE_TRANSACTIONS]: { - title: t('Highest Cache Miss Rates'), - subTitle: t('Suggested Transactions'), - titleTooltip: getTermHelp( - organization, - PerformanceTerm.HIGHEST_CACHE_MISS_RATE_TRANSACTIONS - ), - fields: [`cache_miss_rate()`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.MOST_TIME_CONSUMING_DOMAINS]: { - title: t('Most Time-Consuming Domains'), - subTitle: t('Top outgoing HTTP request domains by time spent'), - titleTooltip: getTermHelp(organization, PerformanceTerm.MOST_TIME_CONSUMING_DOMAINS), - fields: [`time_spent_percentage()`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.HIGHEST_OPPORTUNITY_PAGES]: { - title: t('Best Page Opportunities'), - subTitle: t('Pages to improve your performance score'), - titleTooltip: '', - fields: [`count()`], - dataType: GenericPerformanceWidgetDataType.PERFORMANCE_SCORE_LIST, - }, - [PerformanceWidgetSetting.OVERALL_PERFORMANCE_SCORE]: { - title: t('Performance Score'), - subTitle: t('The overall performance score across selected frontend projects only'), - titleTooltip: '', - fields: [], - dataType: GenericPerformanceWidgetDataType.PERFORMANCE_SCORE, - }, - [PerformanceWidgetSetting.SLOW_HTTP_OPS]: { - title: t('Slow HTTP Ops'), - titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), - fields: [`p75(spans.http)`, 'p75(spans.db)'], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.SLOW_BROWSER_OPS]: { - title: t('Slow Browser Ops'), - titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), - fields: [`p75(spans.browser)`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.SLOW_RESOURCE_OPS]: { - title: t('Slow Resource Ops'), - titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), - fields: [`p75(spans.resource)`], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.SLOW_DB_OPS]: { - title: t('Slow DB Ops'), - titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), - fields: [`p75(spans.db)`, 'p75(spans.http)'], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.TIME_TO_INITIAL_DISPLAY]: { - title: t('Time to Initial Display'), - titleTooltip: getTermHelp(organization, PerformanceTerm.TIME_TO_INITIAL_DISPLAY), - fields: ['p75(measurements.time_to_initial_display)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[4], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.TIME_TO_FULL_DISPLAY]: { - title: t('Time to Full Display'), - titleTooltip: getTermHelp(organization, PerformanceTerm.TIME_TO_FULL_DISPLAY), - fields: ['p75(measurements.time_to_full_display)'], - dataType: GenericPerformanceWidgetDataType.AREA, - chartColor: WIDGET_PALETTE[4], - allowsOpenInDiscover: true, - }, - [PerformanceWidgetSetting.MOST_SLOW_FRAMES]: { - title: t('Most Slow Frames'), - titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_FRAMES), - fields: ['avg(measurements.frames_slow)'], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.MOST_FROZEN_FRAMES]: { - title: t('Most Frozen Frames'), - titleTooltip: getTermHelp(organization, PerformanceTerm.FROZEN_FRAMES), - fields: ['avg(measurements.frames_frozen)'], - dataType: GenericPerformanceWidgetDataType.LINE_LIST, - chartColor: WIDGET_PALETTE[0], - }, - [PerformanceWidgetSetting.MOST_IMPROVED]: { - title: t('Most Improved (P95)'), - titleTooltip: t( - 'This compares the baseline (%s) of the past with the present.', - 'improved' - ), - fields: [], - dataType: GenericPerformanceWidgetDataType.TRENDS, - }, - [PerformanceWidgetSetting.MOST_REGRESSED]: { - title: t('Most Regressed (P95)'), - titleTooltip: t( - 'This compares the baseline (%s) of the past with the present.', - 'regressed' - ), - fields: [], - dataType: GenericPerformanceWidgetDataType.TRENDS, - }, - [PerformanceWidgetSetting.MOST_CHANGED]: { - title: t('Most Changed (P95)'), - titleTooltip: t( - 'This compares the baseline (%s) of the past with the present.', - 'changed' - ), - fields: [], - dataType: GenericPerformanceWidgetDataType.TRENDS, - }, - [PerformanceWidgetSetting.SPAN_OPERATIONS]: { - title: t('Span Operations Breakdown'), - titleTooltip: '', - fields: SPAN_OP_BREAKDOWN_FIELDS.map(spanOp => `p75(${spanOp})`), - dataType: GenericPerformanceWidgetDataType.STACKED_AREA, - }, - [PerformanceWidgetSetting.SLOW_SCREENS_BY_TTID]: { - title: t('Average TTIDs'), - titleTooltip: '', - subTitle: t('Top screens by count'), - fields: ['avg(measurements.time_to_initial_display)'], - dataType: GenericPerformanceWidgetDataType.SLOW_SCREENS_BY_TTID, - }, - [PerformanceWidgetSetting.SLOW_SCREENS_BY_COLD_START]: { - title: t('Average Cold Start'), - titleTooltip: '', - subTitle: t('Top screens by start count'), - fields: ['avg(measurements.app_start_cold)'], - dataType: GenericPerformanceWidgetDataType.SLOW_SCREENS_BY_COLD_START, - }, - [PerformanceWidgetSetting.SLOW_SCREENS_BY_WARM_START]: { - title: t('Average Warm Start'), - titleTooltip: '', - subTitle: t('Top screens by start count'), - fields: ['avg(measurements.app_start_warm)'], - dataType: GenericPerformanceWidgetDataType.SLOW_SCREENS_BY_WARM_START, - }, -}); +}) => { + const resourceModuleTitle = useModuleTitle(ModuleName.RESOURCE); + + return { + [PerformanceWidgetSetting.DURATION_HISTOGRAM]: { + title: t('Duration Distribution'), + titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), + fields: ['transaction.duration'], + dataType: GenericPerformanceWidgetDataType.HISTOGRAM, + chartColor: WIDGET_PALETTE[5], + }, + [PerformanceWidgetSetting.LCP_HISTOGRAM]: { + title: t('LCP Distribution'), + titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), + fields: ['measurements.lcp'], + dataType: GenericPerformanceWidgetDataType.HISTOGRAM, + chartColor: WIDGET_PALETTE[5], + }, + [PerformanceWidgetSetting.FCP_HISTOGRAM]: { + title: t('FCP Distribution'), + titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), + fields: ['measurements.fcp'], + dataType: GenericPerformanceWidgetDataType.HISTOGRAM, + chartColor: WIDGET_PALETTE[5], + }, + [PerformanceWidgetSetting.FID_HISTOGRAM]: { + title: t('FID Distribution'), + titleTooltip: getTermHelp(organization, PerformanceTerm.DURATION_DISTRIBUTION), + fields: ['measurements.fid'], + dataType: GenericPerformanceWidgetDataType.HISTOGRAM, + chartColor: WIDGET_PALETTE[5], + }, + [PerformanceWidgetSetting.WORST_LCP_VITALS]: { + title: t('Worst LCP Web Vitals'), + titleTooltip: getTermHelp(organization, PerformanceTerm.LCP), + fields: ['measurements.lcp'], + vitalStops: { + poor: 4000, + meh: 2500, + }, + dataType: GenericPerformanceWidgetDataType.VITALS, + }, + [PerformanceWidgetSetting.WORST_FCP_VITALS]: { + title: t('Worst FCP Web Vitals'), + titleTooltip: getTermHelp(organization, PerformanceTerm.FCP), + fields: ['measurements.fcp'], + vitalStops: { + poor: 3000, + meh: 1000, + }, + dataType: GenericPerformanceWidgetDataType.VITALS, + }, + [PerformanceWidgetSetting.WORST_FID_VITALS]: { + title: t('Worst FID Web Vitals'), + titleTooltip: getTermHelp(organization, PerformanceTerm.FID), + fields: ['measurements.fid'], + vitalStops: { + poor: 300, + meh: 100, + }, + dataType: GenericPerformanceWidgetDataType.VITALS, + }, + [PerformanceWidgetSetting.WORST_CLS_VITALS]: { + title: t('Worst CLS Web Vitals'), + titleTooltip: getTermHelp(organization, PerformanceTerm.CLS), + fields: ['measurements.cls'], + vitalStops: { + poor: 0.25, + meh: 0.1, + }, + dataType: GenericPerformanceWidgetDataType.VITALS, + }, + [PerformanceWidgetSetting.TPM_AREA]: { + title: t('Transactions Per Minute'), + titleTooltip: getTermHelp(organization, PerformanceTerm.TPM), + fields: ['tpm()'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[1], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.APDEX_AREA]: { + title: t('Apdex'), + titleTooltip: getTermHelp(organization, PerformanceTerm.APDEX), + fields: ['apdex()'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[4], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.P50_DURATION_AREA]: { + title: t('p50 Duration'), + titleTooltip: getTermHelp(organization, PerformanceTerm.P50), + fields: ['p50(transaction.duration)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[3], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.P75_DURATION_AREA]: { + title: t('p75 Duration'), + titleTooltip: getTermHelp(organization, PerformanceTerm.P75), + fields: ['p75(transaction.duration)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[3], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.P95_DURATION_AREA]: { + title: t('p95 Duration'), + titleTooltip: getTermHelp(organization, PerformanceTerm.P95), + fields: ['p95(transaction.duration)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[3], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.P99_DURATION_AREA]: { + title: t('p99 Duration'), + titleTooltip: getTermHelp(organization, PerformanceTerm.P99), + fields: ['p99(transaction.duration)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[3], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.P75_LCP_AREA]: { + title: t('p75 LCP'), + titleTooltip: getTermHelp(organization, PerformanceTerm.P75), + fields: ['p75(measurements.lcp)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[1], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.FAILURE_RATE_AREA]: { + title: t('Failure Rate'), + titleTooltip: getTermHelp(organization, PerformanceTerm.FAILURE_RATE), + fields: ['failure_rate()'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[2], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.USER_MISERY_AREA]: { + title: t('User Misery'), + titleTooltip: getTermHelp(organization, PerformanceTerm.USER_MISERY), + fields: [`user_misery()`], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[0], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.COLD_STARTUP_AREA]: { + title: t('Cold Startup Time'), + titleTooltip: getTermHelp(organization, PerformanceTerm.APP_START_COLD), + fields: ['p75(measurements.app_start_cold)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[4], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.WARM_STARTUP_AREA]: { + title: t('Warm Startup Time'), + titleTooltip: getTermHelp(organization, PerformanceTerm.APP_START_WARM), + fields: ['p75(measurements.app_start_warm)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[3], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.SLOW_FRAMES_AREA]: { + title: t('Slow Frames'), + titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_FRAMES), + fields: ['p75(measurements.frames_slow_rate)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[0], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.FROZEN_FRAMES_AREA]: { + title: t('Frozen Frames'), + titleTooltip: getTermHelp(organization, PerformanceTerm.FROZEN_FRAMES), + fields: ['p75(measurements.frames_frozen_rate)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[5], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.MOST_RELATED_ERRORS]: { + title: t('Most Related Errors'), + titleTooltip: getTermHelp(organization, PerformanceTerm.MOST_ERRORS), + fields: [`failure_count()`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.MOST_RELATED_ISSUES]: { + title: t('Most Related Issues'), + titleTooltip: getTermHelp(organization, PerformanceTerm.MOST_ISSUES), + fields: [`count()`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.MOST_TIME_SPENT_DB_QUERIES]: { + title: t('Most Time-Consuming Queries'), + subTitle: t('Top queries by total duration'), + titleTooltip: getTermHelp(organization, PerformanceTerm.MOST_TIME_SPENT_DB_QUERIES), + fields: [`time_spent_percentage()`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.MOST_TIME_CONSUMING_RESOURCES]: { + title: `${t('Most Time-Consuming')} ${resourceModuleTitle}`, + subTitle: t('Render blocking for pages'), + titleTooltip: getTermHelp( + organization, + PerformanceTerm.MOST_TIME_CONSUMING_RESOURCES + ), + fields: [`time_spent_percentage()`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.HIGHEST_CACHE_MISS_RATE_TRANSACTIONS]: { + title: t('Highest Cache Miss Rates'), + subTitle: t('Suggested Transactions'), + titleTooltip: getTermHelp( + organization, + PerformanceTerm.HIGHEST_CACHE_MISS_RATE_TRANSACTIONS + ), + fields: [`cache_miss_rate()`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.MOST_TIME_CONSUMING_DOMAINS]: { + title: t('Most Time-Consuming Domains'), + subTitle: t('Top outgoing HTTP request domains by time spent'), + titleTooltip: getTermHelp( + organization, + PerformanceTerm.MOST_TIME_CONSUMING_DOMAINS + ), + fields: [`time_spent_percentage()`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.HIGHEST_OPPORTUNITY_PAGES]: { + title: t('Best Page Opportunities'), + subTitle: t('Pages to improve your performance score'), + titleTooltip: '', + fields: [`count()`], + dataType: GenericPerformanceWidgetDataType.PERFORMANCE_SCORE_LIST, + }, + [PerformanceWidgetSetting.OVERALL_PERFORMANCE_SCORE]: { + title: t('Performance Score'), + subTitle: t('The overall performance score across selected frontend projects only'), + titleTooltip: '', + fields: [], + dataType: GenericPerformanceWidgetDataType.PERFORMANCE_SCORE, + }, + [PerformanceWidgetSetting.SLOW_HTTP_OPS]: { + title: t('Slow HTTP Ops'), + titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), + fields: [`p75(spans.http)`, 'p75(spans.db)'], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.SLOW_BROWSER_OPS]: { + title: t('Slow Browser Ops'), + titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), + fields: [`p75(spans.browser)`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.SLOW_RESOURCE_OPS]: { + title: t('Slow Resource Ops'), + titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), + fields: [`p75(spans.resource)`], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.SLOW_DB_OPS]: { + title: t('Slow DB Ops'), + titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_HTTP_SPANS), + fields: [`p75(spans.db)`, 'p75(spans.http)'], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.TIME_TO_INITIAL_DISPLAY]: { + title: t('Time to Initial Display'), + titleTooltip: getTermHelp(organization, PerformanceTerm.TIME_TO_INITIAL_DISPLAY), + fields: ['p75(measurements.time_to_initial_display)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[4], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.TIME_TO_FULL_DISPLAY]: { + title: t('Time to Full Display'), + titleTooltip: getTermHelp(organization, PerformanceTerm.TIME_TO_FULL_DISPLAY), + fields: ['p75(measurements.time_to_full_display)'], + dataType: GenericPerformanceWidgetDataType.AREA, + chartColor: WIDGET_PALETTE[4], + allowsOpenInDiscover: true, + }, + [PerformanceWidgetSetting.MOST_SLOW_FRAMES]: { + title: t('Most Slow Frames'), + titleTooltip: getTermHelp(organization, PerformanceTerm.SLOW_FRAMES), + fields: ['avg(measurements.frames_slow)'], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.MOST_FROZEN_FRAMES]: { + title: t('Most Frozen Frames'), + titleTooltip: getTermHelp(organization, PerformanceTerm.FROZEN_FRAMES), + fields: ['avg(measurements.frames_frozen)'], + dataType: GenericPerformanceWidgetDataType.LINE_LIST, + chartColor: WIDGET_PALETTE[0], + }, + [PerformanceWidgetSetting.MOST_IMPROVED]: { + title: t('Most Improved (P95)'), + titleTooltip: t( + 'This compares the baseline (%s) of the past with the present.', + 'improved' + ), + fields: [], + dataType: GenericPerformanceWidgetDataType.TRENDS, + }, + [PerformanceWidgetSetting.MOST_REGRESSED]: { + title: t('Most Regressed (P95)'), + titleTooltip: t( + 'This compares the baseline (%s) of the past with the present.', + 'regressed' + ), + fields: [], + dataType: GenericPerformanceWidgetDataType.TRENDS, + }, + [PerformanceWidgetSetting.MOST_CHANGED]: { + title: t('Most Changed (P95)'), + titleTooltip: t( + 'This compares the baseline (%s) of the past with the present.', + 'changed' + ), + fields: [], + dataType: GenericPerformanceWidgetDataType.TRENDS, + }, + [PerformanceWidgetSetting.SPAN_OPERATIONS]: { + title: t('Span Operations Breakdown'), + titleTooltip: '', + fields: SPAN_OP_BREAKDOWN_FIELDS.map(spanOp => `p75(${spanOp})`), + dataType: GenericPerformanceWidgetDataType.STACKED_AREA, + }, + [PerformanceWidgetSetting.SLOW_SCREENS_BY_TTID]: { + title: t('Average TTIDs'), + titleTooltip: '', + subTitle: t('Top screens by count'), + fields: ['avg(measurements.time_to_initial_display)'], + dataType: GenericPerformanceWidgetDataType.SLOW_SCREENS_BY_TTID, + }, + [PerformanceWidgetSetting.SLOW_SCREENS_BY_COLD_START]: { + title: t('Average Cold Start'), + titleTooltip: '', + subTitle: t('Top screens by start count'), + fields: ['avg(measurements.app_start_cold)'], + dataType: GenericPerformanceWidgetDataType.SLOW_SCREENS_BY_COLD_START, + }, + [PerformanceWidgetSetting.SLOW_SCREENS_BY_WARM_START]: { + title: t('Average Warm Start'), + titleTooltip: '', + subTitle: t('Top screens by start count'), + fields: ['avg(measurements.app_start_warm)'], + dataType: GenericPerformanceWidgetDataType.SLOW_SCREENS_BY_WARM_START, + }, + }; +}; diff --git a/static/app/views/performance/transactionSummary/transactionSpans/spanDetails/utils.tsx b/static/app/views/performance/transactionSummary/transactionSpans/spanDetails/utils.tsx index aa727ebc701f70..9d1b49269f3219 100644 --- a/static/app/views/performance/transactionSummary/transactionSpans/spanDetails/utils.tsx +++ b/static/app/views/performance/transactionSummary/transactionSpans/spanDetails/utils.tsx @@ -84,28 +84,28 @@ export function querySummaryRouteWithQuery({ } export function generateResourceSummaryRoute({ - orgSlug, + baseUrl, group, }: { + baseUrl: string; group: string; - orgSlug: string; }): string { - return `/organizations/${orgSlug}/performance/browser/resources/spans/span/${group}/`; + return `${baseUrl}/spans/span/${group}/`; } export function resourceSummaryRouteWithQuery({ - orgSlug, + baseUrl, query, group, projectID, }: { + baseUrl: string; group: string; - orgSlug: string; query: Query; projectID?: string | string[]; }) { const pathname = generateResourceSummaryRoute({ - orgSlug, + baseUrl, group, }); diff --git a/static/app/views/performance/utils/useModuleTitle.tsx b/static/app/views/performance/utils/useModuleTitle.tsx index c2c1c1e59dce49..5fc05dc8b0d656 100644 --- a/static/app/views/performance/utils/useModuleTitle.tsx +++ b/static/app/views/performance/utils/useModuleTitle.tsx @@ -1,5 +1,9 @@ +import useOrganization from 'sentry/utils/useOrganization'; import {MODULE_TITLE as AI_MODULE_TITLE} from 'sentry/views/llmMonitoring/settings'; -import {MODULE_TITLE as RESOURCES_MODULE_TITLE} from 'sentry/views/performance/browser/resources/settings'; +import { + MODULE_TITLE as RESOURCES_MODULE_TITLE, + PERFORMANCE_MODULE_TITLE as PERFORMANCE_RESOURCES_MODULE_TITLE, +} from 'sentry/views/performance/browser/resources/settings'; import {MODULE_TITLE as VITALS_MODULE_TITLE} from 'sentry/views/performance/browser/webVitals/settings'; import {MODULE_TITLE as CACHE_MODULE_TITLE} from 'sentry/views/performance/cache/settings'; import {MODULE_TITLE as DB_MODULE_TITLE} from 'sentry/views/performance/database/settings'; @@ -29,5 +33,12 @@ type ModuleNameStrings = `${ModuleName}`; type TitleableModuleNames = Exclude; export function useModuleTitle(moduleName: TitleableModuleNames) { + const organization = useOrganization({allowNull: true}); + const isInsightsEnabled = organization?.features?.includes('performance-insights'); + + if (!isInsightsEnabled && moduleName === ModuleName.RESOURCE) { + return PERFORMANCE_RESOURCES_MODULE_TITLE; + } + return MODULE_TITLES[moduleName]; } diff --git a/static/app/views/performance/utils/useModuleURL.tsx b/static/app/views/performance/utils/useModuleURL.tsx index c7f2e6f586e706..d007d607d5346b 100644 --- a/static/app/views/performance/utils/useModuleURL.tsx +++ b/static/app/views/performance/utils/useModuleURL.tsx @@ -1,7 +1,10 @@ import useOrganization from 'sentry/utils/useOrganization'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import {BASE_URL as AI_BASE_URL} from 'sentry/views/llmMonitoring/settings'; -import {BASE_URL as RESOURCES_BASE_URL} from 'sentry/views/performance/browser/resources/settings'; +import { + BASE_URL as RESOURCES_BASE_URL, + PERFORMANCE_BASE_URL as PERFORMANCE_RESOURCES_BASE_URL, +} from 'sentry/views/performance/browser/resources/settings'; import {BASE_URL as VITALS_BASE_URL} from 'sentry/views/performance/browser/webVitals/settings'; import {BASE_URL as CACHE_BASE_URL} from 'sentry/views/performance/cache/settings'; import {BASE_URL as DB_BASE_URL} from 'sentry/views/performance/database/settings'; @@ -43,6 +46,7 @@ type URLBuilder = (moduleName: RoutableModuleNames) => string; export function useModuleURLBuilder(bare: boolean = false): URLBuilder { const organization = useOrganization({allowNull: true}); // Some parts of the app, like the main sidebar, render even if the organization isn't available (during loading, or at all). + const isInsightsEnabled = organization?.features?.includes('performance-insights'); const insightsURLBuilder = useInsightsURLBuilder(); @@ -65,6 +69,14 @@ export function useModuleURLBuilder(bare: boolean = false): URLBuilder { : normalizeUrl(`/organizations/${slug}/${moduleURLSegment}`); } + if (!isInsightsEnabled && moduleName === ModuleName.RESOURCE) { + return bare + ? `${insightsURL}/${PERFORMANCE_RESOURCES_BASE_URL}` + : normalizeUrl( + `/organizations/${slug}/${insightsURL}/${PERFORMANCE_RESOURCES_BASE_URL}` + ); + } + return bare ? `${insightsURL}/${MODULE_BASE_URLS[moduleName]}` : normalizeUrl( diff --git a/static/app/views/starfish/views/spanSummaryPage/sampleList/index.tsx b/static/app/views/starfish/views/spanSummaryPage/sampleList/index.tsx index d4744ed7ba57f1..39cecb565009d1 100644 --- a/static/app/views/starfish/views/spanSummaryPage/sampleList/index.tsx +++ b/static/app/views/starfish/views/spanSummaryPage/sampleList/index.tsx @@ -22,6 +22,10 @@ import usePageFilters from 'sentry/utils/usePageFilters'; import useProjects from 'sentry/utils/useProjects'; import useRouter from 'sentry/utils/useRouter'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; +import { + DATA_TYPE as RESOURCE_DATA_TYPE, + PERFORMANCE_DATA_TYPE as PERFORMANCE_RESOURCE_DATA_TYPE, +} from 'sentry/views/performance/browser/resources/settings'; import {useSpanFieldSupportedTags} from 'sentry/views/performance/utils/useSpanFieldSupportedTags'; import DetailPanel from 'sentry/views/starfish/components/detailPanel'; import {DEFAULT_COLUMN_ORDER} from 'sentry/views/starfish/components/samplesTable/spanSamplesTable'; @@ -140,6 +144,11 @@ export function SampleList({ SpanIndexedField.TRANSACTION_ID, ]; + const isInsightsEnabled = organization.features.includes('performance-insights'); + const resourceDataType = isInsightsEnabled + ? RESOURCE_DATA_TYPE + : PERFORMANCE_RESOURCE_DATA_TYPE; + if (moduleName === ModuleName.RESOURCE) { additionalFields?.push(SpanIndexedField.HTTP_RESPONSE_CONTENT_LENGTH); additionalFields?.push(SpanIndexedField.SPAN_DESCRIPTION); @@ -153,7 +162,7 @@ export function SampleList({ }, { key: SPAN_DESCRIPTION, - name: t('Resource Name'), + name: `${resourceDataType} ${t('Name')}`, width: COL_WIDTH_UNDEFINED, }, ];