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

Use sendDefaultPii=true for Java SDK onboarding #85141

Merged
merged 5 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions static/app/gettingStartedDocs/android/android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const getConfigurationSnippet = (params: Params) => `
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${params.dsn.public}" />

<!-- Add data like request headers, user ip adress 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" />
Copy link
Member Author

Choose a reason for hiding this comment

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

There's also the wizard where I couldn't find any trace of the PII setting being suggested / enabled.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, probably we could add send-default-pii=true to the sentry.properties created by the Wizard, commented out and with a comment above it that explains what it does (out of scope for this PR ofc).

Copy link
Member Author

Choose a reason for hiding this comment

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

I opened an issue for the wizard changes: getsentry/sentry-wizard#790


<!-- 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
11 changes: 9 additions & 2 deletions static/app/gettingStartedDocs/java/java.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-ag
`;

const getSentryPropertiesSnippet = (params: Params) => `
dsn=${params.dsn.public}${
dsn=${params.dsn.public}
# 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${
params.isPerformanceSelected
? `
traces-sample-rate=1.0`
Expand All @@ -150,7 +153,11 @@ const getConfigureSnippet = (params: Params) => `
import io.sentry.Sentry;

Sentry.init(options -> {
options.setDsn("${params.dsn.public}");${
options.setDsn("${params.dsn.public}");

// 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);${
params.isPerformanceSelected
? `
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
Expand Down
5 changes: 4 additions & 1 deletion static/app/gettingStartedDocs/java/log4j2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-ag
`;

const getSentryPropertiesSnippet = (params: Params) => `
dsn=${params.dsn.public}${
dsn=${params.dsn.public}
# 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${
params.isPerformanceSelected
? `
traces-sample-rate=1.0`
Copy link
Member Author

Choose a reason for hiding this comment

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

There's still a sample without sendDefaultPii here. While it would be possible to change the SDK and add that option to the XML config I think it's better to just use sentry.properties instead as that already existed for a while and doesn't require use of a new version of the SDK.

Expand Down
9 changes: 8 additions & 1 deletion static/app/gettingStartedDocs/java/logback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-ag
`;

const getSentryPropertiesSnippet = (params: Params) => `
dsn=${params.dsn.public}${
dsn=${params.dsn.public}
# 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
send-default-pii=true${
params.isPerformanceSelected
? `
traces-sample-rate=1.0`
Expand All @@ -147,6 +150,8 @@ const getConsoleAppenderSnippet = (params: Params) => `
? `
<options>
<dsn>${params.dsn.public}</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>`
: ''
}
Expand All @@ -166,6 +171,8 @@ const getLogLevelSnippet = (params: Params) => `
? `
<options>
<dsn>${params.dsn.public}</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>`
: ''
}
Expand Down
10 changes: 8 additions & 2 deletions static/app/gettingStartedDocs/java/spring-boot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ SENTRY_AUTO_INIT=false java -javaagent:sentry-opentelemetry-agent-${getPackageVe
`;

const getConfigurationPropertiesSnippet = (params: Params) => `
sentry.dsn=${params.dsn.public}${
sentry.dsn=${params.dsn.public}
# 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${
params.isPerformanceSelected
? `
# Set traces-sample-rate to 1.0 to capture 100% of transactions for tracing.
Expand All @@ -140,7 +143,10 @@ sentry.traces-sample-rate=1.0`

const getConfigurationYamlSnippet = (params: Params) => `
sentry:
dsn: ${params.dsn.public}${
dsn: ${params.dsn.public}
# 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${
params.isPerformanceSelected
? `
# Set traces-sample-rate to 1.0 to capture 100% of transactions for tracing.
Expand Down
10 changes: 9 additions & 1 deletion static/app/gettingStartedDocs/java/spring.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ import io.sentry.spring${
params.platformOptions.springVersion === SpringVersion.V6 ? '.jakarta' : ''
}.EnableSentry;

@EnableSentry(dsn = "${params.dsn.public}")
@EnableSentry(
dsn = "${params.dsn.public}",
// 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 @@ -173,6 +178,9 @@ import org.springframework.core.Ordered

@EnableSentry(
dsn = "${params.dsn.public}",
// 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
)`;

Expand Down
Loading