File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 88
99## Unreleased
1010
11+ ### Features
12+
13+ - Adds support for ` propagateTraceparent ` ([ #5277 ] ( https://github.com/getsentry/sentry-react-native/pull/5227 ) )
14+
1115### Dependencies
1216
1317- Bump JavaScript SDK from v10.18.0 to v10.19.0 ([ #5254 ] ( https://github.com/getsentry/sentry-react-native/pull/5254 ) )
Original file line number Diff line number Diff line change @@ -291,6 +291,20 @@ export interface BaseReactNativeOptions {
291291 * @deprecated This option will be removed in the next major version. Use `beforeSend` instead.
292292 */
293293 useThreadsForMessageStack ?: boolean ;
294+
295+ /**
296+ * If set to `true`, the SDK propagates the W3C `traceparent` header to any outgoing requests,
297+ * in addition to the `sentry-trace` and `baggage` headers. Use the {@link CoreOptions.tracePropagationTargets}
298+ * option to control to which outgoing requests the header will be attached.
299+ *
300+ * **Important:** If you set this option to `true`, make sure that you configured your servers'
301+ * CORS settings to allow the `traceparent` header. Otherwise, requests might get blocked.
302+ *
303+ * @see https://www.w3.org/TR/trace-context/
304+ *
305+ * @default false
306+ */
307+ propagateTraceparent ?: boolean ;
294308}
295309
296310export type SentryReplayQuality = 'low' | 'medium' | 'high' ;
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const DEFAULT_OPTIONS: ReactNativeOptions = {
4545 enableNativeFramesTracking : true ,
4646 enableStallTracking : true ,
4747 enableUserInteractionTracing : false ,
48+ propagateTraceparent : false ,
4849} ;
4950
5051/**
Original file line number Diff line number Diff line change @@ -1156,6 +1156,28 @@ describe('Tests the SDK functionality', () => {
11561156 } ) ,
11571157 ) ;
11581158 } ) ;
1159+
1160+ it ( 'propagateTraceparent is false by default' , ( ) => {
1161+ init ( { } ) ;
1162+
1163+ const actualOptions = usedOptions ( ) ;
1164+ expect ( actualOptions ) . toEqual (
1165+ expect . objectContaining ( {
1166+ propagateTraceparent : false ,
1167+ } ) ,
1168+ ) ;
1169+ } ) ;
1170+
1171+ it ( 'propagateTraceparent is getting passed to the client' , ( ) => {
1172+ init ( { propagateTraceparent : true } ) ;
1173+
1174+ const actualOptions = usedOptions ( ) ;
1175+ expect ( actualOptions ) . toEqual (
1176+ expect . objectContaining ( {
1177+ propagateTraceparent : true ,
1178+ } ) ,
1179+ ) ;
1180+ } ) ;
11591181} ) ;
11601182
11611183function expectIntegration ( name : string ) : void {
You can’t perform that action at this time.
0 commit comments