Skip to content
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
47 changes: 38 additions & 9 deletions docs/platforms/javascript/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -548,22 +548,51 @@ The sample rate for replays that are recorded when an error happens. This type o

## Profiling Options

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

<SdkOption name="profileSessionSampleRate" type='number' availableSince="7.4.0">

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.

</SdkOption>

<SdkOption name="profileLifecycle" type='"trace" | "manual"' defaultValue='"manual"' availableSince="7.4.0">

Determines how profiling sessions are controlled. It has two modes:

- `'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>.
- `'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`).

</SdkOption>

<SdkOption name="profilesSampleRate" type='number'>

**Deprecated:** Use `profileSessionSampleRate` instead to configure continuous profiling from version `7.4.0` onwards.

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.

</SdkOption>

</PlatformSection>

<PlatformSection notSupported={["javascript.electron"]}>

<SdkOption name="profileSessionSampleRate" type='number' availableSince="10.27.0">

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.
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.

<PlatformCategorySection categorySupported={["server", "serverless"]}>
In a server environment, a profiling session starts when the Sentry SDK is initialized and stops when the service terminates.
Therefore, the sampling decision is re-evaluated on service restart or redeployment.
</PlatformCategorySection>
<PlatformCategorySection categorySupported={["server", "serverless"]}>
In a server environment, a profiling session starts when the Sentry SDK is
initialized and stops when the service terminates. Therefore, the sampling
decision is re-evaluated on service restart or redeployment.
</PlatformCategorySection>

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


<SdkOption name="profileLifecycle" type='"trace" | "manual"' defaultValue='"manual"' availableSince="10.27.0">

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

</SdkOption>


<SdkOption name="profilesSampleRate" type='number'>

**Deprecated:** Use `profileSessionSampleRate` instead to configure continuous profiling from version 10.27.0 onwards.
**Deprecated:** Use `profileSessionSampleRate` instead to configure continuous profiling from version 10.27.0 onwards.

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.
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.

</SdkOption>

</PlatformSection>

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ Sentry.init({
// Set `tracePropagationTargets` to control for which URLs trace propagation should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],

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