Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sendDefaultPii=true for Java/Android in getting started docs #12727

Merged
merged 6 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m I think we should also add this to the manual setup page

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, see below

<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 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-defaut-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-defaut-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-defaut-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-defaut-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-defaut-pii=true
traces-sample-rate=1.0
```
</OnboardingOption>