Skip to content

refactor: migrate android onboarding options to inline syntax #13441

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

Merged
merged 2 commits into from
Apr 22, 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
8 changes: 7 additions & 1 deletion docs/platforms/android/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,29 @@ 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": "6-7", "profiling": "8-13", "session-replay": "14-16"}}
```xml {filename:AndroidManifest.xml}
<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" />
<!-- ___PRODUCT_OPTION_START___ performance -->
<!-- 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" />
<!-- ___PRODUCT_OPTION_END___ performance -->
<!-- ___PRODUCT_OPTION_START___ profiling -->
<!-- Enable profiling, adjust in production env. This is evaluated only once per session -->
<meta-data android:name="io.sentry.traces.profiling.session-sample-rate" android:value="1.0" />
<!-- Set profiling lifecycle, can be `manual` (controlled through `Sentry.startProfiler()` and `Sentry.stopProfiler()`) or `trace` (automatically starts and stop a profile whenever a sampled trace starts and finishes) -->
<meta-data android:name="io.sentry.traces.profiling.lifecycle" android:value="trace" />
<!-- Enable profiling on app start -->
<meta-data android:name="io.sentry.traces.profiling.start-on-app-start" android:value="true" />
<!-- ___PRODUCT_OPTION_END___ profiling -->
<!-- ___PRODUCT_OPTION_START___ session-replay -->
<!-- Record session replays for 100% of errors and 10% of sessions -->
<meta-data android:name="io.sentry.session-replay.on-error-sample-rate" android:value="1.0" />
<meta-data android:name="io.sentry.session-replay.session-sample-rate" android:value="0.1" />
<!-- ___PRODUCT_OPTION_END___ session-replay -->
</application>
```

Expand Down
6 changes: 3 additions & 3 deletions src/rehype-onboarding-lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ function handle_inline_options(node) {
let currentOption;

// product options syntax
// ___PRODUCT_OPTION_START___ performance
// ___PRODUCT_OPTION_START___ session-replay
// some lines here
// ___PRODUCT_OPTION_END___ performance
// ___PRODUCT_OPTION_END___ session-replay
const PRODUCT_OPTION_START = '___PRODUCT_OPTION_START___';
const PRODUCT_OPTION_END = '___PRODUCT_OPTION_END___';
node.children?.forEach(line => {
const lineStr = toString(line);
if (lineStr.includes(PRODUCT_OPTION_START)) {
currentOption = lineStr.split(PRODUCT_OPTION_START)[1].trim();
currentOption = /___PRODUCT_OPTION_START___ ([-\w]+)/.exec(lineStr)?.[1].trim();
line.properties['data-onboarding-option-hidden'] = '1';
} else if (lineStr.includes(PRODUCT_OPTION_END)) {
line.properties['data-onboarding-option-hidden'] = '1';
Expand Down
Loading