@@ -216,8 +216,11 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
216
216
217
217
const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
218
218
const capturedSpanScope : Scope | undefined = sdkProcessingMetadata . capturedSpanScope ;
219
+ const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
219
220
220
- this . _process ( this . _captureEvent ( event , hintWithEventId , capturedSpanScope || currentScope ) ) ;
221
+ this . _process (
222
+ this . _captureEvent ( event , hintWithEventId , capturedSpanScope || currentScope , capturedSpanIsolationScope ) ,
223
+ ) ;
221
224
222
225
return hintWithEventId . event_id ;
223
226
}
@@ -676,8 +679,8 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
676
679
protected _prepareEvent (
677
680
event : Event ,
678
681
hint : EventHint ,
679
- currentScope = getCurrentScope ( ) ,
680
- isolationScope = getIsolationScope ( ) ,
682
+ currentScope : Scope ,
683
+ isolationScope : Scope ,
681
684
) : PromiseLike < Event | null > {
682
685
const options = this . getOptions ( ) ;
683
686
const integrations = Object . keys ( this . _integrations ) ;
@@ -718,12 +721,17 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
718
721
* @param hint
719
722
* @param scope
720
723
*/
721
- protected _captureEvent ( event : Event , hint : EventHint = { } , scope ?: Scope ) : PromiseLike < string | undefined > {
724
+ protected _captureEvent (
725
+ event : Event ,
726
+ hint : EventHint = { } ,
727
+ currentScope = getCurrentScope ( ) ,
728
+ isolationScope = getIsolationScope ( ) ,
729
+ ) : PromiseLike < string | undefined > {
722
730
if ( DEBUG_BUILD && isErrorEvent ( event ) ) {
723
731
logger . log ( `Captured error event \`${ getPossibleEventMessages ( event ) [ 0 ] || '<unknown>' } \`` ) ;
724
732
}
725
733
726
- return this . _processEvent ( event , hint , scope ) . then (
734
+ return this . _processEvent ( event , hint , currentScope , isolationScope ) . then (
727
735
finalEvent => {
728
736
return finalEvent . event_id ;
729
737
} ,
@@ -756,7 +764,12 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
756
764
* @param currentScope A scope containing event metadata.
757
765
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
758
766
*/
759
- protected _processEvent ( event : Event , hint : EventHint , currentScope ?: Scope ) : PromiseLike < Event > {
767
+ protected _processEvent (
768
+ event : Event ,
769
+ hint : EventHint ,
770
+ currentScope : Scope ,
771
+ isolationScope : Scope ,
772
+ ) : PromiseLike < Event > {
760
773
const options = this . getOptions ( ) ;
761
774
const { sampleRate } = options ;
762
775
@@ -779,12 +792,9 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
779
792
) ;
780
793
}
781
794
782
- const dataCategory : DataCategory = eventType === 'replay_event' ? 'replay' : eventType ;
783
-
784
- const sdkProcessingMetadata = event . sdkProcessingMetadata || { } ;
785
- const capturedSpanIsolationScope : Scope | undefined = sdkProcessingMetadata . capturedSpanIsolationScope ;
795
+ const dataCategory = ( eventType === 'replay_event' ? 'replay' : eventType ) satisfies DataCategory ;
786
796
787
- return this . _prepareEvent ( event , hint , currentScope , capturedSpanIsolationScope )
797
+ return this . _prepareEvent ( event , hint , currentScope , isolationScope )
788
798
. then ( prepared => {
789
799
if ( prepared === null ) {
790
800
this . recordDroppedEvent ( 'event_processor' , dataCategory , event ) ;
@@ -811,7 +821,7 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
811
821
throw new SentryError ( `${ beforeSendLabel } returned \`null\`, will not send event.` , 'log' ) ;
812
822
}
813
823
814
- const session = currentScope && currentScope . getSession ( ) ;
824
+ const session = currentScope . getSession ( ) || isolationScope . getSession ( ) ;
815
825
if ( ! isTransaction && session ) {
816
826
this . _updateSessionFromEvent ( session , processedEvent ) ;
817
827
}
0 commit comments