Skip to content

Commit

Permalink
Add sendDefaultPii=true for Java/Android in getting started docs (#…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
3 people authored Feb 17, 2025
1 parent 67a1cb4 commit 1144c95
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 10 deletions.
4 changes: 3 additions & 1 deletion docs/platforms/android/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ The wizard will prompt you to log in to Sentry. It'll then automatically do the
Configuration is done via the application `AndroidManifest.xml`. Here's an example config which should get you started:


```xml {filename:AndroidManifest.xml} {"onboardingOptions": {"performance": "4-5", "profiling": "6-7"}}
```xml {filename:AndroidManifest.xml} {"onboardingOptions": {"performance": "6-7", "profiling": "8-9"}}
<application>
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />
<!-- 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 -->
<meta-data android:name="io.sentry.send-default-pii" android:value="true" />
<!-- enable the performance API by setting a sample-rate, adjust in production env -->
<meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
<!-- enable profiling when starting transactions, adjust in production env -->
Expand Down
3 changes: 3 additions & 0 deletions docs/platforms/android/manual-setup/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />

<!-- 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 -->
<meta-data android:name="io.sentry.send-default-pii" android:value="true" />

<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />
<!-- enable screenshot for crashes -->
Expand Down
3 changes: 3 additions & 0 deletions platform-includes/getting-started-config/java.jul.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Sentry reads the DSN from the system property `sentry.dsn`, environment variable

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

Expand Down
6 changes: 6 additions & 0 deletions platform-includes/getting-started-config/java.log4j2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ Note that **you need to configure your DSN** (client key) only if you wish to in
```

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.

```properties {tabTitle:sentry.properties}
# Add data like request headers and IP for users,
# see https://docs.sentry.io/platforms/java/guides/log4j2/data-management/data-collected/ for more info
send-default-pii=true
```
</OnboardingOption>

### Minimum Log Level
Expand Down
6 changes: 6 additions & 0 deletions platform-includes/getting-started-config/java.logback.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ The `ConsoleAppender` is provided only as an example of a non-Sentry appender se
<options>
<!-- NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard -->
<dsn>___PUBLIC_DSN___</dsn>
<!-- 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 -->
<sendDefaultPii>true</sendDefaultPii>
</options>
</appender>

Expand Down Expand Up @@ -70,6 +72,8 @@ Note that **you need to configure your DSN** (client key).
<options>
<!-- NOTE: Replace the test DSN below with your DSN to see the events from this app in sentry.io -->
<dsn>___PUBLIC_DSN___</dsn>
<!-- 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 -->
<sendDefaultPii>true</sendDefaultPii>
</options>
</appender>
```
Expand Down Expand Up @@ -99,6 +103,8 @@ Breadcrumbs are kept in memory (by default the last 100 records) and are sent wi
<options>
<!-- NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry project/dashboard -->
<dsn>___PUBLIC_DSN___</dsn>
<!-- 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 -->
<sendDefaultPii>true</sendDefaultPii>
</options>
<!-- Optionally change minimum Event level. Default for Events is ERROR -->
<minimumEventLevel>WARN</minimumEventLevel>
Expand Down
12 changes: 10 additions & 2 deletions platform-includes/getting-started-config/java.mdx
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
<OnboardingOption optionId="opentelemetry" hideForThisOption>
Configuration should happen as early as possible in your application's lifecycle.

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

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

// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/data-management/data-collected/ for more info
options.setSendDefaultPii(true);

// Set traces_sample_rate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production.
options.setTracesSampleRate(1.0);
});
```

```kotlin {tabTitle: Kotlin} {"onboardingOptions": {"performance": "5-9"}}
```kotlin {tabTitle: Kotlin} {"onboardingOptions": {"performance": "9-13"}}
import io.sentry.Sentry

Sentry.init { options ->
options.dsn = "___PUBLIC_DSN___"

// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/data-management/data-collected/ for more info
options.isSendDefaultPii = true

// Set traces_sample_rate to 1.0 to capture 100%
// of transactions for tracing.
// We recommend adjusting this value in production.
Expand Down
8 changes: 8 additions & 0 deletions platform-includes/getting-started-config/java.servlet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ public final class SentryInitializer implements ServletContainerInitializer {
public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException {
Sentry.init(options -> {
options.setDsn("___PUBLIC_DSN___");

// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/servlet/data-management/data-collected/ for more info
options.setSendDefaultPii(true);
});
}
}
Expand All @@ -35,6 +39,10 @@ class SentryInitializer : ServletContainerInitializer {
override fun onStartup(c: Set<Class<*>?>?, ctx: ServletContext) {
Sentry.init { options ->
options.dsn = "___PUBLIC_DSN___"

// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/servlet/data-management/data-collected/ for more info
options.isSendDefaultPii = true
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions platform-includes/getting-started-config/java.spring-boot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ Sentry's Spring Boot integration auto-configures `sentry.in-app-packages` proper
Provide a `sentry.dsn` property using either `application.properties` or `application.yml`:


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

# Add data like request headers and IP for users,
# see https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ for more info
sentry.send-default-pii=true

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
# We recommend adjusting this value in production.
sentry.traces-sample-rate=1.0
```

```yaml {filename:application.yml} {"onboardingOptions": {"performance": "3-7"}}
```yaml {filename:application.yml} {"onboardingOptions": {"performance": "7-11"}}
sentry:
dsn: ___PUBLIC_DSN___

# Add data like request headers and IP for users,
# see https://docs.sentry.io/platforms/java/guides/spring-boot/data-management/data-collected/ for more info
send-default-pii: true

# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for tracing.
# We recommend adjusting this value in production.
Expand Down
40 changes: 36 additions & 4 deletions platform-includes/getting-started-config/java.spring.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ The `sentry-spring` and `sentry-spring-jakarta` libraries provide an `@EnableSen
import io.sentry.spring.EnableSentry;
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
// project/dashboard
@EnableSentry(dsn = "___PUBLIC_DSN___")
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true
)
@Configuration
class SentryConfiguration {
}
Expand All @@ -17,7 +22,12 @@ class SentryConfiguration {
import io.sentry.spring.jakarta.EnableSentry;
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
// project/dashboard
@EnableSentry(dsn = "___PUBLIC_DSN___")
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true
)
@Configuration
class SentryConfiguration {
}
Expand All @@ -27,7 +37,12 @@ class SentryConfiguration {
import io.sentry.spring.EnableSentry
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
// project/dashboard
@EnableSentry(dsn = "___PUBLIC_DSN___")
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true
)
@Configuration
class SentryConfiguration
```
Expand All @@ -36,7 +51,12 @@ class SentryConfiguration
import io.sentry.spring.jakarta.EnableSentry
// NOTE: Replace the test DSN below with YOUR OWN DSN to see the events from this app in your Sentry
// project/dashboard
@EnableSentry(dsn = "___PUBLIC_DSN___")
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true
)
@Configuration
class SentryConfiguration
```
Expand All @@ -55,6 +75,9 @@ import org.springframework.core.Ordered;
// project/dashboard
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true,
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
)
class SentryConfiguration {
Expand All @@ -68,6 +91,9 @@ import org.springframework.core.Ordered;
// project/dashboard
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true,
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
)
class SentryConfiguration {
Expand All @@ -81,6 +107,9 @@ import org.springframework.core.Ordered
// project/dashboard
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true,
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
)
class SentryConfiguration
Expand All @@ -93,6 +122,9 @@ import org.springframework.core.Ordered
// project/dashboard
@EnableSentry(
dsn = "___PUBLIC_DSN___",
// Add data like request headers and IP for users,
// see https://docs.sentry.io/platforms/java/guides/spring/data-management/data-collected/ for more info
sendDefaultPii = true,
exceptionResolverOrder = Ordered.LOWEST_PRECEDENCE
)
class SentryConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

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

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

0 comments on commit 1144c95

Please sign in to comment.