File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 11/* eslint-disable max-lines */ // TODO: We might want to split this file up
22import { EventType , record } from '@sentry-internal/rrweb' ;
3- import { captureException } from '@sentry/core' ;
3+ import { captureException , getCurrentHub } from '@sentry/core' ;
44import type { Breadcrumb , ReplayRecordingMode } from '@sentry/types' ;
55import { logger } from '@sentry/utils' ;
66
@@ -807,9 +807,17 @@ export class ReplayContainer implements ReplayContainerInterface {
807807 } catch ( err ) {
808808 this . _handleException ( err ) ;
809809
810- // This means we retried 3 times, and all of them failed
810+ // This means we retried 3 times and all of them failed,
811+ // or we ran into a problem we don't want to retry, like rate limiting.
811812 // In this case, we want to completely stop the replay - otherwise, we may get inconsistent segments
812813 this . stop ( ) ;
814+
815+ const hub = getCurrentHub ( ) ;
816+ const client = hub . getClient ( ) ;
817+
818+ if ( client ) {
819+ client . recordDroppedEvent ( 'send_error' , 'replay' ) ;
820+ }
813821 }
814822 }
815823
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { logger } from '@sentry/utils';
22
33import { SESSION_IDLE_DURATION } from '../constants' ;
44import type { AddEventResult , RecordingEvent , ReplayContainer } from '../types' ;
5+ import { getCurrentHub } from '@sentry/core' ;
56
67/**
78 * Add an event to the event buffer
@@ -46,5 +47,12 @@ export async function addEvent(
4647 } catch ( error ) {
4748 __DEBUG_BUILD__ && logger . error ( error ) ;
4849 replay . stop ( ) ;
50+
51+ const hub = getCurrentHub ( ) ;
52+ const client = hub . getClient ( ) ;
53+
54+ if ( client ) {
55+ client . recordDroppedEvent ( 'internal_sdk_error' , 'replay' ) ;
56+ }
4957 }
5058}
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ export type EventDropReason =
66 | 'network_error'
77 | 'queue_overflow'
88 | 'ratelimit_backoff'
9- | 'sample_rate' ;
9+ | 'sample_rate'
10+ | 'send_error'
11+ | 'internal_sdk_error' ;
1012
1113export type Outcome = {
1214 reason : EventDropReason ;
You can’t perform that action at this time.
0 commit comments