Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
## Unreleased

### Features

- Adds support for `propagateTraceparent` ([#5277](https://github.com/getsentry/sentry-react-native/pull/5227))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Though obvious could add a short example in the changelog similar to other features (example)


### Dependencies

- Bump JavaScript SDK from v10.18.0 to v10.19.0 ([#5254](https://github.com/getsentry/sentry-react-native/pull/5254))
Expand Down
14 changes: 14 additions & 0 deletions packages/core/src/js/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,20 @@ export interface BaseReactNativeOptions {
* @deprecated This option will be removed in the next major version. Use `beforeSend` instead.
*/
useThreadsForMessageStack?: boolean;

/**
* If set to `true`, the SDK propagates the W3C `traceparent` header to any outgoing requests,
* in addition to the `sentry-trace` and `baggage` headers. Use the {@link CoreOptions.tracePropagationTargets}
* option to control to which outgoing requests the header will be attached.
*
* **Important:** If you set this option to `true`, make sure that you configured your servers'
* CORS settings to allow the `traceparent` header. Otherwise, requests might get blocked.
*
* @see https://www.w3.org/TR/trace-context/
*
* @default false
*/
propagateTraceparent?: boolean;
}

export type SentryReplayQuality = 'low' | 'medium' | 'high';
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/js/sdk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const DEFAULT_OPTIONS: ReactNativeOptions = {
enableNativeFramesTracking: true,
enableStallTracking: true,
enableUserInteractionTracing: false,
propagateTraceparent: false,
};

/**
Expand Down
22 changes: 22 additions & 0 deletions packages/core/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,28 @@ describe('Tests the SDK functionality', () => {
}),
);
});

it('propagateTraceparent is false by default', () => {
init({});

const actualOptions = usedOptions();
expect(actualOptions).toEqual(
expect.objectContaining({
propagateTraceparent: false,
}),
);
});

it('propagateTraceparent is getting passed to the client', () => {
init({ propagateTraceparent: true });

const actualOptions = usedOptions();
expect(actualOptions).toEqual(
expect.objectContaining({
propagateTraceparent: true,
}),
);
});
});

function expectIntegration(name: string): void {
Expand Down
Loading