Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(starfish): Highlight TTFD and link to docs when 0 #59997

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions static/app/views/starfish/views/screens/screensTable.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {Fragment} from 'react';
import {Fragment, useMemo} from 'react';
import * as qs from 'query-string';

import GridEditable, {GridColumnHeader} from 'sentry/components/gridEditable';
import SortLink from 'sentry/components/gridEditable/sortLink';
import ExternalLink from 'sentry/components/links/externalLink';
import Link from 'sentry/components/links/link';
import Pagination from 'sentry/components/pagination';
import {t} from 'sentry/locale';
import {Tooltip} from 'sentry/components/tooltip';
import {t, tct} from 'sentry/locale';
import {
TableData,
TableDataRow,
Expand All @@ -16,6 +18,8 @@ import {getFieldRenderer} from 'sentry/utils/discover/fieldRenderers';
import {fieldAlignment} from 'sentry/utils/discover/fields';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import useProjects from 'sentry/utils/useProjects';
import TopResultsIndicator from 'sentry/views/discover/table/topResultsIndicator';
import {TableColumn} from 'sentry/views/discover/table/types';
import {useReleaseSelection} from 'sentry/views/starfish/queries/useReleases';
Expand All @@ -32,11 +36,20 @@ type Props = {

export function ScreensTable({data, eventView, isLoading, pageLinks}: Props) {
const location = useLocation();
const {selection} = usePageFilters();
const {projects} = useProjects();
const organization = useOrganization();
const {primaryRelease, secondaryRelease} = useReleaseSelection();
const truncatedPrimary = formatVersionAndCenterTruncate(primaryRelease ?? '', 15);
const truncatedSecondary = formatVersionAndCenterTruncate(secondaryRelease ?? '', 15);

const project = useMemo(() => {
if (selection.projects.length !== 1) {
return null;
}
return projects.find(p => p.id === String(selection.projects));
}, [projects, selection.projects]);

const eventViewColumns = eventView.getColumns();

const columnNameMap = {
Expand Down Expand Up @@ -97,6 +110,34 @@ export function ScreensTable({data, eventView, isLoading, pageLinks}: Props) {
organization,
unit: data?.meta.units?.[column.key],
});
if (
column.key.includes('time_to_full_display') &&
row[column.key] === 0 &&
project?.platform &&
['android', 'apple-ios'].includes(project.platform)
) {
const docsUrl =
project?.platform === 'android'
? 'https://docs.sentry.io/platforms/android/performance/instrumentation/automatic-instrumentation/#time-to-full-display'
: 'https://docs.sentry.io/platforms/apple/guides/ios/performance/instrumentation/automatic-instrumentation/#time-to-full-display';
return (
<div style={{textAlign: 'right'}}>
<Tooltip
title={tct(
'Measuring TTFD requires manual instrumentation in your application. To learn how to collect TTFD, see the documentation [link].',
{
link: <ExternalLink href={docsUrl}>{t('here')}</ExternalLink>,
}
)}
showUnderline
isHoverable
>
{rendered}
</Tooltip>
</div>
);
}

return rendered;
}

Expand Down
Loading