Skip to content

Commit

Permalink
fix(tracing): Ignore defaults when warning about duplicate definition…
Browse files Browse the repository at this point in the history
… of trace propagation targets
  • Loading branch information
krystofwoldrich committed Oct 6, 2023
1 parent 5af0e04 commit d599fd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
### Fixes

- Change log output to show what paths are considered when collecting modules ([#3316](https://github.com/getsentry/sentry-react-native/pull/3316))
- Ignore defaults when warning about duplicate definition of trace propagation targets ([#3327](https://github.com/getsentry/sentry-react-native/pull/3327))

### Dependencies

Expand Down
13 changes: 12 additions & 1 deletion src/js/tracing/reactnativetracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,19 @@ export class ReactNativeTracing implements Integration {
private _awaitingAppStartData?: NativeAppStartResponse;
private _appStartFinishTimestamp?: number;
private _currentRoute?: string;
private _hasSetTracePropagationTargets: boolean;

public constructor(options: Partial<ReactNativeTracingOptions> = {}) {
this._hasSetTracePropagationTargets = false;

if (__DEV__) {
this._hasSetTracePropagationTargets = !!(
options &&
// eslint-disable-next-line deprecation/deprecation
(options.tracePropagationTargets || options.tracingOrigins)
);
}

this.options = {
...defaultReactNativeTracingOptions,
...options,
Expand Down Expand Up @@ -193,7 +204,7 @@ export class ReactNativeTracing implements Integration {
//
// If both 1 and either one of 2 or 3 are set (from above), we log out a warning.
const tracePropagationTargets = clientOptionsTracePropagationTargets || thisOptionsTracePropagationTargets;
if (__DEV__ && (thisOptionsTracePropagationTargets || tracingOrigins) && clientOptionsTracePropagationTargets) {
if (__DEV__ && this._hasSetTracePropagationTargets && clientOptionsTracePropagationTargets) {
logger.warn(
'[ReactNativeTracing] The `tracePropagationTargets` option was set in the ReactNativeTracing integration and top level `Sentry.init`. The top level `Sentry.init` value is being used.',
);
Expand Down

0 comments on commit d599fd1

Please sign in to comment.