File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
packages/tracing-internal Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,9 @@ export class BrowserTracing implements Integration {
214
214
*/
215
215
public setupOnce ( _ : ( callback : EventProcessor ) => void , getCurrentHub : ( ) => Hub ) : void {
216
216
this . _getCurrentHub = getCurrentHub ;
217
+ const hub = getCurrentHub ( ) ;
218
+ const client = hub . getClient ( ) ;
219
+ const clientOptions = client && client . getOptions ( ) ;
217
220
218
221
const {
219
222
routingInstrumentation : instrumentRouting ,
@@ -222,11 +225,13 @@ export class BrowserTracing implements Integration {
222
225
markBackgroundTransactions,
223
226
traceFetch,
224
227
traceXHR,
225
- tracePropagationTargets,
226
228
shouldCreateSpanForRequest,
227
229
_experiments,
228
230
} = this . options ;
229
231
232
+ const tracePropagationTargets =
233
+ ( clientOptions && clientOptions . tracePropagationTargets ) || this . options . tracePropagationTargets ;
234
+
230
235
instrumentRouting (
231
236
( context : TransactionContext ) => {
232
237
const transaction = this . _createRouteTransaction ( context ) ;
Original file line number Diff line number Diff line change @@ -250,6 +250,22 @@ describe('BrowserTracing', () => {
250
250
tracePropagationTargets : [ 'something' ] ,
251
251
} ) ;
252
252
} ) ;
253
+
254
+ it ( 'uses `tracePropagationTargets` set by client over integration set targets' , ( ) => {
255
+ jest . clearAllMocks ( ) ;
256
+ hub . getClient ( ) ! . getOptions ( ) . tracePropagationTargets = [ 'something-else' ] ;
257
+ const sampleTracePropagationTargets = [ 'something' ] ;
258
+ createBrowserTracing ( true , {
259
+ routingInstrumentation : customInstrumentRouting ,
260
+ tracePropagationTargets : sampleTracePropagationTargets ,
261
+ } ) ;
262
+
263
+ expect ( instrumentOutgoingRequestsMock ) . toHaveBeenCalledWith ( {
264
+ traceFetch : true ,
265
+ traceXHR : true ,
266
+ tracePropagationTargets : [ 'something-else' ] ,
267
+ } ) ;
268
+ } ) ;
253
269
} ) ;
254
270
255
271
describe ( 'beforeNavigate' , ( ) => {
You can’t perform that action at this time.
0 commit comments