-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: dotnet profiling docs * Update src/platforms/dotnet/profiling/index.mdx Co-authored-by: Bruno Garcia <[email protected]> * Update src/wizard/dotnet/profiling-onboarding/dotnet/3.configure-profiling.md Co-authored-by: Bruno Garcia <[email protected]> * Update src/wizard/dotnet/profiling-onboarding/dotnet/2.configure-performance.md Co-authored-by: Bruno Garcia <[email protected]> * restructure platform support docs * Apply suggestions from code review Co-authored-by: Bruno Garcia <[email protected]> * Update src/platforms/dotnet/profiling/index.mdx Co-authored-by: Bruno Garcia <[email protected]> * fixups * fixups * linter issues --------- Co-authored-by: Bruno Garcia <[email protected]>
- Loading branch information
1 parent
c0e26bf
commit 6208e3e
Showing
8 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
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. | ||
|
||
<Note> | ||
|
||
Sentry profiling for .NET is available in _Alpha_ on .NET 6.0+ (tested on .NET 7.0 & .NET 8.0 as well) for: | ||
|
||
- Windows | ||
- Linux | ||
- macOS | ||
- iOS | ||
- Mac Catalyst | ||
|
||
</Note> | ||
|
||
## Enable Profiling | ||
|
||
To enable profiling, set the `ProfilesSampleRate`. | ||
Additionally, for all platforms except iOS/Mac Catalyst, you need to add a dependency on the `Sentry.Profiling` NuGet package. | ||
|
||
```shell {tabTitle:.NET CLI} | ||
dotnet add package Sentry.Profiling -v {{@inject packages.version('sentry.dotnet', '4.0.0-beta.8') }} | ||
``` | ||
|
||
Profiling depends on Sentry’s performance monitoring product being enabled beforehand. To enable performance monitoring in the SDK, set the `TracesSampleRate` option to the desired value. | ||
|
||
```csharp {tabTitle:iOS/MacCatalyst} | ||
SentrySdk.Init(options => | ||
{ | ||
// ... usual setup options omitted for clarity (see Getting Started) ... | ||
// Sample rate for your transactions, e.g. value 0.1 means we want to report 10% of transactions. | ||
// We recommend adjusting this value in production. | ||
options.TracesSampleRate = 1.0; | ||
|
||
// Sample rate for profiling, applied on top of othe TracesSampleRate, | ||
// e.g. 0.2 means we want to profile 20 % of the captured transactions. | ||
// We recommend adjusting this value in production. | ||
options.ProfilesSampleRate = 1.0; | ||
}); | ||
``` | ||
|
||
```csharp {tabTitle:Windows/Linux/macOS} | ||
SentrySdk.Init(options => | ||
{ | ||
// ... usual setup options omitted for clarity (see Getting Started) ... | ||
// Sample rate for your transactions, e.g. value 0.1 means we want to report 10% of transactions. | ||
// Setting 1.0 means all transactions are profiled. | ||
// We recommend adjusting this value in production. | ||
options.TracesSampleRate = 1.0; | ||
|
||
// Sample rate for profiling, applied on top of othe TracesSampleRate, | ||
// e.g. 0.2 means we want to profile 20 % of the captured transactions. | ||
// We recommend adjusting this value in production. | ||
options.ProfilesSampleRate = 1.0; | ||
|
||
// Requires NuGet package: Sentry.Profiling | ||
// Note: by default, the profiler is initialized asynchronously, this can be tuned by passing an desired initialization timeout to the constructor. | ||
options.AddIntegration(new ProfilingIntegration( | ||
// During startup, wait up to 500ms to profile the app startup code. This could make launching the app a bit slower so comment it out if your prefer profiling to start asynchronously | ||
TimeSpan.FromMilliseconds(500) | ||
)); | ||
}); | ||
``` | ||
|
||
### | ||
|
||
Check out the <PlatformLink to="/performance/">performance setup documentation</PlatformLink> for more detailed information on how to configure sampling. | ||
Setting the traces sample rate to 1.0 means all transactions will be captured. | ||
Setting the profiles sample rate to 1.0 means all captured transactions will be profiled. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: Troubleshooting | ||
description: "Learn how to troubleshoot your profiling setup." | ||
sidebar_order: 5000 | ||
--- | ||
|
||
### Profiles are not showing up | ||
|
||
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. | ||
- If the transactions happen too soon after `Sentry.Init()`, they may not be captured yet. | ||
This is because the `ProfilingIntegration()` from `Sentry.Profiling` NuGet package initializes asynchronously by default. | ||
If you'd like to initialize it synchronously, set the desired timeout constructor argument, e.g. `new ProfilingIntegration(TimeSpan.FromMilliseconds(500))` to wait up to 500 ms for the profiler to start up. | ||
Note: this doesn't apply to iOS and Mac Catalyst which use native profiling and are initialized synchronously. | ||
- Maybe you're trying to capture profiles on a platform that is currently **not** supported, notably: | ||
- .NET Framework; we only support .NET 6.0, .NET 7.0 and .NET 8.0 | ||
- Native AOT - this is only supported for iOS and Mac Catalyst (alongside the standard Mono AOT) | ||
- Android - currently not supported at all | ||
|
||
### `Unknown` frames | ||
|
||
Some frames will show up as `unknown` in the UI. This is because the SDK does not have information about the stack frame. | ||
Usually, these are anonymous helper JIT-generated methods and present among `System` stack frames. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
name: .NET | ||
doc_link: https://docs.sentry.io/platforms/dotnet/profiling/ | ||
support_level: alpha | ||
type: language | ||
--- | ||
|
||
<div class='alert warning'> | ||
Profiling in .NET is currently available in alpha for .NET 6.0+ on Windows, Linux, macOS, iOS and Mac Catalyst. | ||
There may be some bugs. We recognize the irony. | ||
</div> |
11 changes: 11 additions & 0 deletions
11
src/wizard/dotnet/profiling-onboarding/dotnet/1.install.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
name: .NET | ||
doc_link: https://docs.sentry.io/platforms/dotnet/profiling/ | ||
support_level: alpha | ||
type: language | ||
--- | ||
|
||
#### Install | ||
|
||
For the Profiling integration to work, you must use the `Sentry` and `Sentry.Profiling` NuGet packages (minimum version v4.0.0) and Sentry. | ||
Learn more about installation methods in our [full documentation](https://docs.sentry.io/platforms/dotnet/#install). |
23 changes: 23 additions & 0 deletions
23
src/wizard/dotnet/profiling-onboarding/dotnet/2.configure-performance.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
name: .NET | ||
doc_link: https://docs.sentry.io/platforms/dotnet/profiling/ | ||
support_level: alpha | ||
type: language | ||
--- | ||
|
||
#### Configure Performance | ||
|
||
Sentry’s performance monitoring product has to be enabled in order for Profiling to work. To enable performance monitoring in the SDK: | ||
|
||
```csharp | ||
SentrySdk.Init(options => | ||
{ | ||
// A Sentry Data Source Name (DSN) is required. | ||
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/ | ||
// You can set it in the SENTRY_DSN environment variable, or you can set it in code here. | ||
options.Dsn = "___PUBLIC_DSN___"; | ||
|
||
// We recommend adjusting this value in production: | ||
options.TracesSampleRate = 1.0; | ||
}); | ||
``` |
32 changes: 32 additions & 0 deletions
32
src/wizard/dotnet/profiling-onboarding/dotnet/3.configure-profiling.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: .NET | ||
doc_link: https://docs.sentry.io/platforms/dotnet/profiling/ | ||
support_level: alpha | ||
type: language | ||
--- | ||
|
||
#### Configure Profiling | ||
|
||
Add the `ProfilesSampleRate` option to your SDK config. | ||
|
||
```csharp | ||
SentrySdk.Init(options => | ||
{ | ||
// A Sentry Data Source Name (DSN) is required. | ||
// See https://docs.sentry.io/product/sentry-basics/dsn-explainer/ | ||
// You can set it in the SENTRY_DSN environment variable, or you can set it in code here. | ||
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. | ||
// We recommend adjusting this value in production: | ||
options.ProfilesSampleRate = 1.0; | ||
|
||
// Windows, Linux and macOS profiling requires NuGet package: Sentry.Profiling | ||
// Note: by default, the profiler is initialized asynchronously, this can be tuned by passing an desired initialization timeout to the constructor. | ||
options.AddIntegration(new ProfilingIntegration()); | ||
}); | ||
``` |
6208e3e
There was a problem hiding this comment.
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 – ./
docs.sentry.io
sentry-docs-git-master.sentry.dev
sentry-docs.sentry.dev