Skip to content

Commit 1144c95

Browse files
adinauerlcianmarkushi
authored
Add sendDefaultPii=true for Java/Android in getting started docs (#12727)
* Add sendDefaultPii=true for Java/Android in getting started * Apply suggestions from code review Co-authored-by: Lorenzo Cian <[email protected]> * Apply suggestions from code review * update android manual setup page * Apply suggestions from code review Co-authored-by: Markus Hintersteiner <[email protected]> * Update docs/platforms/android/manual-setup/index.mdx --------- Co-authored-by: Lorenzo Cian <[email protected]> Co-authored-by: Markus Hintersteiner <[email protected]>
1 parent 67a1cb4 commit 1144c95

File tree

10 files changed

+89
-10
lines changed

10 files changed

+89
-10
lines changed

docs/platforms/android/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ The wizard will prompt you to log in to Sentry. It'll then automatically do the
7474
Configuration is done via the application `AndroidManifest.xml`. Here's an example config which should get you started:
7575

7676

77-
```xml {filename:AndroidManifest.xml} {"onboardingOptions": {"performance": "4-5", "profiling": "6-7"}}
77+
```xml {filename:AndroidManifest.xml} {"onboardingOptions": {"performance": "6-7", "profiling": "8-9"}}
7878
<application>
7979
<!-- Required: set your sentry.io project identifier (DSN) -->
8080
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />
81+
<!-- 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 -->
82+
<meta-data android:name="io.sentry.send-default-pii" android:value="true" />
8183
<!-- enable the performance API by setting a sample-rate, adjust in production env -->
8284
<meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
8385
<!-- enable profiling when starting transactions, adjust in production env -->

docs/platforms/android/manual-setup/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp
3636
<!-- Required: set your sentry.io project identifier (DSN) -->
3737
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />
3838

39+
<!-- 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 -->
40+
<meta-data android:name="io.sentry.send-default-pii" android:value="true" />
41+
3942
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
4043
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />
4144
<!-- enable screenshot for crashes -->

platform-includes/getting-started-config/java.jul.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ Sentry reads the DSN from the system property `sentry.dsn`, environment variable
3535

3636
```properties {tabTitle:sentry.properties}
3737
dsn=___PUBLIC_DSN___
38+
# Add data like request headers and IP for users,
39+
# see https://docs.sentry.io/platforms/java/guides/jul/data-management/data-collected/ for more info
40+
send-default-pii=true
3841
```
3942
</OnboardingOption>
4043

platform-includes/getting-started-config/java.log4j2.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ Note that **you need to configure your DSN** (client key) only if you wish to in
6666
```
6767

6868
If the DSN is not present in the `log4j2.xml` configuration, Sentry will attempt to read it from the system property `sentry.dsn`, environment variable `SENTRY_DSN` or the `dsn` property in `sentry.properties` file. [See the configuration page](/platforms/java/configuration/) for more details on external configuration.
69+
70+
```properties {tabTitle:sentry.properties}
71+
# Add data like request headers and IP for users,
72+
# see https://docs.sentry.io/platforms/java/guides/log4j2/data-management/data-collected/ for more info
73+
send-default-pii=true
74+
```
6975
</OnboardingOption>
7076

7177
### Minimum Log Level

platform-includes/getting-started-config/java.logback.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se
2323
<options>
2424
<!-- NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard -->
2525
<dsn>___PUBLIC_DSN___</dsn>
26+
<!-- Add data like request headers and IP for users, see https://docs.sentry.io/platforms/java/guides/logback/data-management/data-collected/ for more info -->
27+
<sendDefaultPii>true</sendDefaultPii>
2628
</options>
2729
</appender>
2830

@@ -70,6 +72,8 @@ Note that **you need to configure your DSN** (client key).
7072
<options>
7173
<!-- NOTE: Replace the test DSN below with your DSN to see the events from this app in sentry.io -->
7274
<dsn>___PUBLIC_DSN___</dsn>
75+
<!-- Add data like request headers and IP for users, see https://docs.sentry.io/platforms/java/guides/logback/data-management/data-collected/ for more info -->
76+
<sendDefaultPii>true</sendDefaultPii>
7377
</options>
7478
</appender>
7579
```
@@ -99,6 +103,8 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi
99103
<options>
100104
<!-- NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard -->
101105
<dsn>___PUBLIC_DSN___</dsn>
106+
<!-- Add data like request headers and IP for users, see https://docs.sentry.io/platforms/java/guides/logback/data-management/data-collected/ for more info -->
107+
<sendDefaultPii>true</sendDefaultPii>
102108
</options>
103109
<!-- Optionally change minimum Event level. Default for Events is ERROR -->
104110
<minimumEventLevel>WARN</minimumEventLevel>

platform-includes/getting-started-config/java.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
<OnboardingOption optionId="opentelemetry" hideForThisOption>
22
Configuration should happen as early as possible in your application's lifecycle.
33

4-
```java {tabTitle: Java} {"onboardingOptions": {"performance": "5-9"}}
4+
```java {tabTitle: Java} {"onboardingOptions": {"performance": "9-13"}}
55
import io.sentry.Sentry;
66

77
Sentry.init(options -> {
88
options.setDsn("___PUBLIC_DSN___");
99

10+
// Add data like request headers and IP for users,
11+
// see https://docs.sentry.io/platforms/java/data-management/data-collected/ for more info
12+
options.setSendDefaultPii(true);
13+
1014
// Set traces_sample_rate to 1.0 to capture 100%
1115
// of transactions for tracing.
1216
// We recommend adjusting this value in production.
1317
options.setTracesSampleRate(1.0);
1418
});
1519
```
1620

17-
```kotlin {tabTitle: Kotlin} {"onboardingOptions": {"performance": "5-9"}}
21+
```kotlin {tabTitle: Kotlin} {"onboardingOptions": {"performance": "9-13"}}
1822
import io.sentry.Sentry
1923

2024
Sentry.init { options ->
2125
options.dsn = "___PUBLIC_DSN___"
2226

27+
// Add data like request headers and IP for users,
28+
// see https://docs.sentry.io/platforms/java/data-management/data-collected/ for more info
29+
options.isSendDefaultPii = true
30+
2331
// Set traces_sample_rate to 1.0 to capture 100%
2432
// of transactions for tracing.
2533
// We recommend adjusting this value in production.

platform-includes/getting-started-config/java.servlet.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ public final class SentryInitializer implements ServletContainerInitializer {
1818
public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException {
1919
Sentry.init(options -> {
2020
options.setDsn("___PUBLIC_DSN___");
21+
22+
// Add data like request headers and IP for users,
23+
// see https://docs.sentry.io/platforms/java/guides/servlet/data-management/data-collected/ for more info
24+
options.setSendDefaultPii(true);
2125
});
2226
}
2327
}
@@ -35,6 +39,10 @@ class SentryInitializer : ServletContainerInitializer {
3539
override fun onStartup(c: Set<Class<*>?>?, ctx: ServletContext) {
3640
Sentry.init { options ->
3741
options.dsn = "___PUBLIC_DSN___"
42+
43+
// Add data like request headers and IP for users,
44+
// see https://docs.sentry.io/platforms/java/guides/servlet/data-management/data-collected/ for more info
45+
options.isSendDefaultPii = true
3846
}
3947
}
4048
}

platform-includes/getting-started-config/java.spring-boot.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,27 @@ Sentry's Spring Boot integration auto-configures `sentry.in-app-packages` proper
33
Provide a `sentry.dsn` property using either `application.properties` or `application.yml`:
44

55

6-
```properties {filename:application.properties} {"onboardingOptions": {"performance": "2-6"}}
6+
```properties {filename:application.properties} {"onboardingOptions": {"performance": "6-10"}}
77
sentry.dsn=___PUBLIC_DSN___
88

9+
# Add data like request headers and IP for users,
10+
# see https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ for more info
11+
sentry.send-default-pii=true
12+
913
# Set traces_sample_rate to 1.0 to capture 100%
1014
# of transactions for tracing.
1115
# We recommend adjusting this value in production.
1216
sentry.traces-sample-rate=1.0
1317
```
1418

15-
```yaml {filename:application.yml} {"onboardingOptions": {"performance": "3-7"}}
19+
```yaml {filename:application.yml} {"onboardingOptions": {"performance": "7-11"}}
1620
sentry:
1721
dsn: ___PUBLIC_DSN___
1822

23+
# Add data like request headers and IP for users,
24+
# see https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ for more info
25+
send-default-pii: true
26+
1927
# Set traces_sample_rate to 1.0 to capture 100%
2028
# of transactions for tracing.
2129
# We recommend adjusting this value in production.

platform-includes/getting-started-config/java.spring.mdx

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ The `sentry-spring` and `sentry-spring-jakarta` libraries provide an `@EnableSen
77
import io.sentry.spring.EnableSentry;
88
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
99
// project/dashboard
10-
@EnableSentry(dsn = "___PUBLIC_DSN___")
10+
@EnableSentry(
11+
dsn = "___PUBLIC_DSN___",
12+
// Add data like request headers and IP for users,
13+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
14+
sendDefaultPii = true
15+
)
1116
@Configuration
1217
class SentryConfiguration {
1318
}
@@ -17,7 +22,12 @@ class SentryConfiguration {
1722
import io.sentry.spring.jakarta.EnableSentry;
1823
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
1924
// project/dashboard
20-
@EnableSentry(dsn = "___PUBLIC_DSN___")
25+
@EnableSentry(
26+
dsn = "___PUBLIC_DSN___",
27+
// Add data like request headers and IP for users,
28+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
29+
sendDefaultPii = true
30+
)
2131
@Configuration
2232
class SentryConfiguration {
2333
}
@@ -27,7 +37,12 @@ class SentryConfiguration {
2737
import io.sentry.spring.EnableSentry
2838
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
2939
// project/dashboard
30-
@EnableSentry(dsn = "___PUBLIC_DSN___")
40+
@EnableSentry(
41+
dsn = "___PUBLIC_DSN___",
42+
// Add data like request headers and IP for users,
43+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
44+
sendDefaultPii = true
45+
)
3146
@Configuration
3247
class SentryConfiguration
3348
```
@@ -36,7 +51,12 @@ class SentryConfiguration
3651
import io.sentry.spring.jakarta.EnableSentry
3752
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
3853
// project/dashboard
39-
@EnableSentry(dsn = "___PUBLIC_DSN___")
54+
@EnableSentry(
55+
dsn = "___PUBLIC_DSN___",
56+
// Add data like request headers and IP for users,
57+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
58+
sendDefaultPii = true
59+
)
4060
@Configuration
4161
class SentryConfiguration
4262
```
@@ -55,6 +75,9 @@ import org.springframework.core.Ordered;
5575
// project/dashboard
5676
@EnableSentry(
5777
dsn = "___PUBLIC_DSN___",
78+
// Add data like request headers and IP for users,
79+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
80+
sendDefaultPii = true,
5881
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
5982
)
6083
class SentryConfiguration {
@@ -68,6 +91,9 @@ import org.springframework.core.Ordered;
6891
// project/dashboard
6992
@EnableSentry(
7093
dsn = "___PUBLIC_DSN___",
94+
// Add data like request headers and IP for users,
95+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
96+
sendDefaultPii = true,
7197
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
7298
)
7399
class SentryConfiguration {
@@ -81,6 +107,9 @@ import org.springframework.core.Ordered
81107
// project/dashboard
82108
@EnableSentry(
83109
dsn = "___PUBLIC_DSN___",
110+
// Add data like request headers and IP for users,
111+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
112+
sendDefaultPii = true,
84113
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
85114
)
86115
class SentryConfiguration
@@ -93,6 +122,9 @@ import org.springframework.core.Ordered
93122
// project/dashboard
94123
@EnableSentry(
95124
dsn = "___PUBLIC_DSN___",
125+
// Add data like request headers and IP for users,
126+
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
127+
sendDefaultPii = true,
96128
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
97129
)
98130
class SentryConfiguration

platform-includes/getting-started-config/opentelemetry/java.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
The SDK can be configured using a `sentry.properties` file:
44

5-
```properties {filename:sentry.properties} {"onboardingOptions": {"performance": "2-2"}}
5+
```properties {filename:sentry.properties} {"onboardingOptions": {"performance": "5-5"}}
66
dsn=___PUBLIC_DSN___
7+
# Add data like request headers and IP for users,
8+
# see https://docs.sentry.io/platforms/java/data-management/data-collected/ for more info
9+
send-default-pii=true
710
traces-sample-rate=1.0
811
```
912
</OnboardingOption>

0 commit comments

Comments
 (0)