From ff9a6a19ed9d3725474c688dda14e52716860f4d Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 21 Jan 2025 09:43:21 +0100 Subject: [PATCH 1/3] enha: update .NET profiling docs after AddProfilingIntegration() was added --- .../dotnet/common/profiling/index.mdx | 32 +++++-------------- .../profiling/troubleshooting/index.mdx | 4 +-- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/docs/platforms/dotnet/common/profiling/index.mdx b/docs/platforms/dotnet/common/profiling/index.mdx index c77888bc35fe88..1c1bbb33574801 100644 --- a/docs/platforms/dotnet/common/profiling/index.mdx +++ b/docs/platforms/dotnet/common/profiling/index.mdx @@ -46,32 +46,16 @@ SentrySdk.Init(options => // 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 a 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) - )); + // Attach the profiling integration. + options.AddProfilingIntegration(); + + // On Windows, Linux and macOS, the profiler is initialized asynchronously by default. + // Alternatively, you can switch to synchronous initialization by adding a timeout argument. + // The SDK waits up to the specified timeout for the .NET runtime profiler to start up before continuing. + // e.g. options.AddProfilingIntegration(TimeSpan.FromMilliseconds(500)); + // Note: the timeout has no effect on iOS and MacCatalyst, which use native profiling and always start synchronously. }); ``` - -```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. - // 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; -}); -``` - ### Check out the tracing setup documentation for more detailed information on how to configure sampling. diff --git a/docs/platforms/dotnet/common/profiling/troubleshooting/index.mdx b/docs/platforms/dotnet/common/profiling/troubleshooting/index.mdx index a74bdea9dc748a..037d12553cdfcb 100644 --- a/docs/platforms/dotnet/common/profiling/troubleshooting/index.mdx +++ b/docs/platforms/dotnet/common/profiling/troubleshooting/index.mdx @@ -14,8 +14,8 @@ If you don't see any profiling data in [sentry.io](https://sentry.io), you can t - Enable debug mode 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. + 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. + Note: this doesn't apply to iOS and Mac Catalyst which use native profiling, are initialized synchronously, and the timeout argument is ignored. - 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) From c13a3abd0329a4d87a6a803722b482a3cc655a6d Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 21 Jan 2025 09:44:28 +0100 Subject: [PATCH 2/3] remove tab title --- docs/platforms/dotnet/common/profiling/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/dotnet/common/profiling/index.mdx b/docs/platforms/dotnet/common/profiling/index.mdx index 1c1bbb33574801..c9bbfa48126262 100644 --- a/docs/platforms/dotnet/common/profiling/index.mdx +++ b/docs/platforms/dotnet/common/profiling/index.mdx @@ -31,7 +31,7 @@ dotnet add package Sentry.Profiling Profiling depends on Sentry’s tracing product being enabled beforehand. To enable tracing in the SDK, set the `TracesSampleRate` option to the desired value. -```csharp {tabTitle:Windows/Linux/macOS} +```csharp SentrySdk.Init(options => { // ... usual setup options omitted for clarity (see Getting Started) ... From 0ac94dcec8b2a5df2af70511eecd66af08c7d6e7 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Tue, 21 Jan 2025 09:47:38 +0100 Subject: [PATCH 3/3] oxford comma --- docs/platforms/dotnet/common/profiling/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/dotnet/common/profiling/index.mdx b/docs/platforms/dotnet/common/profiling/index.mdx index c9bbfa48126262..7e529a032eef42 100644 --- a/docs/platforms/dotnet/common/profiling/index.mdx +++ b/docs/platforms/dotnet/common/profiling/index.mdx @@ -49,7 +49,7 @@ SentrySdk.Init(options => // Attach the profiling integration. options.AddProfilingIntegration(); - // On Windows, Linux and macOS, the profiler is initialized asynchronously by default. + // On Windows, Linux, and macOS, the profiler is initialized asynchronously by default. // Alternatively, you can switch to synchronous initialization by adding a timeout argument. // The SDK waits up to the specified timeout for the .NET runtime profiler to start up before continuing. // e.g. options.AddProfilingIntegration(TimeSpan.FromMilliseconds(500));