|
@@ -1,4 +1,4 @@
|
|
|
-import {useMemo} from 'react';
|
|
|
+import {Fragment, useMemo} from 'react';
|
|
|
import type {Location} from 'history';
|
|
|
import moment from 'moment';
|
|
|
|
|
@@ -8,6 +8,7 @@ import {IconWarning} from 'sentry/icons';
|
|
|
import {t, tct} from 'sentry/locale';
|
|
|
import {space} from 'sentry/styles/space';
|
|
|
import type {Organization, Project} from 'sentry/types';
|
|
|
+import {defined} from 'sentry/utils';
|
|
|
import {trackAnalytics} from 'sentry/utils/analytics';
|
|
|
import {parsePeriodToHours} from 'sentry/utils/dates';
|
|
|
import {useDiscoverQuery} from 'sentry/utils/discover/discoverQuery';
|
|
@@ -388,28 +389,37 @@ export function NumberedFunctionsList(props: NumberedFunctionsListProps) {
|
|
|
.map((func, index) => {
|
|
|
const profiles = func['examples()'] as string[];
|
|
|
|
|
|
- const functionSummaryView = generateProfileFlamechartRouteWithQuery({
|
|
|
- orgSlug: organization.slug,
|
|
|
- projectSlug: project?.slug || '',
|
|
|
- profileId: profiles[0],
|
|
|
- query: {
|
|
|
- frameName: func.function as string,
|
|
|
- framePackage: func.package as string,
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
- const handleClickAnalytics = () => {
|
|
|
- trackAnalytics(
|
|
|
- 'performance_views.performance_change_explorer.function_link_clicked',
|
|
|
- {
|
|
|
- organization,
|
|
|
- transaction: transactionName,
|
|
|
- package: func.package as string,
|
|
|
- function: func.function as string,
|
|
|
- profile_id: profiles[0],
|
|
|
- }
|
|
|
+ let rendered = <Fragment>{func.function}</Fragment>;
|
|
|
+ if (defined(profiles[0])) {
|
|
|
+ const functionSummaryView = generateProfileFlamechartRouteWithQuery({
|
|
|
+ orgSlug: organization.slug,
|
|
|
+ projectSlug: project?.slug || '',
|
|
|
+ profileId: profiles[0],
|
|
|
+ query: {
|
|
|
+ frameName: func.function as string,
|
|
|
+ framePackage: func.package as string,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ const handleClickAnalytics = () => {
|
|
|
+ trackAnalytics(
|
|
|
+ 'performance_views.performance_change_explorer.function_link_clicked',
|
|
|
+ {
|
|
|
+ organization,
|
|
|
+ transaction: transactionName,
|
|
|
+ package: func.package as string,
|
|
|
+ function: func.function as string,
|
|
|
+ profile_id: profiles[0],
|
|
|
+ }
|
|
|
+ );
|
|
|
+ };
|
|
|
+
|
|
|
+ rendered = (
|
|
|
+ <ListLink to={functionSummaryView} onClick={handleClickAnalytics}>
|
|
|
+ {rendered}
|
|
|
+ </ListLink>
|
|
|
);
|
|
|
- };
|
|
|
+ }
|
|
|
|
|
|
return (
|
|
|
<li key={`list-item-${index}`}>
|
|
@@ -417,9 +427,7 @@ export function NumberedFunctionsList(props: NumberedFunctionsListProps) {
|
|
|
<p style={{marginLeft: space(2)}}>
|
|
|
{tct('[changeType] suspect function', {changeType: func.changeType})}
|
|
|
</p>
|
|
|
- <ListLink to={functionSummaryView} onClick={handleClickAnalytics}>
|
|
|
- {func.function}
|
|
|
- </ListLink>
|
|
|
+ {rendered}
|
|
|
<TimeDifference difference={func.avgTimeDifference / 1000000} />
|
|
|
</ListItemWrapper>
|
|
|
</li>
|