Skip to content

Commit 15774d2

Browse files
Abdkhan14Abdullah Khan
and
Abdullah Khan
authored
feat(new-trace): Updating empty state copy (#87217)
Traces can take longer to ingest than spans, we could click on the id of a span and be navigated to a trace that doesn't contain any data yet. We add a 2 minute buffer to account for this. Added test. --------- Co-authored-by: Abdullah Khan <[email protected]>
1 parent b9dea2b commit 15774d2

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

static/app/views/performance/newTraceDetails/trace.spec.tsx

+38-2
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,12 @@ describe('trace view', () => {
909909
expect(await screen.findByText(/we failed to load your trace/i)).toBeInTheDocument();
910910
});
911911

912-
it('renders empty state', async () => {
912+
it('renders empty state for successfully ingested trace', async () => {
913+
// set timestamp to 3 minutes ago
914+
const threeMinutesAgoInSeconds = Math.floor(
915+
new Date(Date.now() - 3 * 60 * 1000).getTime() / 1000
916+
);
917+
913918
mockPerformanceSubscriptionDetailsResponse();
914919
mockTraceResponse({
915920
body: {
@@ -921,12 +926,43 @@ describe('trace view', () => {
921926
mockTraceTagsResponse();
922927
mockEventsResponse();
923928

924-
render(<TraceView />, {router});
929+
window.location.search = `?timestamp=${threeMinutesAgoInSeconds.toString()}`;
930+
render(<TraceView />, {
931+
router,
932+
});
925933
expect(
926934
await screen.findByText(/trace does not contain any data/i)
927935
).toBeInTheDocument();
928936
});
929937

938+
it('renders empty state for yet to be ingested trace', async () => {
939+
// set timestamp to 1 minute ago
940+
const oneMinuteAgoInSeconds = Math.floor(
941+
new Date(Date.now() - 1 * 60 * 1000).getTime() / 1000
942+
);
943+
944+
mockPerformanceSubscriptionDetailsResponse();
945+
mockTraceResponse({
946+
body: {
947+
transactions: [],
948+
orphan_errors: [],
949+
},
950+
});
951+
mockTraceMetaResponse();
952+
mockTraceTagsResponse();
953+
mockEventsResponse();
954+
955+
window.location.search = `?timestamp=${oneMinuteAgoInSeconds.toString()}`;
956+
render(<TraceView />, {
957+
router,
958+
});
959+
expect(
960+
await screen.findByText(
961+
/We could still be ingesting this trace. Please wait a few seconds and refresh./i
962+
)
963+
).toBeInTheDocument();
964+
});
965+
930966
describe('pageload', () => {
931967
it('scrolls to trace root', async () => {
932968
mockQueryString('?node=trace-root');

static/app/views/performance/newTraceDetails/traceWaterfallState.tsx

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styled from '@emotion/styled';
44
import useFeedbackWidget from 'sentry/components/feedback/widget/useFeedbackWidget';
55
import LoadingIndicator from 'sentry/components/loadingIndicator';
66
import {t} from 'sentry/locale';
7+
import {useTraceQueryParams} from 'sentry/views/performance/newTraceDetails/useTraceQueryParams';
78

89
function TraceLoading() {
910
return (
@@ -43,9 +44,22 @@ function TraceEmpty() {
4344
const linkref = useRef<HTMLAnchorElement>(null);
4445
const feedback = useFeedbackWidget({buttonRef: linkref});
4546

47+
const traceQueryParams = useTraceQueryParams();
48+
const timestamp = traceQueryParams.timestamp;
49+
50+
// Traces take longer to ingest than spans, we could click on the id of a span
51+
// and be navigated to a trace that doesn't contain any data yet. We add a 2
52+
// minute buffer to account for this.
53+
const message =
54+
timestamp && new Date(timestamp * 1000) >= new Date(Date.now() - 2 * 60 * 1000)
55+
? t(
56+
'We could still be ingesting this trace. Please wait a few seconds and refresh.'
57+
)
58+
: t('This trace does not contain any data.');
59+
4660
return (
4761
<LoadingContainer animate>
48-
<div>{t('This trace does not contain any data?!')}</div>
62+
<div>{message}</div>
4963
<div>
5064
{t('Seeing this often? Send us ')}
5165
{feedback ? (

0 commit comments

Comments
 (0)