Skip to content

Commit

Permalink
Merge c1a2bcd into a766e60
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Oct 6, 2022
2 parents a766e60 + c1a2bcd commit b4d768b
Show file tree
Hide file tree
Showing 166 changed files with 20,428 additions and 57 deletions.
5 changes: 3 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Ignore build generated dir
dist

# Ignore sample folder
# Ignore standalone apps
sample
test/perf/TestApp*

# Ignore dangerfile
dangerfile.js
dangerfile.js
100 changes: 100 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,103 @@ jobs:
path: |
./sample/*.log
./sample/*.png
metrics:
runs-on: macos-latest
strategy:
# we want that the matrix keeps running, default is to cancel them if it fails.
fail-fast: false
matrix:
platform: ["ios", "android"]
include:
- platform: ios
name: iOS
appPlain: test/perf/test-app-plain.ipa
- platform: android
name: Android
appPlain: test/perf/TestAppPlain/android/app/build/outputs/apk/release/app-release.apk
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "12"
- uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
- name: Install Global Dependencies
run: yarn global add react-native-cli @sentry/cli yalc
- uses: actions/cache@v3
id: deps-cache
with:
path: |
node_modules
test/perf/TestAppSentry/node_modules
key: ${{ github.workflow }}-${{ github.job }}-${{ hashFiles('yarn.lock', 'test/perf/TestAppSentry/yarn.lock') }}
- name: Install Dependencies
if: steps.deps-cache.outputs['cache-hit'] != 'true'
run: yarn install
- name: Build SDK
run: yarn build
- name: Package SDK
run: yalc publish
- uses: actions/setup-node@v3
with:
node-version: "16"
- uses: actions/cache@v3
id: app-plain-cache
with:
path: ${{ matrix.appPlain }}
key: ${{ github.workflow }}-${{ github.job }}-appplain-${{ hashFiles('test/perf/TestAppPlain/**') }}
- name: Build app plain
if: steps.app-plain-cache.outputs['cache-hit'] != 'true'
working-directory: ./test/perf/TestAppPlain
run: |
yarn install
cd ${{ matrix.platform }}
if [[ "${{ matrix.platform }}" == "android" ]]; then
./gradlew assembleRelease
else
pod install
cd ../..
fastlane build_perf_test_app_plain
fi
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
- name: Build app with Sentry
working-directory: ./test/perf/TestAppSentry
run: |
yalc add @sentry/react-native
yarn install
cd ${{ matrix.platform }}
if [[ "${{ matrix.platform }}" == "android" ]]; then
./gradlew assembleRelease
else
pod install
cd ../..
fastlane build_perf_test_app_sentry
cd TestAppSentry
fi
# Remove after build so that the cache isn't invaldiated due to the changes in yarn.lock.
yarn remove @sentry/react-native
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_KEY: ${{ secrets.APP_STORE_CONNECT_KEY }}
FASTLANE_KEYCHAIN_PASSWORD: ${{ secrets.FASTLANE_KEYCHAIN_PASSWORD }}
MATCH_GIT_PRIVATE_KEY: ${{ secrets.MATCH_GIT_PRIVATE_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_USERNAME: ${{ secrets.MATCH_USERNAME }}
- name: Collect apps metrics
uses: getsentry/action-app-sdk-overhead-metrics@v1
with:
name: ${{ matrix.name }}
config: ./test/perf/metrics-${{ matrix.platform }}.yml
sauce-user: ${{ secrets.SAUCE_USERNAME }}
sauce-key: ${{ secrets.SAUCE_ACCESS_KEY }}
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ on:
force:
description: Force a release even when there are release-blockers (optional)
required: false
merge_target:
description: Target branch to merge into. Uses the default branch as a fallback (optional)
required: false

jobs:
job_release:
runs-on: ubuntu-latest
name: 'Release a new version'
name: "Release a new version"
steps:
- name: Check out current commit (${{ github.sha }})
uses: actions/checkout@v3
Expand All @@ -28,3 +31,4 @@ jobs:
with:
version: ${{ github.event.inputs.version }}
force: ${{ github.event.inputs.force }}
merge_target: ${{ github.event.inputs.merge_target }}
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## Unreleased
## 5.0.0-alpha.5

### Fixes

Expand Down Expand Up @@ -43,6 +43,14 @@
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7140)
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.13.0...7.14.0)

## 5.0.0-alpha.4

- Latest changes from 4.5.0

### Breaking changes

- New ReactNativeTracingOptions idleTimeoutMs and finalTimeoutMs replacing idleTimeout and maxTransactionDuration respectively ([#2481](https://github.com/getsentry/sentry-react-native/pull/2481))

## 4.5.0

### Features
Expand Down Expand Up @@ -83,6 +91,16 @@
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7251)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.24.1...7.25.1)

## 5.0.0-alpha.3

- Latest changes from 4.3.x

### Dependencies

- Bump Wizard from v2.0.0 to v2.2.0 ([#2460](https://github.com/getsentry/sentry-react-native/pull/2460))
- [changelog](https://github.com/getsentry/sentry-wizard/blob/master/CHANGELOG.md#v220)
- [diff](https://github.com/getsentry/sentry-wizard/compare/v2.0.0...v2.2.0)

## 4.3.0

### Features
Expand All @@ -107,6 +125,16 @@

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

## 5.0.0-alpha.2

- Latest changes from 4.2.x

## 5.0.0-alpha.1

### Fixes

- Auto linking for RN >= 0.69 ([#2332](https://github.com/getsentry/sentry-react-native/pull/2332))

## 4.2.3

### Fixes
Expand Down
20 changes: 7 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@sentry/react-native",
"homepage": "https://github.com/getsentry/sentry-react-native",
"repository": "https://github.com/getsentry/sentry-react-native",
"version": "4.6.0",
"version": "5.0.0-alpha.5",
"description": "Official Sentry SDK for react-native",
"typings": "dist/js/index.d.ts",
"types": "dist/js/index.d.ts",
Expand Down Expand Up @@ -48,13 +48,13 @@
"@sentry/react": "7.14.1",
"@sentry/tracing": "7.14.1",
"@sentry/types": "7.14.1",
"@sentry/utils": "7.14.1",
"@sentry/wizard": "1.2.17"
"@sentry/utils": "7.14.1"
},
"devDependencies": {
"@sentry-internal/eslint-config-sdk": "7.14.1",
"@sentry-internal/eslint-plugin-sdk": "7.14.1",
"@sentry/typescript": "^5.20.1",
"@sentry/wizard": "2.2.0",
"@types/jest": "^26.0.15",
"@types/react": "^16.9.49",
"@types/react-native": "^0.66.11",
Expand All @@ -72,18 +72,12 @@
"typescript": "3.8.3"
},
"rnpm": {
"commands": {
"postlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android",
"postunlink": "node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall"
},
"commands": {},
"android": {
"packageInstance": "new RNSentryPackage()"
"packageInstance": "new RNSentryPackage()",
"packageImportPath": "import io.sentry.react.RNSentryPackage;"
},
"ios": {
"sharedLibraries": [
"libz"
]
}
"ios": {}
},
"jest": {
"collectCoverage": true,
Expand Down
13 changes: 3 additions & 10 deletions react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
module.exports = {
dependency: {
platforms: {
ios: {
sharedLibraries: ['libz']
},
ios: {},
android: {
packageInstance: 'new RNSentryPackage()'
packageInstance: 'new RNSentryPackage()',
packageImportPath: 'import io.sentry.react.RNSentryPackage;'
}
},
hooks: {
postlink:
'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android',
postunlink:
'node node_modules/@sentry/wizard/dist/bin.js -i reactNative -p ios android --uninstall'
}
}
};
42 changes: 33 additions & 9 deletions src/js/tracing/reactnativetracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,34 @@ import {

export interface ReactNativeTracingOptions
extends RequestInstrumentationOptions {
/**
* @deprecated Replaced by idleTimeoutMs
*/
idleTimeout: number;

/**
* @deprecated Replaced by maxTransactionDurationMs
*/
maxTransactionDuration: number;

/**
* The time to wait in ms until the transaction will be finished. The transaction will use the end timestamp of
* the last finished span as the endtime for the transaction.
* Time is in ms.
*
* Default: 1000
*/
idleTimeout: number;
idleTimeoutMs: number;

/**
* The maximum duration of a transaction before it will be marked as "deadline_exceeded".
* The maximum duration (transaction duration + idle timeout) of a transaction
* before it will be marked as "deadline_exceeded".
* If you never want to mark a transaction set it to 0.
* Time is in seconds.
* Time is in ms.
*
* Default: 600
* Default: 600000
*/
maxTransactionDuration: number;
finalTimeoutMs: number;

/**
* The routing instrumentation to be used with the tracing integration.
Expand Down Expand Up @@ -95,6 +106,8 @@ const defaultReactNativeTracingOptions: ReactNativeTracingOptions = {
...defaultRequestInstrumentationOptions,
idleTimeout: 1000,
maxTransactionDuration: 600,
idleTimeoutMs: 1000,
finalTimeoutMs: 600000,
ignoreEmptyBackNavigationTransactions: true,
beforeNavigate: (context) => context,
enableAppStartTracking: true,
Expand Down Expand Up @@ -132,6 +145,17 @@ 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,
};
}

Expand Down Expand Up @@ -349,7 +373,7 @@ export class ReactNativeTracing implements Integration {
}

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

const expandedContext = {
...context,
Expand All @@ -360,8 +384,8 @@ export class ReactNativeTracing implements Integration {
const idleTransaction = startIdleTransaction(
hub as Hub,
expandedContext,
idleTimeout,
maxTransactionDuration * 1000, // convert seconds to milliseconds
idleTimeoutMs,
finalTimeoutMs,
true
);

Expand Down Expand Up @@ -392,7 +416,7 @@ export class ReactNativeTracing implements Integration {
idleTransaction.registerBeforeFinishCallback(
(transaction, endTimestamp) => {
adjustTransactionDuration(
maxTransactionDuration,
finalTimeoutMs,
transaction,
endTimestamp
);
Expand Down
12 changes: 2 additions & 10 deletions src/js/tracing/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,17 @@ export const MARGIN_OF_ERROR_SECONDS = 0.05;

const timeOriginMilliseconds = Date.now();

/**
* Converts from seconds to milliseconds
* @param time time in seconds
*/
function secToMs(time: number): number {
return time * 1000;
}

/**
*
*/
export function adjustTransactionDuration(
maxDuration: number, // in seconds
maxDurationMs: number,
transaction: IdleTransaction,
endTimestamp: number
): void {
const diff = endTimestamp - transaction.startTimestamp;
const isOutdatedTransaction =
endTimestamp && (diff > secToMs(maxDuration) || diff < 0);
endTimestamp && (diff > maxDurationMs || diff < 0);
if (isOutdatedTransaction) {
transaction.setStatus('deadline_exceeded');
transaction.setTag('maxTransactionDurationExceeded', 'true');
Expand Down
2 changes: 1 addition & 1 deletion src/js/version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const SDK_PACKAGE_NAME = 'npm:@sentry/react-native';
export const SDK_NAME = 'sentry.javascript.react-native';
export const SDK_VERSION = '4.6.0';
export const SDK_VERSION = '5.0.0-alpha.5';

0 comments on commit b4d768b

Please sign in to comment.