Skip to content

Commit 7911ece

Browse files
a-haritibitsandfoxes
authored andcommitted
refactor: migrate android onboarding options to inline syntax (#13441)
* migrate android onboarding options to inline syntax * fix option name matcher
1 parent 2d100c4 commit 7911ece

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

docs/platforms/android/index.mdx

+7-1
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,29 @@ The wizard will prompt you to log in to Sentry. It'll then automatically do the
110110
Configuration is done via the application `AndroidManifest.xml`. Here's an example config which should get you started:
111111

112112

113-
```xml {filename:AndroidManifest.xml} {"onboardingOptions": {"performance": "6-7", "profiling": "8-13", "session-replay": "14-16"}}
113+
```xml {filename:AndroidManifest.xml}
114114
<application>
115115
<!-- Required: set your sentry.io project identifier (DSN) -->
116116
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />
117117
<!-- 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 -->
118118
<meta-data android:name="io.sentry.send-default-pii" android:value="true" />
119+
<!-- ___PRODUCT_OPTION_START___ performance -->
119120
<!-- Enable the performance API by setting a sample-rate, adjust in production env -->
120121
<meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
122+
<!-- ___PRODUCT_OPTION_END___ performance -->
123+
<!-- ___PRODUCT_OPTION_START___ profiling -->
121124
<!-- Enable profiling, adjust in production env. This is evaluated only once per session -->
122125
<meta-data android:name="io.sentry.traces.profiling.session-sample-rate" android:value="1.0" />
123126
<!-- 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) -->
124127
<meta-data android:name="io.sentry.traces.profiling.lifecycle" android:value="trace" />
125128
<!-- Enable profiling on app start -->
126129
<meta-data android:name="io.sentry.traces.profiling.start-on-app-start" android:value="true" />
130+
<!-- ___PRODUCT_OPTION_END___ profiling -->
131+
<!-- ___PRODUCT_OPTION_START___ session-replay -->
127132
<!-- Record session replays for 100% of errors and 10% of sessions -->
128133
<meta-data android:name="io.sentry.session-replay.on-error-sample-rate" android:value="1.0" />
129134
<meta-data android:name="io.sentry.session-replay.session-sample-rate" android:value="0.1" />
135+
<!-- ___PRODUCT_OPTION_END___ session-replay -->
130136
</application>
131137
```
132138

src/rehype-onboarding-lines.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ function handle_inline_options(node) {
5151
let currentOption;
5252

5353
// product options syntax
54-
// ___PRODUCT_OPTION_START___ performance
54+
// ___PRODUCT_OPTION_START___ session-replay
5555
// some lines here
56-
// ___PRODUCT_OPTION_END___ performance
56+
// ___PRODUCT_OPTION_END___ session-replay
5757
const PRODUCT_OPTION_START = '___PRODUCT_OPTION_START___';
5858
const PRODUCT_OPTION_END = '___PRODUCT_OPTION_END___';
5959
node.children?.forEach(line => {
6060
const lineStr = toString(line);
6161
if (lineStr.includes(PRODUCT_OPTION_START)) {
62-
currentOption = lineStr.split(PRODUCT_OPTION_START)[1].trim();
62+
currentOption = /___PRODUCT_OPTION_START___ ([-\w]+)/.exec(lineStr)?.[1].trim();
6363
line.properties['data-onboarding-option-hidden'] = '1';
6464
} else if (lineStr.includes(PRODUCT_OPTION_END)) {
6565
line.properties['data-onboarding-option-hidden'] = '1';

0 commit comments

Comments
 (0)