Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): Bump sentry-javascript to version 8 #3736

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
eb0666d
fix sdk tests
krystofwoldrich Mar 26, 2024
bf541f1
test(errorhandlers): Remove dependencies on JS internal structures, p…
krystofwoldrich Mar 27, 2024
2adc58a
fix lint
krystofwoldrich Mar 27, 2024
8c5f057
Merge branch 'kw-sdk-tests-update' into kw-rn-error-handlers-update-t…
krystofwoldrich Mar 27, 2024
67b61f4
feat(integrations): Update integration to new JS interface
krystofwoldrich Mar 27, 2024
0b291e8
fix(deprecations): Removes all trivial/drop-in-replacement deprecations
krystofwoldrich Mar 27, 2024
0245b9d
wip: Update to JS v8, skip performance, fix error reporting
krystofwoldrich Mar 28, 2024
71c7c3c
Update expo sample to errors only v6
krystofwoldrich Apr 2, 2024
1940f34
Remove old packages from SDK package.json
krystofwoldrich Apr 2, 2024
fd1a90e
fix the encoder polyfill
krystofwoldrich Apr 3, 2024
c7735a2
comment out currently unavailable perf and metric code from sample app
krystofwoldrich Apr 3, 2024
c0c700d
Reenable metric use default core impl
krystofwoldrich Apr 3, 2024
8b75ae7
WIP! upgrade to v8 perf
krystofwoldrich Apr 3, 2024
e29ef63
wip! updating perf integration to be compatible with v8
krystofwoldrich Apr 5, 2024
dd94a23
wip: more fixes
krystofwoldrich Apr 5, 2024
46513eb
more
krystofwoldrich Apr 5, 2024
a669363
working ts/js build - no fixed tests
krystofwoldrich Apr 8, 2024
aae0a52
bump to V8 alpha.9
krystofwoldrich Apr 8, 2024
22b9bb0
add generate new trace id for each navigation
krystofwoldrich Apr 8, 2024
25a5dca
update generate brand new propagation context
krystofwoldrich Apr 8, 2024
8cd182b
fix sample app gesture example span
krystofwoldrich Apr 8, 2024
7e00013
update propagation targets tests for v8
krystofwoldrich Apr 9, 2024
4d5b9ce
update app start tests without routing for v8
krystofwoldrich Apr 9, 2024
cf5a929
fix tx canceled in background
krystofwoldrich Apr 9, 2024
c6cb310
update app start test for v8
krystofwoldrich Apr 9, 2024
22fff5e
fix missing app start for navigation instrumentation transactions
krystofwoldrich Apr 9, 2024
e57ba81
update native frames and ui interactions tests to V8
krystofwoldrich Apr 10, 2024
16353c7
fix react native ui interactions
krystofwoldrich Apr 10, 2024
86dabb0
reenable skipped tests
krystofwoldrich Apr 10, 2024
8f2233d
fix client tests get integration by name
krystofwoldrich Apr 10, 2024
9f504f9
extract test client setup function
krystofwoldrich Apr 10, 2024
37f589e
update tracing extensions tests for V8
krystofwoldrich Apr 10, 2024
55e0c45
Update gestures tests to be compatible with V8
krystofwoldrich Apr 10, 2024
15952ac
Fix V8 gestures to pass tests
krystofwoldrich Apr 10, 2024
75a2fbd
Fix lint misc
krystofwoldrich Apr 10, 2024
e7e5d4a
Merge remote-tracking branch 'origin/main' into kw-upgrade-v8-errors
krystofwoldrich Apr 29, 2024
bdc3010
fix stalltracking tests and span measurements
krystofwoldrich Apr 30, 2024
df81cb1
fix rn client tests
krystofwoldrich Apr 30, 2024
78c4316
Merge remote-tracking branch 'origin/kw-upgrade-v8-errors' into kw-up…
krystofwoldrich Apr 30, 2024
7987bd7
fix cancelSpanInBackground missing subscription
krystofwoldrich May 1, 2024
1249ce0
allow options when init test client
krystofwoldrich May 1, 2024
34266f6
fix reactnativetracing tests
krystofwoldrich May 1, 2024
c497576
fix ttid tests remove reinit of integrations
krystofwoldrich May 2, 2024
a8416e4
fix filtering of back navigations
krystofwoldrich May 2, 2024
9c737e6
fix lint
krystofwoldrich May 2, 2024
5a811e6
fix default op by adding startspan hook
krystofwoldrich May 3, 2024
8533dbb
Use actual client for react native tracing propagation targets tests
krystofwoldrich May 3, 2024
e726ea3
fix profiling tests, remove react nav v4, fix react nav v5 and up
krystofwoldrich May 3, 2024
f40c974
fix last r nav test and lint
krystofwoldrich May 3, 2024
6fc2a06
fix timetodisplay test suite
krystofwoldrich May 5, 2024
79ec233
fix react native navigation tests
krystofwoldrich May 5, 2024
eb36ad0
fix build, remove transaction context
krystofwoldrich May 6, 2024
a0a7419
Merge remote-tracking branch 'origin/main' into kw-upgrade-v8-errors
krystofwoldrich May 7, 2024
bdf385b
fix sample lint
krystofwoldrich May 7, 2024
File filter

Filter by extension

Filter by extension


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

## Unreleased

### Fixes

- CaptureMessage stack-trace is now symbolicated ([#3635](https://github.com/getsentry/sentry-react-native/pull/3635))

### Dependencies

- Bump CLI from v2.30.4 to v2.31.2 ([#3719](https://github.com/getsentry/sentry-react-native/pull/3719))
Expand Down
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"test:watch": "jest --watch",
"run-ios": "cd samples/react-native && yarn react-native run-ios",
"run-android": "cd samples/react-native && yarn react-native run-android",
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/hub @sentry/integrations @sentry/react @sentry/types @sentry/utils",
"yalc:add:sentry-javascript": "yalc add @sentry/browser @sentry/core @sentry/react @sentry/types @sentry/utils",
"set-version-samples": "bash scripts/set-version-samples.sh"
},
"bin": {
Expand All @@ -67,22 +67,20 @@
"react-native": ">=0.65.0"
},
"dependencies": {
"@sentry/browser": "7.113.0",
"@sentry/browser": "8.0.0-alpha.9",
"@sentry/cli": "2.31.2",
"@sentry/core": "7.113.0",
"@sentry/hub": "7.113.0",
"@sentry/integrations": "7.113.0",
"@sentry/react": "7.113.0",
"@sentry/types": "7.113.0",
"@sentry/utils": "7.113.0"
"@sentry/core": "8.0.0-alpha.9",
"@sentry/react": "8.0.0-alpha.9",
"@sentry/types": "8.0.0-alpha.9",
"@sentry/utils": "8.0.0-alpha.9"
},
"devDependencies": {
"@babel/core": "^7.23.5",
"@expo/metro-config": "0.17.5",
"@mswjs/interceptors": "^0.25.15",
"@sentry-internal/eslint-config-sdk": "7.113.0",
"@sentry-internal/eslint-plugin-sdk": "7.113.0",
"@sentry-internal/typescript": "7.113.0",
"@sentry-internal/eslint-config-sdk": "8.0.0-alpha.9",
"@sentry-internal/eslint-plugin-sdk": "8.0.0-alpha.9",
"@sentry-internal/typescript": "8.0.0-alpha.9",
"@sentry/wizard": "3.16.3",
"@types/jest": "^29.5.3",
"@types/node": "^20.9.3",
Expand Down
2 changes: 1 addition & 1 deletion samples/expo/app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function TabOneScreen() {

return (
<View style={styles.container}>
<Sentry.TimeToInitialDisplay record />
{/* <Sentry.TimeToInitialDisplay record /> */}
<Text>Welcome to Sentry Expo Sample App!</Text>
<Button
title="Capture message"
Expand Down
5 changes: 2 additions & 3 deletions samples/expo/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SplashScreen, Stack, useNavigationContainerRef } from 'expo-router';
import { useEffect } from 'react';

import { useColorScheme } from '@/components/useColorScheme';
import { HttpClient } from '@sentry/integrations';
import { httpClientIntegration } from '@sentry/react';
import { SENTRY_INTERNAL_DSN } from '../utils/dsn';
import * as Sentry from '@sentry/react-native';
import { isExpoGo } from '../utils/isExpoGo';
Expand Down Expand Up @@ -41,7 +41,7 @@ process.env.EXPO_SKIP_DURING_EXPORT !== 'true' && Sentry.init({
},
integrations(integrations) {
integrations.push(
new HttpClient({
httpClientIntegration({
// These options are effective only in JS.
// This array can contain tuples of `[begin, end]` (both inclusive),
// Single status codes, or a combinations of both.
Expand All @@ -51,7 +51,6 @@ process.env.EXPO_SKIP_DURING_EXPORT !== 'true' && Sentry.init({
// default: [/.*/]
failedRequestTargets: [/.*/],
}),
Sentry.metrics.metricsAggregatorIntegration(),
new Sentry.ReactNativeTracing({
routingInstrumentation,
}),
Expand Down
2 changes: 1 addition & 1 deletion samples/expo/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ config.watchFolders.push(path.resolve(__dirname, '../../node_modules/@sentry'));
config.watchFolders.push(path.resolve(__dirname, '../../node_modules/@sentry-internal'));
config.watchFolders.push(path.resolve(__dirname, '../../node_modules/tslib'));
config.watchFolders.push(path.resolve(__dirname, '../../node_modules/hoist-non-react-statics'));
config.watchFolders.push(path.resolve(__dirname, '../../node_modules/localforage'));
config.watchFolders.push(path.resolve(__dirname, '../../node_modules/@react-native/js-polyfills'));
config.watchFolders.push(path.resolve(__dirname, '../../node_modules/preact'));
config.watchFolders.push(`${__dirname}/../../dist`);

const exclusionList = [new RegExp(`${__dirname}/../../node_modules/react-native/.*`)];
Expand Down
25 changes: 12 additions & 13 deletions samples/react-native/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ import { store } from './reduxApp';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import GesturesTracingScreen from './Screens/GesturesTracingScreen';
import { Platform, StyleSheet } from 'react-native';
import { HttpClient } from '@sentry/integrations';
import { httpClientIntegration } from '@sentry/react';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { ErrorEvent } from '@sentry/types';

const isMobileOs = Platform.OS === 'android' || Platform.OS === 'ios';

Expand All @@ -39,7 +40,7 @@ Sentry.init({
dsn: SENTRY_INTERNAL_DSN,
debug: true,
environment: 'dev',
beforeSend: (event: Sentry.Event) => {
beforeSend: (event: ErrorEvent) => {
console.log('Event beforeSend:', event.event_id);
return event;
},
Expand All @@ -59,16 +60,16 @@ Sentry.init({
routingInstrumentation: reactNavigationInstrumentation,
enableUserInteractionTracing: true,
ignoreEmptyBackNavigationTransactions: true,
beforeNavigate: (context: Sentry.ReactNavigationTransactionContext) => {
// Example of not sending a transaction for the screen with the name "Manual Tracker"
if (context.data.route.name === 'ManualTracker') {
context.sampled = false;
}
// beforeNavigate: (context: ) => {
// // Example of not sending a transaction for the screen with the name "Manual Tracker"
// // if (context.data.route.name === 'ManualTracker') {
// // context.sampled = false;
// // }

return context;
},
// return context;
// },
}),
new HttpClient({
httpClientIntegration({
// These options are effective only in JS.
// This array can contain tuples of `[begin, end]` (both inclusive),
// Single status codes, or a combinations of both.
Expand All @@ -78,7 +79,6 @@ Sentry.init({
// default: [/.*/]
failedRequestTargets: [/.*/],
}),
Sentry.metrics.metricsAggregatorIntegration(),
);
return integrations.filter(i => i.name !== 'Dedupe');
},
Expand All @@ -87,7 +87,6 @@ Sentry.init({
sessionTrackingIntervalMillis: 5000,
// This will capture ALL TRACES and likely use up all your quota
enableTracing: true,
tracesSampleRate: 1.0,
tracePropagationTargets: ['localhost', /^\//, /^https:\/\//, /^http:\/\//],
attachStacktrace: true,
// Attach screenshots to events.
Expand All @@ -101,7 +100,7 @@ Sentry.init({
// release: '[email protected]+1',
// dist: `1`,
_experiments: {
profilesSampleRate: 1.0,
profilesSampleRate: 0,
},
enableSpotlight: true,
});
Expand Down
8 changes: 4 additions & 4 deletions samples/react-native/src/Screens/GesturesTracingScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import { getCurrentHub, Scope, sentryTraceGesture } from '@sentry/react-native';
import { sentryTraceGesture, startSpanManual } from '@sentry/react-native';
import { Span } from '@sentry/types';

const GesturesTracingScreen = () => {
const gesture = Gesture.Pinch().onBegin(() => {
Expand All @@ -18,10 +19,9 @@ const GesturesTracingScreen = () => {
};

const startExampleSpan = () => {
getCurrentHub().withScope((scope: Scope) => {
const child = scope.getTransaction()?.startChild({ op: 'example' });
startSpanManual({ name: 'Example', op: 'example' }, (span: Span) => {
setTimeout(() => {
child?.finish();
span.end();
}, 1000);
});
};
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-javascript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

tagPrefix=''
repo="https://github.com/getsentry/sentry-javascript.git"
packages=('@sentry/browser' '@sentry/core' '@sentry/hub' '@sentry/integrations' '@sentry/react' '@sentry/types' '@sentry/utils' '@sentry-internal/typescript')
packages=('@sentry/browser' '@sentry/core' '@sentry/react' '@sentry/types' '@sentry/utils' '@sentry-internal/typescript')
packages+=('@sentry-internal/eslint-config-sdk' '@sentry-internal/eslint-plugin-sdk')

. $(dirname "$0")/update-package-json.sh
70 changes: 32 additions & 38 deletions src/js/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import type {
Envelope,
Event,
EventHint,
Exception,
Outcome,
SeverityLevel,
Thread,
TransportMakeRequestResponse,
UserFeedback,
} from '@sentry/types';
import { dateTimestampInSeconds, logger, SentryError } from '@sentry/utils';
Expand All @@ -18,7 +17,7 @@ import { Alert } from 'react-native';
import { createIntegration } from './integrations/factory';
import { defaultSdkInfo } from './integrations/sdkinfo';
import type { ReactNativeClientOptions } from './options';
import { ReactNativeTracing } from './tracing';
import type { ReactNativeTracing } from './tracing';
import { createUserFeedbackEnvelope, items } from './utils/envelope';
import { ignoreRequireCycleLogs } from './utils/ignorerequirecyclelogs';
import { mergeOutcomes } from './utils/outcome';
Expand All @@ -44,7 +43,6 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
super(options);

this._outcomesBuffer = [];
this._initNativeSdk();
}

/**
Expand All @@ -58,22 +56,7 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
* @inheritDoc
*/
public eventFromMessage(message: string, level?: SeverityLevel, hint?: EventHint): PromiseLike<Event> {
return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace).then(
(event: Event) => {
// TMP! Remove this function once JS SDK uses threads for messages
if (!event.exception?.values || event.exception.values.length <= 0) {
return event;
}
const values = event.exception.values.map(
(exception: Exception): Thread => ({
stacktrace: exception.stacktrace,
}),
);
(event as { threads?: { values: Thread[] } }).threads = { values };
delete event.exception;
return event;
},
);
return eventFromMessage(this._options.stackParser, message, level, hint, this._options.attachStacktrace);
}

/**
Expand Down Expand Up @@ -103,29 +86,14 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
dsn: this.getDsn(),
tunnel: undefined,
});
this._sendEnvelope(envelope);
}

/**
* Sets up the integrations
*/
public setupIntegrations(): void {
super.setupIntegrations();
const tracing = this.getIntegration(ReactNativeTracing);
const routingName = tracing?.options.routingInstrumentation?.name;
if (routingName) {
this.addIntegration(createIntegration(routingName));
}
const enableUserInteractionTracing = tracing?.options.enableUserInteractionTracing;
if (enableUserInteractionTracing) {
this.addIntegration(createIntegration('ReactNativeUserInteractionTracing'));
}
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.sendEnvelope(envelope);
}

/**
* @inheritdoc
*/
protected _sendEnvelope(envelope: Envelope): void {
public sendEnvelope(envelope: Envelope): PromiseLike<TransportMakeRequestResponse> {
const outcomes = this._clearOutcomes();
this._outcomesBuffer = mergeOutcomes(this._outcomesBuffer, outcomes);

Expand Down Expand Up @@ -154,6 +122,32 @@ export class ReactNativeClient extends BaseClient<ReactNativeClientOptions> {
if (shouldClearOutcomesBuffer) {
this._outcomesBuffer = []; // if send fails synchronously the _outcomesBuffer will stay intact
}

return Promise.resolve({});
}

/**
* @inheritDoc
*/
public init(): void {
super.init();
this._initNativeSdk();
}

/**
* @inheritdoc
*/
protected _setupIntegrations(): void {
super._setupIntegrations();
const tracing = this.getIntegrationByName<ReactNativeTracing>('ReactNativeTracing');
const routingName = tracing?.options?.routingInstrumentation?.name;
if (routingName) {
this.addIntegration(createIntegration(routingName));
}
const enableUserInteractionTracing = tracing?.options.enableUserInteractionTracing;
if (enableUserInteractionTracing) {
this.addIntegration(createIntegration('ReactNativeUserInteractionTracing'));
}
}

/**
Expand Down