From abce7dfe8469446e318de6ad79cb915036ecf59e Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Mon, 11 Dec 2023 23:27:53 +0100 Subject: [PATCH] Move /common/profiling to platform docs (#8692) --- .../aws-lambda-environment/python.mdx | 5 -- src/platforms/android/profiling/index.mdx | 52 +++++++++++++ .../profiling/troubleshooting/index.mdx | 12 +++ .../apple/common/profiling/index.mdx | 73 +++++++++++++++++++ .../profiling/troubleshooting/index.mdx | 12 +++ src/platforms/flutter/profiling/index.mdx | 54 ++++++++++++++ .../profiling/troubleshooting/index.mdx | 16 ++++ src/platforms/go/common/profiling/index.mdx | 49 +++++++++++++ .../profiling/troubleshooting/index.mdx | 19 +++++ .../aws-lambda/manual-layer/index.mdx | 6 +- .../{common => python}/profiling/index.mdx | 0 .../profiling/troubleshooting/index.mdx | 0 .../react-native/profiling/index.mdx | 44 +++++++++++ .../profiling/troubleshooting/index.mdx | 19 +++++ src/platforms/ruby/common/profiling/index.mdx | 63 ++++++++++++++++ .../profiling/troubleshooting/index.mdx | 16 ++++ 16 files changed, 434 insertions(+), 6 deletions(-) delete mode 100644 src/platform-includes/aws-lambda-environment/python.mdx create mode 100644 src/platforms/android/profiling/index.mdx create mode 100644 src/platforms/android/profiling/troubleshooting/index.mdx create mode 100644 src/platforms/apple/common/profiling/index.mdx create mode 100644 src/platforms/apple/common/profiling/troubleshooting/index.mdx create mode 100644 src/platforms/flutter/profiling/index.mdx create mode 100644 src/platforms/flutter/profiling/troubleshooting/index.mdx create mode 100644 src/platforms/go/common/profiling/index.mdx create mode 100644 src/platforms/go/common/profiling/troubleshooting/index.mdx rename src/platforms/{common => python}/profiling/index.mdx (100%) rename src/platforms/{common => python}/profiling/troubleshooting/index.mdx (100%) create mode 100644 src/platforms/react-native/profiling/index.mdx create mode 100644 src/platforms/react-native/profiling/troubleshooting/index.mdx create mode 100644 src/platforms/ruby/common/profiling/index.mdx create mode 100644 src/platforms/ruby/common/profiling/troubleshooting/index.mdx diff --git a/src/platform-includes/aws-lambda-environment/python.mdx b/src/platform-includes/aws-lambda-environment/python.mdx deleted file mode 100644 index d82432901f8e3..0000000000000 --- a/src/platform-includes/aws-lambda-environment/python.mdx +++ /dev/null @@ -1,5 +0,0 @@ -You can configure Sentry by setting these environment variables for your Lambda function: - -- `SENTRY_INITIAL_HANDLER`: The handler function of your AWS Lambda funtion. -- `SENTRY_DSN`: This is set to the [DSN](/product/sentry-basics/concepts/dsn-explainer/) of your project -- `SENTRY_TRACES_SAMPLE_RATE`: This sets the [sampling rate](/platforms/node/configuration/sampling/#sampling-transaction-events) for transactions. diff --git a/src/platforms/android/profiling/index.mdx b/src/platforms/android/profiling/index.mdx new file mode 100644 index 0000000000000..6725ab6b53afc --- /dev/null +++ b/src/platforms/android/profiling/index.mdx @@ -0,0 +1,52 @@ +--- +title: Set Up Profiling +description: "Learn how to enable profiling in your app if it is not already set up." +sidebar_order: 5000 +--- + + + +With [profiling](/product/profiling/), Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments. + +## Enable Performance Monitoring + +Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK: + +In `AndroidManifest.xml`: + +```xml + + + + +``` + +Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured. + +By default, some transactions will be created automatically for common operations like loading a view controller/activity and app startup. + +## Enable Profiling + + + +Android profiling is available starting in SDK version `6.16.0`. + + + +In `AndroidManifest.xml`: + + + +```xml + + + + + +``` + + + +The `io.sentry.traces.profiling.sample-rate` setting is _relative_ to the `io.sentry.traces.sample-rate` setting. + + diff --git a/src/platforms/android/profiling/troubleshooting/index.mdx b/src/platforms/android/profiling/troubleshooting/index.mdx new file mode 100644 index 0000000000000..4d8763caa6863 --- /dev/null +++ b/src/platforms/android/profiling/troubleshooting/index.mdx @@ -0,0 +1,12 @@ +--- +title: Troubleshooting +description: "Learn how to troubleshoot your profiling setup." +sidebar_order: 5000 +--- + +If you don't see any profiling data in [sentry.io](https://sentry.io), you can try the following: + +- Ensure that performance monitoring is enabled. +- Ensure that the automatic instrumentation is sending performance data to Sentry by going to the **Performance** page in [sentry.io](https://sentry.io). +- If the automatic instrumentation is not sending performance data, try using custom instrumentation. +- Enable debug mode in the SDK and check the logs. diff --git a/src/platforms/apple/common/profiling/index.mdx b/src/platforms/apple/common/profiling/index.mdx new file mode 100644 index 0000000000000..536c143a05878 --- /dev/null +++ b/src/platforms/apple/common/profiling/index.mdx @@ -0,0 +1,73 @@ +--- +title: Set Up Profiling +description: "Learn how to enable profiling in your app if it is not already set up." +sidebar_order: 5000 +--- + + + +With [profiling](/product/profiling/), Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments. + +## Enable Performance Monitoring + +Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK: + + + +```swift {tabTitle:Swift} +import Sentry + +SentrySDK.start { options in + options.dsn = "___PUBLIC_DSN___" + options.tracesSampleRate = 1.0 +} +``` + +```objc {tabTitle:Objective-C} +@import Sentry; + +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.dsn = @"___PUBLIC_DSN___"; + options.tracesSampleRate = @1.0; +}]; +``` + +Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured. + +By default, some transactions will be created automatically for common operations like loading a view controller/activity and app startup. + +## Enable Profiling + + + +iOS profiling is available starting in SDK version `8.12.0`. + + + + + +```swift {tabTitle:Swift} +import Sentry + +SentrySDK.start { options in + options.dsn = "___PUBLIC_DSN___" + options.tracesSampleRate = 1.0 // tracing must be enabled for profiling + options.profilesSampleRate = 1.0 // see also `profilesSampler` if you need custom sampling logic +} +``` + +```objc {tabTitle:Objective-C} +@import Sentry; + +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.dsn = @"___PUBLIC_DSN___"; + options.tracesSampleRate = @1.0; // tracing must be enabled for profiling + options.profilesSampleRate = @1.0; // see also `profilesSampler` if you need custom sampling logic +}]; +``` + + + +The setting is _relative_ to the setting. + + diff --git a/src/platforms/apple/common/profiling/troubleshooting/index.mdx b/src/platforms/apple/common/profiling/troubleshooting/index.mdx new file mode 100644 index 0000000000000..4d8763caa6863 --- /dev/null +++ b/src/platforms/apple/common/profiling/troubleshooting/index.mdx @@ -0,0 +1,12 @@ +--- +title: Troubleshooting +description: "Learn how to troubleshoot your profiling setup." +sidebar_order: 5000 +--- + +If you don't see any profiling data in [sentry.io](https://sentry.io), you can try the following: + +- Ensure that performance monitoring is enabled. +- Ensure that the automatic instrumentation is sending performance data to Sentry by going to the **Performance** page in [sentry.io](https://sentry.io). +- If the automatic instrumentation is not sending performance data, try using custom instrumentation. +- Enable debug mode in the SDK and check the logs. diff --git a/src/platforms/flutter/profiling/index.mdx b/src/platforms/flutter/profiling/index.mdx new file mode 100644 index 0000000000000..d208bcb72f520 --- /dev/null +++ b/src/platforms/flutter/profiling/index.mdx @@ -0,0 +1,54 @@ +--- +title: Set Up Profiling +description: "Learn how to enable profiling in your app if it is not already set up." +sidebar_order: 5000 +--- + + + +With [profiling](/product/profiling/), Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments. + +## Enable Performance Monitoring + +Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK: + + + +```dart +SentryFlutter.init( + (options) => { + options.dsn = '___PUBLIC_DSN___'; + // We recommend adjusting this value in production: + options.tracesSampleRate = 1.0; + }, + appRunner: () => runApp(MyApp()), +); +``` + +Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured. + +## Enable Profiling + + + +Flutter Profiling alpha is available for iOS and macOS since SDK version `7.12.0`. + + + +To enable profiling, set the `profilesSampleRate`: + + + +```dart +SentryFlutter.init( + (options) => { + options.dsn = '___PUBLIC_DSN___'; + // We recommend adjusting this value in production: + options.tracesSampleRate = 1.0; + // The sampling rate for profiling is relative to tracesSampleRate + // Setting to 1.0 will profile 100% of sampled transactions: + options.profilesSampleRate = 1.0; + }, + appRunner: () => runApp(MyApp()), +); +``` diff --git a/src/platforms/flutter/profiling/troubleshooting/index.mdx b/src/platforms/flutter/profiling/troubleshooting/index.mdx new file mode 100644 index 0000000000000..e8fc2b10e6dc0 --- /dev/null +++ b/src/platforms/flutter/profiling/troubleshooting/index.mdx @@ -0,0 +1,16 @@ +--- +title: Troubleshooting +description: "Learn how to troubleshoot your profiling setup." +sidebar_order: 5000 +--- + +If you don't see any profiling data in [sentry.io](https://sentry.io), you can try the following: + +- Ensure that performance monitoring is enabled. +- Ensure that the automatic instrumentation is sending performance data to Sentry by going to the **Performance** page in [sentry.io](https://sentry.io). +- If the automatic instrumentation is not sending performance data, try using custom instrumentation. +- Enable debug mode in the SDK and check the logs. + +### Limitations + +Profiling is currently available only for iOS and macOS. diff --git a/src/platforms/go/common/profiling/index.mdx b/src/platforms/go/common/profiling/index.mdx new file mode 100644 index 0000000000000..a35eadc5eaf75 --- /dev/null +++ b/src/platforms/go/common/profiling/index.mdx @@ -0,0 +1,49 @@ +--- +title: Set Up Profiling +description: "Learn how to enable profiling in your app if it is not already set up." +sidebar_order: 5000 +--- + + + +With [profiling](/product/profiling/), Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments. + +## Enable Performance Monitoring + +Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK: + + + +```go +err := sentry.Init(sentry.ClientOptions{ + Dsn: "___PUBLIC_DSN___", + EnableTracing: true, + // We recommend adjusting this value in production: + TracesSampleRate: 1.0, +}) +``` + +Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured. + +## Enable Profiling + + + +Go Profiling alpha is available since SDK version `0.22.0`. + + + +To enable profiling, set the `ProfilesSampleRate`: + + + +```go +err := sentry.Init(sentry.ClientOptions{ + Dsn: "___PUBLIC_DSN___", + EnableTracing: true, + // We recommend adjusting these values in production: + TracesSampleRate: 1.0, + // The sampling rate for profiling is relative to TracesSampleRate: + ProfilesSampleRate: 1.0, +}) +``` diff --git a/src/platforms/go/common/profiling/troubleshooting/index.mdx b/src/platforms/go/common/profiling/troubleshooting/index.mdx new file mode 100644 index 0000000000000..d9ed25c1789ab --- /dev/null +++ b/src/platforms/go/common/profiling/troubleshooting/index.mdx @@ -0,0 +1,19 @@ +--- +title: Troubleshooting +description: "Learn how to troubleshoot your profiling setup." +sidebar_order: 5000 +--- + +If you don't see any profiling data in [sentry.io](https://sentry.io), you can try the following: + +- Ensure that performance monitoring is enabled. +- Ensure that the automatic instrumentation is sending performance data to Sentry by going to the **Performance** page in [sentry.io](https://sentry.io). +- If the automatic instrumentation is not sending performance data, try using custom instrumentation. +- Enable debug mode in the SDK and check the logs. + +### Limitations + +Profile samples are collected periodically for each goroutine. +If your program uses a large number of concurrent goroutines, make sure to check whether the overhead is within the acceptable range for your use case. + +As always, and especially with Profiling in Go being an alpha feature, feedback is welcome on [Discord](https://discord.com/channels/621778831602221064/621786587939864586) or [GitHub](https://github.com/getsentry/sentry-go/issues/630). diff --git a/src/platforms/python/integrations/aws-lambda/manual-layer/index.mdx b/src/platforms/python/integrations/aws-lambda/manual-layer/index.mdx index 536db934e0fa1..d5e7ad5099ea6 100644 --- a/src/platforms/python/integrations/aws-lambda/manual-layer/index.mdx +++ b/src/platforms/python/integrations/aws-lambda/manual-layer/index.mdx @@ -50,7 +50,11 @@ After saving, open the "Configuration" tab of your Lambda Function and set `SENT Make sure that `SENTRY_DSN` and `SENTRY_INITIAL_HANDLER` are set in your environment at minimum. See "Set the Sentry Handler" above for more information. - +You can configure Sentry by setting these environment variables for your Lambda function: + +- `SENTRY_INITIAL_HANDLER`: The handler function of your AWS Lambda funtion. +- `SENTRY_DSN`: This is set to the [DSN](/product/sentry-basics/concepts/dsn-explainer/) of your project +- `SENTRY_TRACES_SAMPLE_RATE`: This sets the [sampling rate](/platforms/python/configuration/sampling/#sampling-transaction-events) for transactions. ## Verify diff --git a/src/platforms/common/profiling/index.mdx b/src/platforms/python/profiling/index.mdx similarity index 100% rename from src/platforms/common/profiling/index.mdx rename to src/platforms/python/profiling/index.mdx diff --git a/src/platforms/common/profiling/troubleshooting/index.mdx b/src/platforms/python/profiling/troubleshooting/index.mdx similarity index 100% rename from src/platforms/common/profiling/troubleshooting/index.mdx rename to src/platforms/python/profiling/troubleshooting/index.mdx diff --git a/src/platforms/react-native/profiling/index.mdx b/src/platforms/react-native/profiling/index.mdx new file mode 100644 index 0000000000000..493e317a34d8a --- /dev/null +++ b/src/platforms/react-native/profiling/index.mdx @@ -0,0 +1,44 @@ +--- +title: Set Up Profiling +description: "Learn how to enable profiling in your app if it is not already set up." +sidebar_order: 5000 +--- + + + +With [profiling](/product/profiling/), Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments. + +## Enable Performance Monitoring + +Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK: + +```javascript +Sentry.init({ + dsn: "___DSN___", + tracesSampleRate: 1.0, +}); +``` + +Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured. + +## Enable Profiling + + + +Profiling for React Native is available in beta in SDK versions `5.8.0` and above. Currently, it supports profiling the JavaScript layer. Combined profiling with native Android/iOS layers isn't supported at this time. + + + +To enable profiling, set the `profilesSampleRate`: + +```javascript +Sentry.init({ + dsn: "___DSN___", + tracesSampleRate: 1.0, + _experiments: { + // profilesSampleRate is relative to tracesSampleRate. + // Here, we'll capture profiles for 100% of transactions. + profilesSampleRate: 1.0, + }, +}); +``` diff --git a/src/platforms/react-native/profiling/troubleshooting/index.mdx b/src/platforms/react-native/profiling/troubleshooting/index.mdx new file mode 100644 index 0000000000000..5a602d25957b9 --- /dev/null +++ b/src/platforms/react-native/profiling/troubleshooting/index.mdx @@ -0,0 +1,19 @@ +--- +title: Troubleshooting +description: "Learn how to troubleshoot your profiling setup." +sidebar_order: 5000 +--- + +If you don't see any profiling data in [sentry.io](https://sentry.io), you can try the following: + +- Ensure that performance monitoring is enabled. +- Ensure that the automatic instrumentation is sending performance data to Sentry by going to the **Performance** page in [sentry.io](https://sentry.io). +- If the automatic instrumentation is not sending performance data, try using custom instrumentation. +- Enable debug mode in the SDK and check the logs. + +### Limitations + +Because profile samples are collected at a fixed sampling frequency, we recommend checking if profiling's [Performance Overhead](/product/profiling/performance-overhead) is acceptable for your use case. Note that +we're working on symbolication of the collected profiles which means that at the moment you'll see only function names but not resolved source file paths. + +As always, and especially since Profiling in React Native is an alpha feature, feedback is welcome on [Discord](https://discord.com/channels/621778831602221064/750735628932612096) or [GitHub](https://github.com/getsentry/sentry-react-native/issues/2668). diff --git a/src/platforms/ruby/common/profiling/index.mdx b/src/platforms/ruby/common/profiling/index.mdx new file mode 100644 index 0000000000000..083c53fabda98 --- /dev/null +++ b/src/platforms/ruby/common/profiling/index.mdx @@ -0,0 +1,63 @@ +--- +title: Set Up Profiling +description: "Learn how to enable profiling in your app if it is not already set up." +sidebar_order: 5000 +--- + + + +With [profiling](/product/profiling/), Sentry allows you to collect and analyze performance profiles from real user devices in production to give you a complete picture of how your application performs in a variety of environments. + +## Enable Performance Monitoring + +Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK: + + + +```ruby +Sentry.init do |config| + config.dsn = '___PUBLIC_DSN___' + config.traces_sample_rate = 1.0 +end +``` + +Check out the performance setup documentation for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured. + +## Enable Profiling + + + +Ruby profiling beta is available starting in SDK version `5.9.0`. + + + +We use the [`stackprof` gem](https://github.com/tmm1/stackprof) to collect profiles for Ruby. + +First add `stackprof` to your `Gemfile` and make sure it is loaded before `sentry-ruby`. + +```ruby +# Gemfile + +gem 'stackprof' +gem 'sentry-ruby' +``` + +Then, make sure both `traces_sample_rate` and `profiles_sample_rate` are set and non-zero in your Sentry initializer. + + + +```ruby +# config/initializers/sentry.rb + +Sentry.init do |config| + config.dsn = "___PUBLIC_DSN___" + config.traces_sample_rate = 1.0 + config.profiles_sample_rate = 1.0 +end +``` + + + +The setting is _relative_ to the setting. + + diff --git a/src/platforms/ruby/common/profiling/troubleshooting/index.mdx b/src/platforms/ruby/common/profiling/troubleshooting/index.mdx new file mode 100644 index 0000000000000..d58a7c18b43c1 --- /dev/null +++ b/src/platforms/ruby/common/profiling/troubleshooting/index.mdx @@ -0,0 +1,16 @@ +--- +title: Troubleshooting +description: "Learn how to troubleshoot your profiling setup." +sidebar_order: 5000 +--- + +If you don't see any profiling data in [sentry.io](https://sentry.io), you can try the following: + +- Ensure that performance monitoring is enabled. +- Ensure that the automatic instrumentation is sending performance data to Sentry by going to the **Performance** page in [sentry.io](https://sentry.io). +- If the automatic instrumentation is not sending performance data, try using custom instrumentation. +- Enable debug mode in the SDK and check the logs. + +### Limitations + +Profiles for multi-threaded servers like `puma` might not capture frames correctly when async I/O is happening. This is a limitation of `stackprof`.