Skip to content

Commit 266633e

Browse files
authored
feat: Update ui profiling electron docs (#15663)
docs for getsentry/sentry-electron#1267
1 parent 26dfe02 commit 266633e

File tree

3 files changed

+57
-26
lines changed

3 files changed

+57
-26
lines changed

docs/product/explore/logs/getting-started/index.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ To set up Sentry Logs, use the links below for supported SDKs. After it's been s
302302
label="Unreal Engine"
303303
url="/platforms/unreal/logs/"
304304
/>
305+
- <LinkWithPlatformIcon
306+
platform="godot"
307+
label="Godot Engine"
308+
url="/platforms/godot/logs/"
309+
/>
305310

306311
## Upcoming SDKs
307312

docs/product/explore/profiling/continuous-ui-profiling-migration-guide.mdx

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,42 +17,68 @@ For the remainder of this document, you can assume that wherever “Continuous/U
1717

1818
Continuous Profiling is supported on the following SDKs:
1919

20-
- [Python](/platforms/python/profiling/) `2.24.1`
21-
- [Node.js](/platforms/javascript/guides/node/profiling/) `9.8.0`
20+
- <LinkWithPlatformIcon
21+
platform="python"
22+
label="Python (since version 2.24.1)"
23+
url="/platforms/python/profiling/"
24+
/>
25+
- <LinkWithPlatformIcon
26+
platform="javascript.node"
27+
label="Node.js (since version 9.8.0)"
28+
url="/platforms/javascript/guides/node/profiling/"
29+
/>
2230

2331
UI Profiling is supported on the following SDKs:
2432

25-
- [iOS & macOS](/platforms/apple/profiling/) `8.49.0`
26-
- [Android (Java & Kotlin only)](/platforms/android/profiling/) `8.5.0`
33+
- <LinkWithPlatformIcon
34+
platform="apple"
35+
label="iOS & macOS (since version 8.49.0)"
36+
url="/platforms/apple/profiling/"
37+
/>
38+
- <LinkWithPlatformIcon
39+
platform="android"
40+
label="Android (Java & Kotlin only) (since version 8.5.0)"
41+
url="/platforms/android/profiling/"
42+
/>
43+
- <LinkWithPlatformIcon
44+
platform="javascript.browser"
45+
label="Browser JavaScript (since version 10.27.0)"
46+
url="/platforms/javascript/profiling/"
47+
/>
48+
- <LinkWithPlatformIcon
49+
platform="javascript.electron"
50+
label="Electron (since version 7.4.0)"
51+
url="/platforms/javascript/guides/electron/profiling/"
52+
/>
2753

2854
If you are using any other SDKs that currently support transaction-based profiling, those SDKs do not yet support Continuous or UI Profiling. We will be adding support for more SDKs over time.
2955

3056
## Identifying Current API Usage
3157

32-
If you are specifying either the `profiles_sample_rate` or `profiles_sampler` configuration options, you are using transaction-based profiling.
58+
If you are specifying either the `profiles_sample_rate` or `profiles_sampler` configuration options, you are using transaction-based profiling.
3359

34-
If you are specifying the `profile_session_sample_rate` and/or `profile_lifecycle` configuration options, you are using Continuous Profiling or UI Profiling.
60+
If you are specifying the `profile_session_sample_rate` and/or `profile_lifecycle` configuration options, you are using Continuous Profiling or UI Profiling.
3561

3662
## Migrating to Continuous/UI Profiling
3763

3864
### 1. Replace the `profiles_sample_rate` and `profiles_sampler` SDK configuration options with `profile_session_sample_rate`
3965

40-
There is an important distinction in how client-side sampling is implemented between transaction-based and Continuous/UI Profiling. `profiles_sample_rate` and `profiles_sampler` were used to evaluate whether the profile would be sampled *for each transaction*. In other words, if `profiles_sample_rate` was set to 0.5, 50% of all transactions would have associated profiles. `profiles_sampler` worked similarly — the only difference was that you could implement custom sampling logic (rather than a fixed sample rate) based on the context of the transaction being sampled.
66+
There is an important distinction in how client-side sampling is implemented between transaction-based and Continuous/UI Profiling. `profiles_sample_rate` and `profiles_sampler` were used to evaluate whether the profile would be sampled _for each transaction_. In other words, if `profiles_sample_rate` was set to 0.5, 50% of all transactions would have associated profiles. `profiles_sampler` worked similarly — the only difference was that you could implement custom sampling logic (rather than a fixed sample rate) based on the context of the transaction being sampled.
4167

42-
In contrast, Continuous/UI Profiling use client-side sampling that is *session scoped,* configured via the new `profile_session_sample_rate` parameter. Sampling is evaluated once at the beginning of each session, not every time profiling data is collected. Since the scope at which sampling is applied is different, you can’t just directly translate the previous `profiles_sample_rate` value to `profile_session_sample_rate`.
68+
In contrast, Continuous/UI Profiling use client-side sampling that is _session scoped,_ configured via the new `profile_session_sample_rate` parameter. Sampling is evaluated once at the beginning of each session, not every time profiling data is collected. Since the scope at which sampling is applied is different, you can’t just directly translate the previous `profiles_sample_rate` value to `profile_session_sample_rate`.
4369

4470
To control client side sampling behavior, set the `profile_session_sample_rate` configuration parameter to a value from 0.0-1.0 (default is 0.0) to control the number of profiling sessions that are sampled. The way this sampling rate is applied depends on the context:
4571

4672
- **For Continuous Profiling**: the session starts when the Sentry SDK is initialized, and stops when the service or process is terminated. Sampling is only evaluated once during the process lifetime (during initialization.)
47-
- For example, if you are using Continuous Profiling with a backend service where there are N instances of the same service that are deployed (such as N containers, pods, etc.), the `profile_session_sample_rate` controls the percentage of those instances that will have profiling enabled. 0.5 would mean that a randomly sampled 50% of the N instances would have profiling enabled.
48-
- Sampling would only be re-evaluated once an instance restarts or is re-deployed
49-
- **For UI Profiling:** the initial user session starts when the Sentry SDK is initialized, and sampling is first evaluated at this point. The user session will either end on termination of the application *OR*, depending on the platform, there can be other events that end a user session (for example backgrounding a mobile application). The sampling rate will be re-evaluated on each new user session.
50-
- For example, on the browser, the user session begins when the tab is opened and ends when the tab is closed. The sampling will be evaluated once at the start of each session, so if `profile_session_sample_rate` is set to 0.5, then 50% of the time your application is opened in a tab, profiling will be active for that tab’s lifetime.
51-
- On mobile, the user session begins when the application is started or foregrounded, and ends when the application is terminated or backgrounded. The sampling will be evaluated once at the start of each session, so if `profile_session_sample_rate` is set to 0.5 then 50% of the time the user opens your mobile app, profiling will be active until the user backgrounds or quits the app.
52-
73+
- For example, if you are using Continuous Profiling with a backend service where there are N instances of the same service that are deployed (such as N containers, pods, etc.), the `profile_session_sample_rate` controls the percentage of those instances that will have profiling enabled. 0.5 would mean that a randomly sampled 50% of the N instances would have profiling enabled.
74+
- Sampling would only be re-evaluated once an instance restarts or is re-deployed
75+
- **For UI Profiling:** the initial user session starts when the Sentry SDK is initialized, and sampling is first evaluated at this point. The user session will either end on termination of the application _OR_, depending on the platform, there can be other events that end a user session (for example backgrounding a mobile application). The sampling rate will be re-evaluated on each new user session.
76+
- For example, on the browser, the user session begins when the tab is opened and ends when the tab is closed. The sampling will be evaluated once at the start of each session, so if `profile_session_sample_rate` is set to 0.5, then 50% of the time your application is opened in a tab, profiling will be active for that tab’s lifetime.
77+
- On mobile, the user session begins when the application is started or foregrounded, and ends when the application is terminated or backgrounded. The sampling will be evaluated once at the start of each session, so if `profile_session_sample_rate` is set to 0.5 then 50% of the time the user opens your mobile app, profiling will be active until the user backgrounds or quits the app.
78+
5379
### 2. Set the new `profile_lifecycle` SDK configuration option
5480

55-
Continuous/UI Profiling support two lifecycle modes: `manual` and `trace`.
81+
Continuous/UI Profiling support two lifecycle modes: `manual` and `trace`.
5682

5783
**`manual` is the default mode** and allows you to more directly control when the profiler is running by calling the `start_profile_session` and `stop_profile_session` functions. If you decide to use this mode, you must add these start/stop calls anywhere in your code that you want profiling to be active. If `start_profile_session` is not called, profiling will never occur. Note that this respects `profile_session_sample_rate` — if the session is not sampled, no profiling data will be collected even if `start_profile_session` is called.
5884

platform-includes/profiling/browser-profiling/javascript.mdx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,25 @@ Note that since the profiling API is currently only exposed in Chromium, profile
1414

1515
To get started with JavaScript browser profiling, you'll need to:
1616

17-
- Install the <PlatformSdkPackageName fallback="@sentry/browser"/> SDK, minimum version `10.27.0` (UI Profiling) or `7.60.0` (deprecated transaction-based Profiling)
18-
- Configure the document response header to include `Document-Policy: js-profiling`
19-
- Configure the SDK to use the `browserProfilingIntegration` and set `profileSessionSampleRate` (UI Profiling) or `profilesSampleRate` (deprecated transaction-based Profiling)
20-
21-
## Step 1: Install the <PlatformOrGuideName/> SDK
22-
2317
<PlatformSection notSupported={["javascript.electron"]}>
2418

25-
Install our <PlatformOrGuideName/> SDK using either `yarn` or `npm`, the minimum version that supports profiling is **7.60.0**.
19+
- Install the <PlatformSdkPackageName fallback="@sentry/browser"/> SDK, minimum version `10.27.0` (UI Profiling) or `7.60.0` (deprecated transaction-based Profiling)
2620

2721
</PlatformSection>
2822

2923
<PlatformSection supported={["javascript.electron"]}>
3024

31-
Install our Electron SDK using either `yarn` or `npm`, the minimum version that supports profiling is **4.16.0**.
25+
- Install the <PlatformSdkPackageName fallback="@sentry/electron"/> SDK, minimum version `7.4.0` (UI Profiling) or `4.16.0` (deprecated transaction-based Profiling)
3226

3327
</PlatformSection>
3428

29+
- Configure the document response header to include `Document-Policy: js-profiling`
30+
- Configure the SDK to use the `browserProfilingIntegration` and set `profileSessionSampleRate` (UI Profiling) or `profilesSampleRate` (deprecated transaction-based Profiling)
31+
32+
## Step 1: Install the <PlatformOrGuideName/> SDK
33+
34+
Install our <PlatformOrGuideName/> SDK using either `npm`, `yarn`, or `pnpm`.
35+
3536
<PlatformContent includePath="profiling/automatic-instrumentation-intro" />
3637

3738
## Step 2: Add Document-Policy: js-profiling header
@@ -60,7 +61,6 @@ In `manual` mode, you can manage the profiling data collection via calls to `Sen
6061

6162
In `trace` mode, the profiler manages its own start and stop calls based on spans. It continues to run while at least one span is active, and stops when there are no active spans.
6263

63-
6464
### Manual Lifecycle Profiling
6565

6666
Manual lifecycle profiling is the default mode and enables you to start and stop the profiler manually.
@@ -83,11 +83,11 @@ Sentry.init({
8383
dsn: "___PUBLIC_DSN___",
8484
integrations: [
8585
Sentry.browserTracingIntegration(), // Enables tracing
86-
Sentry.browserProfilingIntegration()
86+
Sentry.browserProfilingIntegration(),
8787
],
8888
tracesSampleRate: 1.0, // Enables tracing
8989
profileSessionSampleRate: 1.0,
90-
profileLifecycle: 'trace',
90+
profileLifecycle: "trace",
9191
});
9292
```
9393

0 commit comments

Comments
 (0)