@@ -10,6 +10,7 @@ import {
1010 Outcome ,
1111 SessionStatus ,
1212 Severity ,
13+ Transport ,
1314} from '@sentry/types' ;
1415import {
1516 dateTimestampInSeconds ,
@@ -182,13 +183,19 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
182183 return this . _options ;
183184 }
184185
186+ /**
187+ * @inheritDoc
188+ */
189+ public getTransport ( ) : Transport {
190+ return this . getTransport ( ) ;
191+ }
192+
185193 /**
186194 * @inheritDoc
187195 */
188196 public flush ( timeout ?: number ) : PromiseLike < boolean > {
189197 return this . _isClientDoneProcessing ( timeout ) . then ( clientFinished => {
190- return this . _getBackend ( )
191- . getTransport ( )
198+ return this . getTransport ( )
192199 . close ( timeout )
193200 . then ( transportFlushed => clientFinished && transportFlushed ) ;
194201 } ) ;
@@ -499,7 +506,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
499506 protected _processEvent ( event : Event , hint ?: EventHint , scope ?: Scope ) : PromiseLike < Event > {
500507 // eslint-disable-next-line @typescript-eslint/unbound-method
501508 const { beforeSend, sampleRate } = this . getOptions ( ) ;
502- const transport = this . _getBackend ( ) . getTransport ( ) ;
509+ const transport = this . getTransport ( ) ;
503510
504511 if ( ! this . _isEnabled ( ) ) {
505512 return SyncPromise . reject ( new SentryError ( 'SDK not enabled, will not capture event.' ) ) ;
@@ -510,7 +517,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
510517 // 0.0 === 0% events are sent
511518 // Sampling for transaction happens somewhere else
512519 if ( ! isTransaction && typeof sampleRate === 'number' && Math . random ( ) > sampleRate ) {
513- transport . recordLostEvent ?.( Outcome . SampleRate ) ;
520+ transport . recordLostEvent ?.( Outcome . SampleRate , 'event' ) ;
514521 return SyncPromise . reject (
515522 new SentryError (
516523 `Discarding event because it's not included in the random sample (sampling rate = ${ sampleRate } )` ,
@@ -521,7 +528,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
521528 return this . _prepareEvent ( event , scope , hint )
522529 . then ( prepared => {
523530 if ( prepared === null ) {
524- transport . recordLostEvent ?.( Outcome . EventProcessor ) ;
531+ transport . recordLostEvent ?.( Outcome . EventProcessor , event . type || 'event' ) ;
525532 throw new SentryError ( 'An event processor returned null, will not send event.' ) ;
526533 }
527534
@@ -535,7 +542,7 @@ export abstract class BaseClient<B extends Backend, O extends Options> implement
535542 } )
536543 . then ( processedEvent => {
537544 if ( processedEvent === null ) {
538- transport . recordLostEvent ?.( Outcome . BeforeSend ) ;
545+ transport . recordLostEvent ?.( Outcome . BeforeSend , event . type || 'event' ) ;
539546 throw new SentryError ( '`beforeSend` returned `null`, will not send event.' ) ;
540547 }
541548
0 commit comments