Skip to content

Commit 2a133c2

Browse files
authored
Merge c0d52bf into 5636309
2 parents 5636309 + c0d52bf commit 2a133c2

File tree

166 files changed

+20427
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+20427
-56
lines changed

.eslintignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Ignore build generated dir
22
dist
33

4-
# Ignore sample folder
4+
# Ignore standalone apps
55
sample
6+
test/perf/TestApp*
67

78
# Ignore dangerfile
8-
dangerfile.js
9+
dangerfile.js

.github/workflows/e2e.yml

+100
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,103 @@ jobs:
140140
path: |
141141
./sample/*.log
142142
./sample/*.png
143+
144+
metrics:
145+
runs-on: macos-latest
146+
strategy:
147+
# we want that the matrix keeps running, default is to cancel them if it fails.
148+
fail-fast: false
149+
matrix:
150+
platform: ["ios", "android"]
151+
include:
152+
- platform: ios
153+
name: iOS
154+
appPlain: test/perf/test-app-plain.ipa
155+
- platform: android
156+
name: Android
157+
appPlain: test/perf/TestAppPlain/android/app/build/outputs/apk/release/app-release.apk
158+
steps:
159+
- uses: actions/checkout@v3
160+
- uses: actions/setup-node@v3
161+
with:
162+
node-version: "12"
163+
- uses: actions/setup-java@v3
164+
with:
165+
java-version: "11"
166+
distribution: "adopt"
167+
- name: Install Global Dependencies
168+
run: yarn global add react-native-cli @sentry/cli yalc
169+
- uses: actions/cache@v3
170+
id: deps-cache
171+
with:
172+
path: |
173+
node_modules
174+
test/perf/TestAppSentry/node_modules
175+
key: ${{ github.workflow }}-${{ github.job }}-${{ hashFiles('yarn.lock', 'test/perf/TestAppSentry/yarn.lock') }}
176+
- name: Install Dependencies
177+
if: steps.deps-cache.outputs['cache-hit'] != 'true'
178+
run: yarn install
179+
- name: Build SDK
180+
run: yarn build
181+
- name: Package SDK
182+
run: yalc publish
183+
- uses: actions/setup-node@v3
184+
with:
185+
node-version: "16"
186+
- uses: actions/cache@v3
187+
id: app-plain-cache
188+
with:
189+
path: ${{ matrix.appPlain }}
190+
key: ${{ github.workflow }}-${{ github.job }}-appplain-${{ hashFiles('test/perf/TestAppPlain/**') }}
191+
- name: Build app plain
192+
if: steps.app-plain-cache.outputs['cache-hit'] != 'true'
193+
working-directory: ./test/perf/TestAppPlain
194+
run: |
195+
yarn install
196+
cd ${{ matrix.platform }}
197+
if [[ "${{ matrix.platform }}" == "android" ]]; then
198+
./gradlew assembleRelease
199+
else
200+
pod install
201+
cd ../..
202+
fastlane build_perf_test_app_plain
203+
fi
204+
env:
205+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
206+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
207+
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
208+
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
209+
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
210+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
211+
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
212+
- name: Build app with Sentry
213+
working-directory: ./test/perf/TestAppSentry
214+
run: |
215+
yalc add @sentry/react-native
216+
yarn install
217+
cd ${{ matrix.platform }}
218+
if [[ "${{ matrix.platform }}" == "android" ]]; then
219+
./gradlew assembleRelease
220+
else
221+
pod install
222+
cd ../..
223+
fastlane build_perf_test_app_sentry
224+
cd TestAppSentry
225+
fi
226+
# Remove after build so that the cache isn't invaldiated due to the changes in yarn.lock.
227+
yarn remove @sentry/react-native
228+
env:
229+
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
230+
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
231+
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
232+
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
233+
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
234+
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
235+
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
236+
- name: Collect apps metrics
237+
uses: getsentry/action-app-sdk-overhead-metrics@v1
238+
with:
239+
name: ${{ matrix.name }}
240+
config: ./test/perf/metrics-${{ matrix.platform }}.yml
241+
sauce-user: ${{ secrets.SAUCE_USERNAME }}
242+
sauce-key: ${{ secrets.SAUCE_ACCESS_KEY }}

.github/workflows/release.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ on:
88
force:
99
description: Force a release even when there are release-blockers (optional)
1010
required: false
11+
merge_target:
12+
description: Target branch to merge into. Uses the default branch as a fallback (optional)
13+
required: false
1114

1215
jobs:
1316
job_release:
1417
runs-on: ubuntu-latest
15-
name: 'Release a new version'
18+
name: "Release a new version"
1619
steps:
1720
- name: Check out current commit (${{ github.sha }})
1821
uses: actions/checkout@v3
@@ -28,3 +31,4 @@ jobs:
2831
with:
2932
version: ${{ github.event.inputs.version }}
3033
force: ${{ github.event.inputs.force }}
34+
merge_target: ${{ github.event.inputs.merge_target }}

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7140)
4343
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.13.0...7.14.0)
4444

45+
## 5.0.0-alpha.4
46+
47+
- Latest changes from 4.5.0
48+
49+
### Breaking changes
50+
51+
- New ReactNativeTracingOptions idleTimeoutMs and finalTimeoutMs replacing idleTimeout and maxTransactionDuration respectively ([#2481](https://github.com/getsentry/sentry-react-native/pull/2481))
52+
4553
## 4.5.0
4654

4755
### Features
@@ -82,6 +90,16 @@
8290
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7251)
8391
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.24.1...7.25.1)
8492

93+
## 5.0.0-alpha.3
94+
95+
- Latest changes from 4.3.x
96+
97+
### Dependencies
98+
99+
- Bump Wizard from v2.0.0 to v2.2.0 ([#2460](https://github.com/getsentry/sentry-react-native/pull/2460))
100+
- [changelog](https://github.com/getsentry/sentry-wizard/blob/master/CHANGELOG.md#v220)
101+
- [diff](https://github.com/getsentry/sentry-wizard/compare/v2.0.0...v2.2.0)
102+
85103
## 4.3.0
86104

87105
### Features
@@ -106,6 +124,16 @@
106124

107125
- ReactNativeTracing wrongly marks transactions as deadline_exceeded when it reaches the idleTimeout ([#2427](https://github.com/getsentry/sentry-react-native/pull/2427))
108126

127+
## 5.0.0-alpha.2
128+
129+
- Latest changes from 4.2.x
130+
131+
## 5.0.0-alpha.1
132+
133+
### Fixes
134+
135+
- Auto linking for RN >= 0.69 ([#2332](https://github.com/getsentry/sentry-react-native/pull/2332))
136+
109137
## 4.2.3
110138

111139
### Fixes

package.json

+7-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@sentry/react-native",
33
"homepage": "https://github.com/getsentry/sentry-react-native",
44
"repository": "https://github.com/getsentry/sentry-react-native",
5-
"version": "4.6.0",
5+
"version": "5.0.0-alpha.4",
66
"description": "Official Sentry SDK for react-native",
77
"typings": "dist/js/index.d.ts",
88
"types": "dist/js/index.d.ts",
@@ -48,13 +48,13 @@
4848
"@sentry/react": "7.14.1",
4949
"@sentry/tracing": "7.14.1",
5050
"@sentry/types": "7.14.1",
51-
"@sentry/utils": "7.14.1",
52-
"@sentry/wizard": "1.2.17"
51+
"@sentry/utils": "7.14.1"
5352
},
5453
"devDependencies": {
5554
"@sentry-internal/eslint-config-sdk": "7.14.1",
5655
"@sentry-internal/eslint-plugin-sdk": "7.14.1",
5756
"@sentry/typescript": "^5.20.1",
57+
"@sentry/wizard": "2.2.0",
5858
"@types/jest": "^26.0.15",
5959
"@types/react": "^16.9.49",
6060
"@types/react-native": "^0.66.11",
@@ -72,18 +72,12 @@
7272
"typescript": "3.8.3"
7373
},
7474
"rnpm": {
75-
"commands": {
76-
"postlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android",
77-
"postunlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall"
78-
},
75+
"commands": {},
7976
"android": {
80-
"packageInstance": "new RNSentryPackage()"
77+
"packageInstance": "new RNSentryPackage()",
78+
"packageImportPath": "import io.sentry.react.RNSentryPackage;"
8179
},
82-
"ios": {
83-
"sharedLibraries": [
84-
"libz"
85-
]
86-
}
80+
"ios": {}
8781
},
8882
"jest": {
8983
"collectCoverage": true,

react-native.config.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
module.exports = {
22
dependency: {
33
platforms: {
4-
ios: {
5-
sharedLibraries: ['libz']
6-
},
4+
ios: {},
75
android: {
8-
packageInstance: 'new RNSentryPackage()'
6+
packageInstance: 'new RNSentryPackage()',
7+
packageImportPath: 'import io.sentry.react.RNSentryPackage;'
98
}
10-
},
11-
hooks: {
12-
postlink:
13-
'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android',
14-
postunlink:
15-
'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall'
169
}
1710
}
1811
};

src/js/tracing/reactnativetracing.ts

+33-9
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,34 @@ import {
3030

3131
export interface ReactNativeTracingOptions
3232
extends RequestInstrumentationOptions {
33+
/**
34+
* @deprecated Replaced by idleTimeoutMs
35+
*/
36+
idleTimeout: number;
37+
38+
/**
39+
* @deprecated Replaced by maxTransactionDurationMs
40+
*/
41+
maxTransactionDuration: number;
42+
3343
/**
3444
* The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of
3545
* the last finished span as the endtime for the transaction.
3646
* Time is in ms.
3747
*
3848
* Default: 1000
3949
*/
40-
idleTimeout: number;
50+
idleTimeoutMs: number;
4151

4252
/**
43-
* The maximum duration of a transaction before it will be marked as "deadline_exceeded".
53+
* The maximum duration (transaction duration + idle timeout) of a transaction
54+
* before it will be marked as "deadline_exceeded".
4455
* If you never want to mark a transaction set it to 0.
45-
* Time is in seconds.
56+
* Time is in ms.
4657
*
47-
* Default: 600
58+
* Default: 600000
4859
*/
49-
maxTransactionDuration: number;
60+
finalTimeoutMs: number;
5061

5162
/**
5263
* The routing instrumentation to be used with the tracing integration.
@@ -95,6 +106,8 @@ const defaultReactNativeTracingOptions: ReactNativeTracingOptions = {
95106
...defaultRequestInstrumentationOptions,
96107
idleTimeout: 1000,
97108
maxTransactionDuration: 600,
109+
idleTimeoutMs: 1000,
110+
finalTimeoutMs: 600000,
98111
ignoreEmptyBackNavigationTransactions: true,
99112
beforeNavigate: (context) => context,
100113
enableAppStartTracking: true,
@@ -132,6 +145,17 @@ export class ReactNativeTracing implements Integration {
132145
this.options = {
133146
...defaultReactNativeTracingOptions,
134147
...options,
148+
finalTimeoutMs: options.finalTimeoutMs
149+
// eslint-disable-next-line deprecation/deprecation
150+
?? (typeof options.maxTransactionDuration === 'number'
151+
// eslint-disable-next-line deprecation/deprecation
152+
? options.maxTransactionDuration * 1000
153+
: undefined)
154+
?? defaultReactNativeTracingOptions.finalTimeoutMs,
155+
idleTimeoutMs: options.idleTimeoutMs
156+
// eslint-disable-next-line deprecation/deprecation
157+
?? options.idleTimeout
158+
?? defaultReactNativeTracingOptions.idleTimeoutMs,
135159
};
136160
}
137161

@@ -349,7 +373,7 @@ export class ReactNativeTracing implements Integration {
349373
}
350374

351375
// eslint-disable-next-line @typescript-eslint/unbound-method
352-
const { idleTimeout, maxTransactionDuration } = this.options;
376+
const { idleTimeoutMs, finalTimeoutMs } = this.options;
353377

354378
const expandedContext = {
355379
...context,
@@ -360,8 +384,8 @@ export class ReactNativeTracing implements Integration {
360384
const idleTransaction = startIdleTransaction(
361385
hub as Hub,
362386
expandedContext,
363-
idleTimeout,
364-
maxTransactionDuration * 1000, // convert seconds to milliseconds
387+
idleTimeoutMs,
388+
finalTimeoutMs,
365389
true
366390
);
367391

@@ -392,7 +416,7 @@ export class ReactNativeTracing implements Integration {
392416
idleTransaction.registerBeforeFinishCallback(
393417
(transaction, endTimestamp) => {
394418
adjustTransactionDuration(
395-
maxTransactionDuration,
419+
finalTimeoutMs,
396420
transaction,
397421
endTimestamp
398422
);

src/js/tracing/utils.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,17 @@ export const MARGIN_OF_ERROR_SECONDS = 0.05;
2929

3030
const timeOriginMilliseconds = Date.now();
3131

32-
/**
33-
* Converts from seconds to milliseconds
34-
* @param time time in seconds
35-
*/
36-
function secToMs(time: number): number {
37-
return time * 1000;
38-
}
39-
4032
/**
4133
*
4234
*/
4335
export function adjustTransactionDuration(
44-
maxDuration: number, // in seconds
36+
maxDurationMs: number,
4537
transaction: IdleTransaction,
4638
endTimestamp: number
4739
): void {
4840
const diff = endTimestamp - transaction.startTimestamp;
4941
const isOutdatedTransaction =
50-
endTimestamp && (diff > secToMs(maxDuration) || diff < 0);
42+
endTimestamp && (diff > maxDurationMs || diff < 0);
5143
if (isOutdatedTransaction) {
5244
transaction.setStatus('deadline_exceeded');
5345
transaction.setTag('maxTransactionDurationExceeded', 'true');

src/js/version.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
22
export const SDK_NAME = 'sentry.javascript.react-native';
3-
export const SDK_VERSION = '4.6.0';
3+
export const SDK_VERSION = '5.0.0-alpha.4';

test/perf/TestAppPlain/.buckconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

test/perf/TestAppPlain/.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

0 commit comments

Comments
 (0)