Skip to content

Commit 7a0443d

Browse files
authored
feat(Mobile): adds sendDefaultPii to Mobile wizards (#981)
* removes copied-in review comment * adds sendDefaultPii for RN snippets * adds sendDefaultPii for Flutter snippets * adds sendDefaultPii for RN snippets (fix tests) * adds sendDefaultPii for Android snippets * adds sendDefaultPii for Apple snippets * adds changelog * fix expo e2e test * review changes
1 parent ffc3e1c commit 7a0443d

File tree

11 files changed

+90
-1
lines changed

11 files changed

+90
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- fix(apple): add support for synchronized Xcode folders ([#904](https://github.com/getsentry/sentry-wizard/pull/904))
66
- feat(react-native): Add Feedback Widget step ([#969](https://github.com/getsentry/sentry-wizard/pull/969))
77
- feat(react-native): More granular error reporting for RN Wizard ([#861](https://github.com/getsentry/sentry-wizard/pull/861))
8+
- feat(Mobile): add `sendDefaultPii=true` to Mobile wizards ([#981](https://github.com/getsentry/sentry-wizard/pull/981))
89

910
## 4.8.0
1011

e2e-tests/tests/expo.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ describe('Expo', () => {
7070
Sentry.init({
7171
dsn: 'https://public@dsn.ingest.sentry.io/1337',
7272
73+
// Adds more context data to events (IP address, cookies, user, etc.)
74+
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
75+
sendDefaultPii: true,
76+
7377
// Configure Session Replay
7478
replaysSessionSampleRate: 0.1,
7579
replaysOnErrorSampleRate: 1,

e2e-tests/tests/react-native.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ describe('ReactNative', () => {
102102
Sentry.init({
103103
dsn: 'https://public@dsn.ingest.sentry.io/1337',
104104
105+
// Adds more context data to events (IP address, cookies, user, etc.)
106+
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
107+
sendDefaultPii: true,
108+
105109
// Configure Session Replay
106110
replaysSessionSampleRate: 0.1,
107111
replaysOnErrorSampleRate: 1,

src/android/templates.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export const pluginKts = (version = '3.12.0') => `
2323
export const manifest = (dsn: string) => `
2424
<!-- Required: set your sentry.io project identifier (DSN) -->
2525
<meta-data android:name="io.sentry.dsn" android:value="${dsn}" />
26+
<!-- Add data like request headers, user ip address and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->
27+
<meta-data android:name="io.sentry.send-default-pii" android:value="true" />
2628
2729
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
2830
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />

src/apple/templates.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export function getSwiftSnippet(dsn: string): string {
2020
return ` SentrySDK.start { options in
2121
options.dsn = "${dsn}"
2222
options.debug = true // Enabled debug when first installing is always helpful
23+
24+
// Adds IP for users.
25+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
26+
options.sendDefaultPii = true
27+
2328
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
2429
// We recommend adjusting this value in production.
2530
options.tracesSampleRate = 1.0
@@ -42,6 +47,11 @@ export function getObjcSnippet(dsn: string): string {
4247
return ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {
4348
options.dsn = @"${dsn}";
4449
options.debug = YES; // Enabled debug when first installing is always helpful
50+
51+
// Adds IP for users.
52+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
53+
options.sendDefaultPii = YES;
54+
4555
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
4656
// We recommend adjusting this value in production.
4757
options.tracesSampleRate = @1.0;

src/flutter/templates.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ export function initSnippet(
2525
): string {
2626
let snippet = `await SentryFlutter.init(
2727
(options) {
28-
options.dsn = '${dsn}';`;
28+
options.dsn = '${dsn}';
29+
// Adds request headers and IP for users, for more info visit:
30+
// https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/
31+
options.sendDefaultPii = true;`;
2932

3033
if (selectedFeaturesMap.tracing) {
3134
snippet += `
@@ -77,6 +80,9 @@ Future<void>main() async {
7780
await SentryFlutter.init(
7881
(options) {
7982
options.dsn = '${dsn}';
83+
// Adds request headers and IP for users, for more info visit:
84+
// https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/
85+
options.sendDefaultPii = true;
8086
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
8187
// We recommend adjusting this value in production.
8288
options.tracesSampleRate = 1.0;

src/react-native/javascript.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ export function getSentryInitPlainTextSnippet(
141141
142142
Sentry.init({
143143
dsn: '${dsn}',
144+
145+
// Adds more context data to events (IP address, cookies, user, etc.)
146+
// For more information, visit: https://docs.sentry.io/platforms/react-native/data-management/data-collected/
147+
sendDefaultPii: true,
144148
${
145149
enableSessionReplay
146150
? `

test/apple/code-tools.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
3535
SentrySDK.start { options in
3636
options.dsn = "https://example.com/sentry-dsn"
3737
options.debug = true // Enabled debug when first installing is always helpful
38+
39+
// Adds IP for users.
40+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
41+
options.sendDefaultPii = true
42+
3843
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
3944
// We recommend adjusting this value in production.
4045
options.tracesSampleRate = 1.0
@@ -89,6 +94,11 @@ const validAppDelegateObjCWithSentry = `@import Sentry;
8994
[SentrySDK startWithConfigureOptions:^(SentryOptions * options) {
9095
options.dsn = @"https://example.com/sentry-dsn";
9196
options.debug = YES; // Enabled debug when first installing is always helpful
97+
98+
// Adds IP for users.
99+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
100+
options.sendDefaultPii = YES;
101+
92102
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
93103
// We recommend adjusting this value in production.
94104
options.tracesSampleRate = @1.0;
@@ -139,6 +149,11 @@ struct TestApp: App {
139149
SentrySDK.start { options in
140150
options.dsn = "https://example.com/sentry-dsn"
141151
options.debug = true // Enabled debug when first installing is always helpful
152+
153+
// Adds IP for users.
154+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
155+
options.sendDefaultPii = true
156+
142157
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
143158
// We recommend adjusting this value in production.
144159
options.tracesSampleRate = 1.0

test/apple/templates.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ fi
126126
` SentrySDK.start { options in
127127
options.dsn = "test-dsn"
128128
options.debug = true // Enabled debug when first installing is always helpful
129+
130+
// Adds IP for users.
131+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
132+
options.sendDefaultPii = true
133+
129134
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
130135
// We recommend adjusting this value in production.
131136
options.tracesSampleRate = 1.0
@@ -157,6 +162,11 @@ fi
157162
` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {
158163
options.dsn = @"test-dsn";
159164
options.debug = YES; // Enabled debug when first installing is always helpful
165+
166+
// Adds IP for users.
167+
// For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
168+
options.sendDefaultPii = YES;
169+
160170
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
161171
// We recommend adjusting this value in production.
162172
options.tracesSampleRate = @1.0;

test/flutter/templates.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ describe('Flutter code templates', () => {
3939
"await SentryFlutter.init(
4040
(options) {
4141
options.dsn = 'my-dsn';
42+
// Adds request headers and IP for users, for more info visit:
43+
// https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/
44+
options.sendDefaultPii = true;
4245
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
4346
// We recommend adjusting this value in production.
4447
options.tracesSampleRate = 1.0;
@@ -66,6 +69,9 @@ describe('Flutter code templates', () => {
6669
"await SentryFlutter.init(
6770
(options) {
6871
options.dsn = 'my-dsn';
72+
// Adds request headers and IP for users, for more info visit:
73+
// https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/
74+
options.sendDefaultPii = true;
6975
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
7076
// We recommend adjusting this value in production.
7177
options.tracesSampleRate = 1.0;
@@ -90,6 +96,9 @@ describe('Flutter code templates', () => {
9096
"await SentryFlutter.init(
9197
(options) {
9298
options.dsn = 'my-dsn';
99+
// Adds request headers and IP for users, for more info visit:
100+
// https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/
101+
options.sendDefaultPii = true;
93102
},
94103
appRunner: () => runApp(SentryWidget(child: const MyApp())),
95104
);

0 commit comments

Comments
 (0)