Skip to content

Commit f8a4e2d

Browse files
ref(replay): add logging for timeout on frontend for replay summaries
1 parent 45569f3 commit f8a4e2d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 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,11 @@ 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', {
24+
extra,
25+
});
26+
}
2127
export interface UseReplaySummaryResult {
2228
/**
2329
* Whether there was an error with the initial query or summary generation,
@@ -97,6 +103,14 @@ export function useReplaySummary(
97103
timeMs: TOTAL_TIMEOUT_MS,
98104
onTimeout: () => {
99105
setDidTimeout(true);
106+
logReplaySummaryTimeout({
107+
extra: {
108+
reason: 'Total timeout',
109+
orgSlug: organization.slug,
110+
replayId: replayRecord?.id ?? '',
111+
segmentCount: segmentCount.toString(),
112+
},
113+
});
100114
},
101115
});
102116

@@ -105,6 +119,14 @@ export function useReplaySummary(
105119
onTimeout: () => {
106120
setDidTimeout(true);
107121
cancelTotalTimeout();
122+
logReplaySummaryTimeout({
123+
extra: {
124+
reason: 'Start timeout',
125+
orgSlug: organization.slug,
126+
replayId: replayRecord?.id ?? '',
127+
segmentCount: segmentCount.toString(),
128+
},
129+
});
108130
},
109131
});
110132

0 commit comments

Comments
 (0)