Skip to content

Commit

Permalink
Move /common/profiling to platform docs (#8692)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanie-anderson authored Dec 11, 2023
1 parent 1f41323 commit abce7df
Show file tree
Hide file tree
Showing 16 changed files with 434 additions and 6 deletions.
5 changes: 0 additions & 5 deletions src/platform-includes/aws-lambda-environment/python.mdx

This file was deleted.

52 changes: 52 additions & 0 deletions src/platforms/android/profiling/index.mdx
Original file line number Diff line number Diff line change
@@ -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
---

<PlatformContent includePath="profiling/index/preface" />

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
<application>
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />
<meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
</application>
```

Check out the <PlatformLink to="/performance/">performance setup documentation</PlatformLink> 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

<Note>

Android profiling is available starting in SDK version `6.16.0`.

</Note>

In `AndroidManifest.xml`:

<SignInNote />

```xml
<application>
<meta-data android:name="io.sentry.dsn" android:value="___PUBLIC_DSN___" />
<meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
<meta-data android:name="io.sentry.traces.profiling.sample-rate" android:value="1.0" />
</application>
```

<Note>

The `io.sentry.traces.profiling.sample-rate` setting is _relative_ to the `io.sentry.traces.sample-rate` setting.

</Note>
12 changes: 12 additions & 0 deletions src/platforms/android/profiling/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
@@ -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 <PlatformLink to="/performance/">is enabled</PlatformLink>.
- 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 <PlatformLink to="/performance/instrumentation/custom-instrumentation">custom instrumentation</PlatformLink>.
- Enable <PlatformLink to="/configuration/options/#debug">debug mode</PlatformLink> in the SDK and check the logs.
73 changes: 73 additions & 0 deletions src/platforms/apple/common/profiling/index.mdx
Original file line number Diff line number Diff line change
@@ -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
---

<PlatformContent includePath="profiling/index/preface" />

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:

<SignInNote />

```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 <PlatformLink to="/performance/">performance setup documentation</PlatformLink> 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
<Note>
iOS profiling is available starting in SDK version `8.12.0`.
</Note>
<SignInNote />
```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
}];
```
<Note>
The <PlatformIdentifier name="profiles-sample-rate" /> setting is _relative_ to the <PlatformIdentifier name="traces-sample-rate" /> setting.
</Note>
12 changes: 12 additions & 0 deletions src/platforms/apple/common/profiling/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
@@ -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 <PlatformLink to="/performance/">is enabled</PlatformLink>.
- 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 <PlatformLink to="/performance/instrumentation/custom-instrumentation">custom instrumentation</PlatformLink>.
- Enable <PlatformLink to="/configuration/options/#debug">debug mode</PlatformLink> in the SDK and check the logs.
54 changes: 54 additions & 0 deletions src/platforms/flutter/profiling/index.mdx
Original file line number Diff line number Diff line change
@@ -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
---

<PlatformContent includePath="profiling/index/preface" />

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:

<SignInNote />

```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 <PlatformLink to="/performance/">performance setup documentation</PlatformLink> for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured.

## Enable Profiling

<Note>

Flutter Profiling alpha is available for iOS and macOS since SDK version `7.12.0`.

</Note>

To enable profiling, set the `profilesSampleRate`:

<SignInNote />

```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()),
);
```
16 changes: 16 additions & 0 deletions src/platforms/flutter/profiling/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
@@ -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 <PlatformLink to="/performance/">is enabled</PlatformLink>.
- 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 <PlatformLink to="/performance/instrumentation/custom-instrumentation">custom instrumentation</PlatformLink>.
- Enable <PlatformLink to="/configuration/options/#debug">debug mode</PlatformLink> in the SDK and check the logs.

### Limitations

Profiling is currently available only for iOS and macOS.
49 changes: 49 additions & 0 deletions src/platforms/go/common/profiling/index.mdx
Original file line number Diff line number Diff line change
@@ -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
---

<PlatformContent includePath="profiling/index/preface" />

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:

<SignInNote />

```go
err := sentry.Init(sentry.ClientOptions{
Dsn: "___PUBLIC_DSN___",
EnableTracing: true,
// We recommend adjusting this value in production:
TracesSampleRate: 1.0,
})
```

Check out the <PlatformLink to="/performance/">performance setup documentation</PlatformLink> for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured.

## Enable Profiling

<Note>

Go Profiling alpha is available since SDK version `0.22.0`.

</Note>

To enable profiling, set the `ProfilesSampleRate`:

<SignInNote />

```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,
})
```
19 changes: 19 additions & 0 deletions src/platforms/go/common/profiling/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
@@ -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 <PlatformLink to="/performance/">is enabled</PlatformLink>.
- 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 <PlatformLink to="/performance/instrumentation/custom-instrumentation">custom instrumentation</PlatformLink>.
- Enable <PlatformLink to="/configuration/options/#debug">debug mode</PlatformLink> 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).
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<PlatformContent includePath="aws-lambda-environment" />
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

Expand Down
File renamed without changes.
44 changes: 44 additions & 0 deletions src/platforms/react-native/profiling/index.mdx
Original file line number Diff line number Diff line change
@@ -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
---

<PlatformContent includePath="profiling/index/preface" />

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 <PlatformLink to="/performance/">performance setup documentation</PlatformLink> for more detailed information on how to configure sampling. Setting the sample rate to 1.0 means all transactions will be captured.

## Enable Profiling

<Note>

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.

</Note>

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,
},
});
```
19 changes: 19 additions & 0 deletions src/platforms/react-native/profiling/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
@@ -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 <PlatformLink to="/performance/">is enabled</PlatformLink>.
- 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 <PlatformLink to="/performance/instrumentation/custom-instrumentation">custom instrumentation</PlatformLink>.
- Enable <PlatformLink to="/configuration/options/#debug">debug mode</PlatformLink> 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).
Loading

1 comment on commit abce7df

@vercel
Copy link

@vercel vercel bot commented on abce7df Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sentry-docs – ./

sentry-docs.sentry.dev
docs.sentry.io
sentry-docs-git-master.sentry.dev

Please sign in to comment.