Skip to content

Commit 460e620

Browse files
authored
fix: Use correct profiling sample rate in electron docs (#15665)
Follow up to #15663
1 parent 266633e commit 460e620

File tree

2 files changed

+41
-15
lines changed

2 files changed

+41
-15
lines changed

docs/platforms/javascript/common/configuration/options.mdx

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -548,22 +548,51 @@ The sample rate for replays that are recorded when an error happens. This type o
548548

549549
## Profiling Options
550550

551+
<PlatformSection supported={["javascript.electron"]}>
552+
553+
<SdkOption name="profileSessionSampleRate" type='number' availableSince="7.4.0">
554+
555+
A number between `0` and `1` that sets the percentage of how many sessions should have profiling enabled. `1.0` enables profiling in every session, `0.5` enables profiling for 50% of the sessions, and `0` enables it for none. The sampling decision is made once at the beginning of a session. This option is required to enable profiling.
556+
557+
</SdkOption>
558+
559+
<SdkOption name="profileLifecycle" type='"trace" | "manual"' defaultValue='"manual"' availableSince="7.4.0">
560+
561+
Determines how profiling sessions are controlled. It has two modes:
562+
563+
- `'manual'` (default): You control when profiling starts and stops using the `startProfiler()` and `stopProfiler()` functions. In this mode, profile sampling is only affected by `profileSessionSampleRate`. Read more about these functions in the <PlatformLink to="/profiling">profiling API documentation</PlatformLink>.
564+
- `'trace'`: Profiling starts and stops automatically with transactions, as long as tracing is enabled. The profiler runs as long as there is at least one sampled transaction. In this mode, profiling is affected by both `profileSessionSampleRate` and your tracing sample rate (`tracesSampleRate` or `tracesSampler`).
565+
566+
</SdkOption>
567+
568+
<SdkOption name="profilesSampleRate" type='number'>
569+
570+
**Deprecated:** Use `profileSessionSampleRate` instead to configure continuous profiling from version `7.4.0` onwards.
571+
572+
A number between `0` and `1`, controlling the percentage chance a given sampled transaction will be profiled. (`0` represents 0% while `1` represents 100%.) Applies equally to all transactions created in the app. This is relative to the tracing sample rate - e.g. `0.5` means 50% of sampled transactions will be profiled.
573+
574+
</SdkOption>
575+
576+
</PlatformSection>
577+
578+
<PlatformSection notSupported={["javascript.electron"]}>
579+
551580
<SdkOption name="profileSessionSampleRate" type='number' availableSince="10.27.0">
552581

553-
A number between `0` and `1` that sets the percentage of how many sessions should have profiling enabled. `1.0` enables profiling in every session, `0.5` enables profiling for 50% of the sessions, and `0` enables it for none. The sampling decision is made once at the beginning of a session. This option is required to enable profiling.
582+
A number between `0` and `1` that sets the percentage of how many sessions should have profiling enabled. `1.0` enables profiling in every session, `0.5` enables profiling for 50% of the sessions, and `0` enables it for none. The sampling decision is made once at the beginning of a session. This option is required to enable profiling.
554583

555-
<PlatformCategorySection categorySupported={["server", "serverless"]}>
556-
In a server environment, a profiling session starts when the Sentry SDK is initialized and stops when the service terminates.
557-
Therefore, the sampling decision is re-evaluated on service restart or redeployment.
558-
</PlatformCategorySection>
584+
<PlatformCategorySection categorySupported={["server", "serverless"]}>
585+
In a server environment, a profiling session starts when the Sentry SDK is
586+
initialized and stops when the service terminates. Therefore, the sampling
587+
decision is re-evaluated on service restart or redeployment.
588+
</PlatformCategorySection>
559589

560590
<PlatformCategorySection supported={['browser']}>
561591
In a browser environment, a profiling session corresponds to a user session. A user session starts with a
562592
new SDK initialization on page load and ends when the browser tab is closed.
563593
</PlatformCategorySection>
564594
</SdkOption>
565595

566-
567596
<SdkOption name="profileLifecycle" type='"trace" | "manual"' defaultValue='"manual"' availableSince="10.27.0">
568597

569598
Determines how profiling sessions are controlled. It has two modes:
@@ -573,15 +602,15 @@ Determines how profiling sessions are controlled. It has two modes:
573602

574603
</SdkOption>
575604

576-
577605
<SdkOption name="profilesSampleRate" type='number'>
578606

579-
**Deprecated:** Use `profileSessionSampleRate` instead to configure continuous profiling from version 10.27.0 onwards.
607+
**Deprecated:** Use `profileSessionSampleRate` instead to configure continuous profiling from version 10.27.0 onwards.
580608

581-
A number between `0` and `1`, controlling the percentage chance a given sampled transaction will be profiled. (`0` represents 0% while `1` represents 100%.) Applies equally to all transactions created in the app. This is relative to the tracing sample rate - e.g. `0.5` means 50% of sampled transactions will be profiled.
609+
A number between `0` and `1`, controlling the percentage chance a given sampled transaction will be profiled. (`0` represents 0% while `1` represents 100%.) Applies equally to all transactions created in the app. This is relative to the tracing sample rate - e.g. `0.5` means 50% of sampled transactions will be profiled.
582610

583611
</SdkOption>
584612

613+
</PlatformSection>
585614

586615
<PlatformSection supported={["javascript.cordova", "javascript.capacitor"]}>
587616

platform-includes/profiling/automatic-instrumentation-setup/javascript.electron.mdx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ Sentry.init({
1818
// Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
1919
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
2020

21-
// Set profilesSampleRate to 1.0 to profile every transaction.
22-
// Since profilesSampleRate is relative to tracesSampleRate,
23-
// the final profiling rate can be computed as tracesSampleRate * profilesSampleRate
24-
// For example, a tracesSampleRate of 0.5 and profilesSampleRate of 0.5 would
25-
// result in 25% of transactions being profiled (0.5*0.5=0.25)
26-
profilesSampleRate: 1.0,
21+
// Set profileSessionSampleRate to 1.0 to profile during every session.
22+
// The decision, whether to profile or not, is made once per session (when the SDK is initialized).
23+
profileSessionSampleRate: 1.0,
2724
});
2825
```

0 commit comments

Comments
 (0)