You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Profiling depends on Sentry’s tracing product being enabled beforehand. To enable tracing in the SDK, set the `TracesSampleRate` option to the desired value.
33
33
34
-
```csharp {tabTitle:Windows/Linux/macOS}
34
+
```csharp
35
35
SentrySdk.Init(options=>
36
36
{
37
37
// ... usual setup options omitted for clarity (see Getting Started) ...
@@ -46,32 +46,16 @@ SentrySdk.Init(options =>
46
46
// We recommend adjusting this value in production.
47
47
options.ProfilesSampleRate=1.0;
48
48
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(newProfilingIntegration(
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();
67
51
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.
72
57
});
73
58
```
74
-
75
59
###
76
60
77
61
Check out the <PlatformLinkto="/tracing/">tracing setup documentation</PlatformLink> for more detailed information on how to configure sampling.
Copy file name to clipboardExpand all lines: docs/platforms/dotnet/common/profiling/troubleshooting/index.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@ If you don't see any profiling data in [sentry.io](https://sentry.io), you can t
14
14
- Enable <PlatformLinkto="/configuration/options/#debug">debug mode</PlatformLink> in the SDK and check the logs.
15
15
- If the transactions happen too soon after `Sentry.Init()`, they may not be captured yet.
16
16
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.
19
19
- Maybe you're trying to capture profiles on a platform that is currently **not** supported, notably:
20
20
- .NET Framework; we only support .NET 6.0, .NET 7.0 and .NET 8.0
21
21
- Native AOT - this is only supported for iOS and Mac Catalyst (alongside the standard Mono AOT)
0 commit comments