Skip to content

Commit d04218b

Browse files
ref(replay): add logging for timeout on frontend for replay summaries (#103280)
add Sentry logging on frontend when replay summary polling times out.
1 parent c6f99bc commit d04218b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

static/app/views/replays/detail/ai/useReplaySummary.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {useCallback, useEffect, useRef, useState} from 'react';
2+
import * as Sentry from '@sentry/react';
23

34
import type {ApiQueryKey, UseApiQueryOptions} from 'sentry/utils/queryClient';
45
import {useApiQuery, useMutation, useQueryClient} from 'sentry/utils/queryClient';
@@ -18,6 +19,9 @@ const ERROR_POLL_INTERVAL_MS = 5000;
1819
const START_TIMEOUT_MS = 15_000; // Max time to wait for processing to start after a start request.
1920
const TOTAL_TIMEOUT_MS = 100_000; // Max time to wait for results after a start request. Task timeout in Seer (90s) + 10s buffer.
2021

22+
function logReplaySummaryTimeout({extra}: {extra: Record<string, string>}) {
23+
Sentry.logger.info('Replay summary poll timed out', extra);
24+
}
2125
export interface UseReplaySummaryResult {
2226
/**
2327
* Whether there was an error with the initial query or summary generation,
@@ -97,6 +101,14 @@ export function useReplaySummary(
97101
timeMs: TOTAL_TIMEOUT_MS,
98102
onTimeout: () => {
99103
setDidTimeout(true);
104+
logReplaySummaryTimeout({
105+
extra: {
106+
reason: 'Total timeout',
107+
orgSlug: organization.slug,
108+
replayId: replayRecord?.id ?? '',
109+
segmentCount: segmentCount.toString(),
110+
},
111+
});
100112
},
101113
});
102114

@@ -105,6 +117,14 @@ export function useReplaySummary(
105117
onTimeout: () => {
106118
setDidTimeout(true);
107119
cancelTotalTimeout();
120+
logReplaySummaryTimeout({
121+
extra: {
122+
reason: 'Start timeout',
123+
orgSlug: organization.slug,
124+
replayId: replayRecord?.id ?? '',
125+
segmentCount: segmentCount.toString(),
126+
},
127+
});
108128
},
109129
});
110130

0 commit comments

Comments
 (0)