Skip to content

Commit 2a285ad

Browse files
authored
enha: update .NET profiling docs after AddProfilingIntegration() was added (#12402)
* enha: update .NET profiling docs after AddProfilingIntegration() was added * remove tab title * oxford comma
1 parent 66dc7af commit 2a285ad

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

docs/platforms/dotnet/common/profiling/index.mdx

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dotnet add package Sentry.Profiling
3131

3232
Profiling depends on Sentry’s tracing product being enabled beforehand. To enable tracing in the SDK, set the `TracesSampleRate` option to the desired value.
3333

34-
```csharp {tabTitle:Windows/Linux/macOS}
34+
```csharp
3535
SentrySdk.Init(options =>
3636
{
3737
// ... usual setup options omitted for clarity (see Getting Started) ...
@@ -46,32 +46,16 @@ SentrySdk.Init(options =>
4646
// We recommend adjusting this value in production.
4747
options.ProfilesSampleRate = 1.0;
4848

49-
// Requires NuGet package: Sentry.Profiling
50-
// Note: By default, the profiler is initialized asynchronously. This can be tuned by passing a desired initialization timeout to the constructor.
51-
options.AddIntegration(new ProfilingIntegration(
52-
// 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
53-
TimeSpan.FromMilliseconds(500)
54-
));
55-
});
56-
```
57-
58-
```csharp {tabTitle:iOS/MacCatalyst}
59-
SentrySdk.Init(options =>
60-
{
61-
// ... usual setup options omitted for clarity (see Getting Started) ...
62-
63-
// Sample rate for your transactions, e.g. value 0.1 means we want to report 10% of transactions.
64-
// Setting 1.0 means all transactions are profiled.
65-
// We recommend adjusting this value in production.
66-
options.TracesSampleRate = 1.0;
49+
// Attach the profiling integration.
50+
options.AddProfilingIntegration();
6751

68-
// Sample rate for profiling, applied on top of othe TracesSampleRate,
69-
// e.g. 0.2 means we want to profile 20 % of the captured transactions.
70-
// We recommend adjusting this value in production.
71-
options.ProfilesSampleRate = 1.0;
52+
// On Windows, Linux, and macOS, the profiler is initialized asynchronously by default.
53+
// Alternatively, you can switch to synchronous initialization by adding a timeout argument.
54+
// The SDK waits up to the specified timeout for the .NET runtime profiler to start up before continuing.
55+
// e.g. options.AddProfilingIntegration(TimeSpan.FromMilliseconds(500));
56+
// Note: the timeout has no effect on iOS and MacCatalyst, which use native profiling and always start synchronously.
7257
});
7358
```
74-
7559
###
7660

7761
Check out the <PlatformLink to="/tracing/">tracing setup documentation</PlatformLink> for more detailed information on how to configure sampling.

docs/platforms/dotnet/common/profiling/troubleshooting/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ If you don't see any profiling data in [sentry.io](https://sentry.io), you can t
1414
- Enable <PlatformLink to="/configuration/options/#debug">debug mode</PlatformLink> in the SDK and check the logs.
1515
- If the transactions happen too soon after `Sentry.Init()`, they may not be captured yet.
1616
This is because the `ProfilingIntegration()` from `Sentry.Profiling` NuGet package initializes asynchronously by default.
17-
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.
18-
Note: this doesn't apply to iOS and Mac Catalyst which use native profiling and are initialized synchronously.
17+
If you'd like to initialize it synchronously, set the desired timeout argument, e.g. `options.AddProfilingIntegration(TimeSpan.FromMilliseconds(500))` to wait up to 500 ms for the profiler to start up.
18+
Note: this doesn't apply to iOS and Mac Catalyst which use native profiling, are initialized synchronously, and the timeout argument is ignored.
1919
- Maybe you're trying to capture profiles on a platform that is currently **not** supported, notably:
2020
- .NET Framework; we only support .NET 6.0, .NET 7.0 and .NET 8.0
2121
- Native AOT - this is only supported for iOS and Mac Catalyst (alongside the standard Mono AOT)

0 commit comments

Comments
 (0)