Skip to content

Commit f5ac0e0

Browse files
authored
Merge pull request #20 from thinkocapo/new-fingerprints
Fingerprint Update and Environmental Variable SE
2 parents 6c369bd + 6152ebd commit f5ac0e0

File tree

7 files changed

+65
-13
lines changed

7 files changed

+65
-13
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ buck-out/
5757

5858
# CocoaPods
5959
/ios/Pods/
60+
61+
.env

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ From our [documentation](https://docs.sentry.io/platforms/react-native/), the fo
4444
5. If you don't have cocoapods or get an error about cocopods out of date, run `gem install cocoapods`
4545
6. `npm install`
4646
7. `cd ios && pod install`
47+
8. Optional - Create a .env file in project root and add `SE=<value>`
4748

4849
Don't forget to bump your release version depending on platform
4950
iOS: `Info.plist` `CFBundleShortVersionString`
@@ -84,10 +85,9 @@ EmpowerPlant | Checkout
8485
:-------------------------:|:-------------------------:
8586
![list of tools](./img/toolstore.png) | ![checkout cart](./img/cart.png)|
8687

87-
## Upgrade path
88-
1. npm install, then `pod update` if `pod install` is failing. The pod updating depends on node_modules/@sentry/react-native being set.
89-
2. SDK Manager -> install 'emulator' or anything missing
90-
3. Review previous PR so you know what to expect
88+
## Upgrade SDK path
89+
1. npm install, then `cd ios && pod update` if `pod install` is failing. The pod updating depends on node_modules/@sentry/react-native being set.
90+
2. Review previous PR so you know what to expect.
9191

9292
## Troubleshooting
9393

babel.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3+
plugins: [
4+
['module:react-native-dotenv', {
5+
'moduleName': '@env',
6+
'path': '.env',
7+
'blacklist': null,
8+
'whitelist': null,
9+
'safe': false,
10+
'allowUndefined': true
11+
}]
12+
]
313
};

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ SPEC CHECKSUMS:
408408
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
409409
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
410410
FBLazyVector: 49cbe4b43e445b06bf29199b6ad2057649e4c8f5
411-
FBReactNativeSpec: 324e70dddca47678fc467ab220389cd966de7954
411+
FBReactNativeSpec: f21132940a8f408886313ded89588b774fbec4b7
412412
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
413413
RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c
414414
RCTRequired: 2f8cb5b7533219bf4218a045f92768129cf7050a
@@ -444,4 +444,4 @@ SPEC CHECKSUMS:
444444

445445
PODFILE CHECKSUM: 79ce1c465caba661d8abf443587400c2a48c5974
446446

447-
COCOAPODS: 1.11.2
447+
COCOAPODS: 1.10.1

package-lock.json

Lines changed: 30 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@sentry/react-native": "3.2.0",
1818
"react": "17.0.1",
1919
"react-native": "0.64.0",
20+
"react-native-dotenv": "^3.3.1",
2021
"react-native-gesture-handler": "^1.7.0",
2122
"react-native-linear-gradient": "^2.5.6",
2223
"react-native-reanimated": "^1.13.0",

src/App.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import Toast from 'react-native-toast-message';
2222

2323
import {store} from './reduxApp';
2424
import {DSN} from './config';
25+
import {SE} from '@env'; // SE is undefined if no .env file is set
2526

2627
const reactNavigationV5Instrumentation = new Sentry.ReactNavigationV5Instrumentation(
2728
{
@@ -30,11 +31,21 @@ const reactNavigationV5Instrumentation = new Sentry.ReactNavigationV5Instrumenta
3031
},
3132
);
3233

34+
// Get app version from package.json, for fingerprinting
35+
const packageJson = require('../package.json');
36+
3337
Sentry.init({
3438
dsn: DSN,
3539
environment: "dev",
36-
beforeSend: (e) => {
37-
return e;
40+
beforeSend: (event) => {
41+
if (SE === "tda") {
42+
// Make issues unique to the release (app version) for Release Health
43+
event.fingerprint = ['{{ default }}', SE, packageJson.version ];
44+
} else if (SE) {
45+
// Make issue for the SE
46+
event.fingerprint = ['{{ default }}', SE ];
47+
}
48+
return event;
3849
},
3950
integrations: [
4051
new Sentry.ReactNativeTracing({
@@ -52,11 +63,13 @@ Sentry.init({
5263
],
5364
tracesSampleRate: 1.0,
5465
enableAutoSessionTracking: true, // For testing, session close when 5 seconds (instead of the default 30) in the background.
55-
sessionTrackingIntervalMillis: 5000,
66+
sessionTrackingIntervalMillis: 5000,
5667
maxBreadcrumbs: 150, // Extend from the default 100 breadcrumbs.
5768
// debug: true
5869
});
5970

71+
Sentry.setTag('se', SE);
72+
6073
const Stack = createStackNavigator();
6174

6275
const App = () => {

0 commit comments

Comments
 (0)