Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions docs/platforms/android/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,13 @@ Set this boolean to `false` to disable tracing for `OPTIONS` requests. This opti

<ConfigKey name="profiles-sample-rate">

A number between 0 and 1, controlling the percentage chance a given profile will be sent to Sentry. (0 represents 0% while 1 represents 100%.) Applies only to sampled transactions created in the app. Either this or <PlatformIdentifier name="profiles-sampler" /> must be defined to enable profiling.
A number between 0 and 1, controlling the percentage chance a given profile will be sent to Sentry. (0 represents 0% while 1 represents 100%.) Applies only to sampled transactions created in the app. Either this or <PlatformIdentifier name="profiles-sampler" /> must be defined to enable transaction profiling. Don't set it if you want to use <PlatformLink to="/profiling/#continuous-profiling">Continuous Profiling</PlatformLink>.

</ConfigKey>

<ConfigKey name="profiles-sampler">

A function responsible for determining the percentage chance a given profile will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering profiles, by returning 0 for those that are unwanted. Either this or <PlatformIdentifier name="profiles-sample-rate" /> must be defined to enable profiling.
A function responsible for determining the percentage chance a given profile will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering profiles, by returning 0 for those that are unwanted. Either this or <PlatformIdentifier name="profiles-sample-rate" /> must be defined to enable transaction profiling. Don't set it if you want to use <PlatformLink to="/profiling/#continuous-profiling">Continuous Profiling</PlatformLink>.

</ConfigKey>

Expand Down
8 changes: 6 additions & 2 deletions docs/platforms/android/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ Configuration is done via the application `AndroidManifest.xml`. Here's an examp
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />
<!-- 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" />
<!-- enable profiling when starting transactions, adjust in production env -->
<meta-data android:name="io.sentry.traces.profiling.sample-rate" android:value="1.0" />
</application>
```

Expand All @@ -89,11 +87,14 @@ import io.sentry.Sentry;
public class MyActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Any code running after this line will be profiled until Sentry.stopProfiler() is called.
Sentry.startProfiler();
try {
throw new Exception("This is a test.");
} catch (Exception e) {
Sentry.captureException(e);
}
Sentry.stopProfiler();
}
}
```
Expand All @@ -106,11 +107,14 @@ import io.sentry.Sentry
class MyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Any code running after this line will be profiled until Sentry.stopProfiler() is called.
Sentry.startProfiler()
try {
throw Exception("This is a test.")
} catch (e: Exception) {
Sentry.captureException(e)
}
Sentry.stopProfiler()
}
}
```
Expand Down
20 changes: 20 additions & 0 deletions docs/platforms/android/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,23 @@ The SDK won't run app start profiling the very first time the app runs, as the S
The SDK will set the `isForNextAppStart` flag in `TransactionContext` if app start profiling is enabled.

</Note>

## Continuous Profiling

<Note>

This feature is experimental and may have bugs.

</Note>

_(New in version 8.0.0)_

The current profiling implementation stops the profiler automatically after 30 seconds (unless you manually stop it earlier). Naturally, this limitation makes it difficult to get full coverage of your app's execution. We now offer an experimental continuous mode, where profiling data is periodically uploaded while running, with no limit to how long the profiler may run.

Previously, profiles only ran in tandem with performance transactions that were started either automatically or manually with `Sentry.startTransaction`. Now, you can start and stop the profiler directly with `Sentry.startProfiler` and `Sentry.stopProfiler`. You can also start a profile at app launch by setting `SentryOptions.enableAppStartProfiling = true` in your call to `SentryAndroid.init`.

Continuous profiling mode is enabled by default, requiring no changes to `SentryOptions` when you start the SDK to opt in. If you had previously set `SentryOptions.profilesSampleRate` or `SentryOptions.profilesSampler` to use transaction-based profiling, then remove those lines of code from your configuration.

These new APIs do not offer any sampling functionality—every call to start the profiler will start it, and the same goes for launch profiles if you've configured that. If you are interested in reducing the amount of profiles that run, you must take care to do it at the call sites.

Continuous profiling has implications for your org's billing structure. This feature is only available for subscription plans that enrolled after June 5, 2024.
4 changes: 2 additions & 2 deletions docs/platforms/apple/common/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ _(New in version 8.36.0)_

The current profiling implementation stops the profiler automatically after 30 seconds (unless you manually stop it earlier). Naturally, this limitation makes it difficult to get full coverage of your app's execution. We now offer an experimental continuous mode, where profiling data is periodically uploaded while running, with no limit to how long the profiler may run.

Previously, profiles only ran in tandem with performance transactions that were started either automatically or manually with `SentrySDK.startTransaction`. Now, you can start and stop the profiler directly with `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. You can also start a profile at app launch by setting `SentryOptions.enableAppLaunchProfiling = true` in your call to `SentrySDK.startWithOptions`.
Previously, profiles only ran in tandem with performance transactions that were started either automatically or manually with `SentrySDK.startTransaction`. Now, you can start and stop the profiler directly with `SentrySDK.startProfiler` and `SentrySDK.stopProfiler`. You can also start a profile at app launch by setting `SentryOptions.enableAppLaunchProfiling = true` in your call to `SentrySDK.startWithOptions`.

Continuous profiling mode is enabled by default, requiring no changes to `SentryOptions` when you start the SDK to opt in. If you had previously set `SentryOptions.profilesSampleRate` or `SentryOptions.profilesSampler` to use transaction-based profiling, then remove those lines of code from your configuration.

These new APIs do not offer any sampling functionality—every call to start the profiler will start it, and the same goes for launch profiles if you've configured that. If you are interested in reducing the amount of profiles that run, you must take care to do it at the callsites.
These new APIs do not offer any sampling functionality—every call to start the profiler will start it, and the same goes for launch profiles if you've configured that. If you are interested in reducing the amount of profiles that run, you must take care to do it at the call sites.

Continuous profiling has implications for your org's billing structure. This feature is only available for subscription plans that enrolled after June 5, 2024.
1 change: 1 addition & 0 deletions docs/product/explore/profiling/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Profiling depends on Sentry's performance monitoring product being enabled befor
<Include name="feature-stage-beta.mdx" />

- Mobile
- [Android](/platforms/android/profiling/#continuous-profiling)
- [iOS and macOS](/platforms/apple/guides/ios/profiling/#continuous-profiling)
- Standalone and server apps
- [Node.js](/platforms/javascript/guides/node/profiling/#enable-continuous-profiling)
Expand Down
Loading