Skip to content

Commit

Permalink
misc(tracing): Remove ReactNativeTracing deprecated options
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Aug 6, 2024
1 parent 89b2354 commit 4f3ca7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 63 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Changes

- Removed deprecated ReactNativeTracing option `idleTimeout` use `idleTimeoutMs` instead([#3998](https://github.com/getsentry/sentry-react-native/pull/3998))
- Removed deprecated ReactNativeTracing option `maxTransactionDuration` use `finalTimeoutMs` instead([#3998](https://github.com/getsentry/sentry-react-native/pull/3998))
- New Native Frames Integration ([#3996](https://github.com/getsentry/sentry-react-native/pull/3996))
- New Stall Tracking Integration ([#3997](https://github.com/getsentry/sentry-react-native/pull/3997))
- New App Start Integration ([#3852](https://github.com/getsentry/sentry-react-native/pull/3852))
Expand Down
17 changes: 2 additions & 15 deletions src/js/tracing/reactnativetracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ const DEFAULT_TRACE_PROPAGATION_TARGETS = ['localhost', /^\/(?!\/)/];

const defaultReactNativeTracingOptions: ReactNativeTracingOptions = {

Check failure on line 99 in src/js/tracing/reactnativetracing.ts

View workflow job for this annotation

GitHub Actions / Build

Type '{ idleTimeoutMs: number; finalTimeoutMs: number; ignoreEmptyBackNavigationTransactions: true; beforeNavigate: (context: Span) => Span; enableUserInteractionTracing: false; tracePropagationTargets?: (string | RegExp)[]; traceFetch: boolean; traceXHR: boolean; enableHTTPTimings: boolean; shouldCreateSpanForRequest?(this: void, url: string): boolean; }' is missing the following properties from type 'ReactNativeTracingOptions': idleTimeout, maxTransactionDuration
...defaultRequestInstrumentationOptions,
idleTimeout: 1000,
maxTransactionDuration: 600,
idleTimeoutMs: 1000,
finalTimeoutMs: 600000,
ignoreEmptyBackNavigationTransactions: true,
Expand Down Expand Up @@ -143,19 +141,8 @@ export class ReactNativeTracing implements Integration {
this.options = {
...defaultReactNativeTracingOptions,
...options,
finalTimeoutMs:
options.finalTimeoutMs ??
// eslint-disable-next-line deprecation/deprecation
(typeof options.maxTransactionDuration === 'number'
? // eslint-disable-next-line deprecation/deprecation
options.maxTransactionDuration * 1000
: undefined) ??
defaultReactNativeTracingOptions.finalTimeoutMs,
idleTimeoutMs:
options.idleTimeoutMs ??
// eslint-disable-next-line deprecation/deprecation
options.idleTimeout ??
defaultReactNativeTracingOptions.idleTimeoutMs,
finalTimeoutMs: options.finalTimeoutMs ?? defaultReactNativeTracingOptions.finalTimeoutMs,
idleTimeoutMs: options.idleTimeoutMs ?? defaultReactNativeTracingOptions.idleTimeoutMs,
};
}

Expand Down
48 changes: 0 additions & 48 deletions test/tracing/reactnativetracing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,54 +292,6 @@ describe('ReactNativeTracing', () => {
});
});
});
describe('Handling deprecated options', () => {
test('finalTimeoutMs overrides maxTransactionDuration', () => {
const tracing = new ReactNativeTracing({
finalTimeoutMs: 123000,
maxTransactionDuration: 456,
});
expect(tracing.options.finalTimeoutMs).toBe(123000);
// eslint-disable-next-line deprecation/deprecation
expect(tracing.options.maxTransactionDuration).toBe(456);
});
test('maxTransactionDuration translates to finalTimeoutMs', () => {
const tracing = new ReactNativeTracing({
maxTransactionDuration: 123,
});
expect(tracing.options.finalTimeoutMs).toBe(123000);
// eslint-disable-next-line deprecation/deprecation
expect(tracing.options.maxTransactionDuration).toBe(123);
});
test('if none maxTransactionDuration and finalTimeoutMs is specified use default', () => {
const tracing = new ReactNativeTracing({});
expect(tracing.options.finalTimeoutMs).toBe(600000);
// eslint-disable-next-line deprecation/deprecation
expect(tracing.options.maxTransactionDuration).toBe(600);
});
test('idleTimeoutMs overrides idleTimeout', () => {
const tracing = new ReactNativeTracing({
idleTimeoutMs: 123,
idleTimeout: 456,
});
expect(tracing.options.idleTimeoutMs).toBe(123);
// eslint-disable-next-line deprecation/deprecation
expect(tracing.options.idleTimeout).toBe(456);
});
test('idleTimeout translates to idleTimeoutMs', () => {
const tracing = new ReactNativeTracing({
idleTimeout: 123,
});
expect(tracing.options.idleTimeoutMs).toBe(123);
// eslint-disable-next-line deprecation/deprecation
expect(tracing.options.idleTimeout).toBe(123);
});
test('if none idleTimeout and idleTimeoutMs is specified use default', () => {
const tracing = new ReactNativeTracing({});
expect(tracing.options.idleTimeoutMs).toBe(1000);
// eslint-disable-next-line deprecation/deprecation
expect(tracing.options.idleTimeout).toBe(1000);
});
});

describe('User Interaction Tracing', () => {
let client: TestClient;
Expand Down

0 comments on commit 4f3ca7b

Please sign in to comment.