From 4a5e654e9ed97a0c5dd4f86d0b7bb97ca1101a0f Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Mon, 14 Apr 2025 17:31:07 +0100 Subject: [PATCH 1/4] migrate aspnet to new syntnax --- docs/platforms/dotnet/guides/aspnet/index.mdx | 6 +++++- docs/platforms/dotnet/guides/aspnetcore/index.mdx | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/platforms/dotnet/guides/aspnet/index.mdx b/docs/platforms/dotnet/guides/aspnet/index.mdx index e63a38b2346cf..9432be06b7503 100644 --- a/docs/platforms/dotnet/guides/aspnet/index.mdx +++ b/docs/platforms/dotnet/guides/aspnet/index.mdx @@ -34,7 +34,7 @@ as well as your logs as breadcrumbs. The logging integrations also capture event You configure the SDK in the `Global.asax.cs`: -```csharp {"onboardingOptions": {"performance": "20-23, 33-42"}} +```csharp using System; using System.Web; using Sentry.AspNet; @@ -54,9 +54,11 @@ public class MvcApplication : HttpApplication // When configuring for the first time, to see what the SDK is doing: options.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // If you also installed the Sentry.EntityFramework package options.AddEntityFramework(); @@ -67,6 +69,7 @@ public class MvcApplication : HttpApplication // Global error catcher protected void Application_Error() => Server.CaptureLastError(); + // ___PRODUCT_OPTION_START___ performance protected void Application_BeginRequest() { Context.StartSentryTransaction(); @@ -76,6 +79,7 @@ public class MvcApplication : HttpApplication { Context.FinishSentryTransaction(); } + // ___PRODUCT_OPTION_END___ performance protected void Application_End() { diff --git a/docs/platforms/dotnet/guides/aspnetcore/index.mdx b/docs/platforms/dotnet/guides/aspnetcore/index.mdx index 3acd8572a4e97..ed279bd906aa6 100644 --- a/docs/platforms/dotnet/guides/aspnetcore/index.mdx +++ b/docs/platforms/dotnet/guides/aspnetcore/index.mdx @@ -69,7 +69,7 @@ The framework takes configuration settings from `appsettings.json`, environment An example of some of the options that can be configured via `appsettings.json`: -```json {filename:appsettings.json} {"onboardingOptions": {"performance": "10"}} +```json {filename:appsettings.json} "Sentry": { "Dsn": "___PUBLIC_DSN___", "SendDefaultPii": true, @@ -79,7 +79,9 @@ An example of some of the options that can be configured via `appsettings.json`: "AttachStackTrace": true, "Debug": true, "DiagnosticLevel": "Error", + // ___PRODUCT_OPTION_START___ performance "TracesSampleRate": 1.0 + // ___PRODUCT_OPTION_END___ performance }, ``` @@ -107,10 +109,12 @@ ASP.NET Core will automatically read this environment variable and bind it to th Finally, any settings that can be configured via `appsettings.json` or environment variables can also be configured via code. Some settings can only be configured in code, such as the `BeforeSend` callback: -```csharp {"onboardingOptions": {"performance": "3"}} +```csharp .UseSentry(options => { + // ___PRODUCT_OPTION_START___ performance options.TracesSampleRate = 1.0; // <- Set this to configure automatic tracing + // ___PRODUCT_OPTION_END___ performance options.SetBeforeSend((@event, hint) => { // Never report server names @@ -120,9 +124,11 @@ Finally, any settings that can be configured via `appsettings.json` or environme }) ``` -```fsharp {"onboardingOptions": {"performance": "2"}} +```fsharp .UseSentry (fun options -> + // ___PRODUCT_OPTION_START___ performance options.TracesSampleRate <- 1.0 // <- Set this to configure automatic tracing + // ___PRODUCT_OPTION_END___ performance options.SetBeforeSend(fun event hint -> // Never report server names event.ServerName <- null From f46619a9929340cc107488aa875795280b9186d3 Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Mon, 14 Apr 2025 17:45:34 +0100 Subject: [PATCH 2/4] migrate the rest of dotnet platforms to the new syntax --- docs/platforms/dotnet/guides/aws-lambda/index.mdx | 4 +++- .../dotnet/guides/azure-functions-worker/index.mdx | 8 ++++++-- docs/platforms/dotnet/guides/blazor-webassembly/index.mdx | 4 +++- docs/platforms/dotnet/guides/entityframework/index.mdx | 6 +++++- docs/platforms/dotnet/guides/maui/index.mdx | 4 +++- docs/platforms/dotnet/guides/uwp/index.mdx | 4 +++- docs/platforms/dotnet/guides/winforms/index.mdx | 4 +++- docs/platforms/dotnet/guides/winui/index.mdx | 8 ++++++-- docs/platforms/dotnet/guides/wpf/index.mdx | 4 +++- 9 files changed, 35 insertions(+), 11 deletions(-) diff --git a/docs/platforms/dotnet/guides/aws-lambda/index.mdx b/docs/platforms/dotnet/guides/aws-lambda/index.mdx index 967ccc43d38b5..b1a2782f914c1 100644 --- a/docs/platforms/dotnet/guides/aws-lambda/index.mdx +++ b/docs/platforms/dotnet/guides/aws-lambda/index.mdx @@ -35,7 +35,7 @@ All `ASP.NET Core` configurations are valid here. But one configuration in parti `FlushOnCompletedRequest` ensures all events are flushed out. This is because the general ASP.NET Core hooks for when the process is exiting are not guaranteed to run in a serverless environment. This setting ensures that no event is lost if AWS recycles the process. -```csharp {"onboardingOptions": {"performance": "12-15"}} +```csharp public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction { protected override void Init(IWebHostBuilder builder) @@ -47,10 +47,12 @@ public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFu options.Dsn = "___PUBLIC_DSN___"; // When configuring for the first time, to see what the SDK is doing: o.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production o.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Required in Serverless environments options.FlushOnCompletedRequest = true; }) diff --git a/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx b/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx index 3fe0d719ad1df..72d4fb939a3bd 100644 --- a/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx +++ b/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx @@ -33,7 +33,7 @@ This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extens Sentry integration with Azure Functions is done by calling `.UseSentry()` and specifying the options, for example: -```csharp {"onboardingOptions": {"performance": "10-12"}} +```csharp using Sentry.Azure.Functions.Worker; var builder = FunctionsApplication.CreateBuilder(args); @@ -43,9 +43,11 @@ builder.UseSentry(options => options.Dsn = "___PUBLIC_DSN___"; // When configuring for the first time, to see what the SDK is doing: options.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance }); builder.Build().Run(); @@ -57,7 +59,7 @@ If using the ASP.NET Core integration add `UseSentry` to the `ConfigureFunctions -```csharp {"onboardingOptions": {"performance": "11-13"}} +```csharp using Sentry.Azure.Functions.Worker; var host = new HostBuilder() @@ -68,9 +70,11 @@ var host = new HostBuilder() options.Dsn = "___PUBLIC_DSN___"; // When configuring for the first time, to see what the SDK is doing: options.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance }); }) .Build(); diff --git a/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx b/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx index f21bfc6a36bfa..c57831f0aa0e7 100644 --- a/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx +++ b/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx @@ -28,12 +28,14 @@ Sentry integration with Blazor WebAssembly is done by calling `.UseSentry()` and -```csharp {"onboardingOptions": {"performance": "5"}} +```csharp var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.UseSentry(options => { options.Dsn = "___PUBLIC_DSN___"; + // ___PRODUCT_OPTION_START___ performance options.TracesSampleRate = 0.1; + // ___PRODUCT_OPTION_END___ performance // When configuring for the first time, to see what the SDK is doing: // options.Debug = true; }); diff --git a/docs/platforms/dotnet/guides/entityframework/index.mdx b/docs/platforms/dotnet/guides/entityframework/index.mdx index 36e96c1b4b7f5..964b25cc6b543 100644 --- a/docs/platforms/dotnet/guides/entityframework/index.mdx +++ b/docs/platforms/dotnet/guides/entityframework/index.mdx @@ -45,7 +45,7 @@ Add the Entity Framework 6 support to your project in one step: For example, configuring an ASP.NET app with _global.asax_: -```csharp {filename:global.asax} {"onboardingOptions": {"performance": "15-17, 26-35"}} +```csharp {filename:global.asax} using System; using System.Configuration; using Sentry.AspNet; @@ -60,9 +60,11 @@ public class MvcApplication : System.Web.HttpApplication { // We store the DSN inside Web.config options.Dsn = ConfigurationManager.AppSettings["SentryDsn"]; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Add the EntityFramework integration options.AddEntityFramework(); }); @@ -71,6 +73,7 @@ public class MvcApplication : System.Web.HttpApplication // Global error catcher protected void Application_Error() => Server.CaptureLastError(); + // ___PRODUCT_OPTION_START___ performance protected void Application_BeginRequest() { Context.StartSentryTransaction(); @@ -80,6 +83,7 @@ public class MvcApplication : System.Web.HttpApplication { Context.FinishSentryTransaction(); } + // ___PRODUCT_OPTION_END___ performance public override void Dispose() { diff --git a/docs/platforms/dotnet/guides/maui/index.mdx b/docs/platforms/dotnet/guides/maui/index.mdx index 1bd9c89bbd912..6f118ae219dcc 100644 --- a/docs/platforms/dotnet/guides/maui/index.mdx +++ b/docs/platforms/dotnet/guides/maui/index.mdx @@ -45,7 +45,7 @@ This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extens In your `MauiProgram.cs` file, call `UseSentry` on your `MauiAppBuilder`, and include any options you would like to set. The `Dsn` is the only required parameter. -```csharp {"onboardingOptions": {"performance": "19-22"}} +```csharp public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); @@ -64,9 +64,11 @@ public static MauiApp CreateMauiApp() // This option is not recommended when deploying your application. options.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Other Sentry options can be set here. }) diff --git a/docs/platforms/dotnet/guides/uwp/index.mdx b/docs/platforms/dotnet/guides/uwp/index.mdx index f642bf4978951..6a4472359f4e9 100644 --- a/docs/platforms/dotnet/guides/uwp/index.mdx +++ b/docs/platforms/dotnet/guides/uwp/index.mdx @@ -28,7 +28,7 @@ The SDK should be initialized in the constructor of your application class (usua -```csharp {"onboardingOptions": {"performance": "17-20"}} +```csharp using Sentry.Protocol; using UnhandledExceptionEventArgs = Windows.UI.Xaml.UnhandledExceptionEventArgs; @@ -45,9 +45,11 @@ sealed partial class App : Application // When configuring for the first time, to see what the SDK is doing: options.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app. options.IsGlobalModeEnabled = true; diff --git a/docs/platforms/dotnet/guides/winforms/index.mdx b/docs/platforms/dotnet/guides/winforms/index.mdx index e73ac63dacb84..ba9b5573f7762 100644 --- a/docs/platforms/dotnet/guides/winforms/index.mdx +++ b/docs/platforms/dotnet/guides/winforms/index.mdx @@ -30,7 +30,7 @@ You should also set `Application.SetUnhandledExceptionMode(UnhandledExceptionMod A complete example of the recommended startup is as follows: -```csharp {"onboardingOptions": {"performance": "31-34"}} +```csharp using System; using System.Windows.Forms; @@ -61,9 +61,11 @@ namespace WindowsFormsApp1 // When configuring for the first time, to see what the SDK is doing: Debug = true, + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. TracesSampleRate = 1.0, + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app IsGlobalModeEnabled = true, diff --git a/docs/platforms/dotnet/guides/winui/index.mdx b/docs/platforms/dotnet/guides/winui/index.mdx index 20f86c85c8f12..a4243ccc17392 100644 --- a/docs/platforms/dotnet/guides/winui/index.mdx +++ b/docs/platforms/dotnet/guides/winui/index.mdx @@ -32,7 +32,7 @@ In addition to capturing errors, you can monitor interactions between multiple s Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below. -```csharp {"onboardingOptions": {"performance": "16-19"}} +```csharp using Sentry.Protocol; sealed partial class App : Application @@ -48,9 +48,11 @@ sealed partial class App : Application // When configuring for the first time, to see what the SDK is doing: options.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app. options.IsGlobalModeEnabled = true; @@ -77,7 +79,7 @@ Do not initialize the SDK in the `OnLaunched` event of the application or the `H -```csharp {"onboardingOptions": {"performance": "18-21"}} +```csharp // Add these to your existing using statements. using Sentry.Protocol; using UnhandledExceptionEventArgs = Microsoft.UI.Xaml.UnhandledExceptionEventArgs; @@ -95,9 +97,11 @@ sealed partial class App : Application // When configuring for the first time, to see what the SDK is doing: o.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. o.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app. o.IsGlobalModeEnabled = true; diff --git a/docs/platforms/dotnet/guides/wpf/index.mdx b/docs/platforms/dotnet/guides/wpf/index.mdx index 0a15066c38737..d02292da27896 100644 --- a/docs/platforms/dotnet/guides/wpf/index.mdx +++ b/docs/platforms/dotnet/guides/wpf/index.mdx @@ -30,7 +30,7 @@ The SDK should be initialized in the constructor of your application class (usua The SDK automatically handles `AppDomain.UnhandledException`. On WPF, for production apps (when no debugger is attached), WPF catches exception to show the dialog to the user. You can also configure your app to capture those exceptions before the dialog shows up: -```csharp {"onboardingOptions": {"performance": "15-18"}} +```csharp using System.Windows; public partial class App : Application @@ -45,9 +45,11 @@ public partial class App : Application // When configuring for the first time, to see what the SDK is doing: options.Debug = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app options.IsGlobalModeEnabled = true; From 71d5538714ee6da742432149841e0def5aaf86a0 Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Thu, 17 Apr 2025 14:04:24 +0100 Subject: [PATCH 3/4] migrate again --- docs/platforms/dotnet/guides/aspnet/index.mdx | 6 +++++- docs/platforms/dotnet/guides/aspnetcore/index.mdx | 12 +++++++++--- docs/platforms/dotnet/guides/aws-lambda/index.mdx | 4 +++- .../dotnet/guides/azure-functions-worker/index.mdx | 8 ++++++-- .../dotnet/guides/blazor-webassembly/index.mdx | 4 +++- .../dotnet/guides/entityframework/index.mdx | 6 +++++- docs/platforms/dotnet/guides/maui/index.mdx | 4 +++- docs/platforms/dotnet/guides/uwp/index.mdx | 4 +++- docs/platforms/dotnet/guides/winforms/index.mdx | 4 +++- docs/platforms/dotnet/guides/winui/index.mdx | 8 ++++++-- docs/platforms/dotnet/guides/wpf/index.mdx | 4 +++- 11 files changed, 49 insertions(+), 15 deletions(-) diff --git a/docs/platforms/dotnet/guides/aspnet/index.mdx b/docs/platforms/dotnet/guides/aspnet/index.mdx index 12e1e5274d6fb..9dc391e97ef7b 100644 --- a/docs/platforms/dotnet/guides/aspnet/index.mdx +++ b/docs/platforms/dotnet/guides/aspnet/index.mdx @@ -34,7 +34,7 @@ as well as your logs as breadcrumbs. The logging integrations also capture event You configure the SDK in the `Global.asax.cs`: -```csharp {"onboardingOptions": {"performance": "22-25, 35-44"}} +```csharp using System; using System.Web; using Sentry.AspNet; @@ -56,9 +56,11 @@ public class MvcApplication : HttpApplication // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // If you also installed the Sentry.EntityFramework package options.AddEntityFramework(); @@ -69,6 +71,7 @@ public class MvcApplication : HttpApplication // Global error catcher protected void Application_Error() => Server.CaptureLastError(); + // ___PRODUCT_OPTION_START___ performance protected void Application_BeginRequest() { Context.StartSentryTransaction(); @@ -78,6 +81,7 @@ public class MvcApplication : HttpApplication { Context.FinishSentryTransaction(); } + // ___PRODUCT_OPTION_END___ performance protected void Application_End() { diff --git a/docs/platforms/dotnet/guides/aspnetcore/index.mdx b/docs/platforms/dotnet/guides/aspnetcore/index.mdx index 9d1011bb5f27c..a97db264a3479 100644 --- a/docs/platforms/dotnet/guides/aspnetcore/index.mdx +++ b/docs/platforms/dotnet/guides/aspnetcore/index.mdx @@ -69,7 +69,7 @@ The framework takes configuration settings from `appsettings.json`, environment An example of some of the options that can be configured via `appsettings.json`: -```json {filename:appsettings.json} {"onboardingOptions": {"performance": "10"}} +```json {filename:appsettings.json} "Sentry": { "Dsn": "___PUBLIC_DSN___", "SendDefaultPii": true, @@ -79,7 +79,9 @@ An example of some of the options that can be configured via `appsettings.json`: "AttachStackTrace": true, "Debug": true, "DiagnosticLevel": "Error", + // ___PRODUCT_OPTION_START___ performance "TracesSampleRate": 1.0 + // ___PRODUCT_OPTION_END___ performance }, ``` @@ -107,11 +109,13 @@ ASP.NET Core will automatically read this environment variable and bind it to th Finally, any settings that can be configured via `appsettings.json` or environment variables can also be configured via code. Some settings can only be configured in code, such as the `BeforeSend` callback: -```csharp {"onboardingOptions": {"performance": "4"}} +```csharp .UseSentry(options => { options.SendDefaultPii = true; // Adds request URL and headers, IP and name for users, etc. + // ___PRODUCT_OPTION_START___ performance options.TracesSampleRate = 1.0; // Set this to configure automatic tracing + // ___PRODUCT_OPTION_END___ performance options.SetBeforeSend((@event, hint) => { // Never report server names @@ -121,10 +125,12 @@ Finally, any settings that can be configured via `appsettings.json` or environme }) ``` -```fsharp {"onboardingOptions": {"performance": "3"}} +```fsharp .UseSentry (fun options -> options.SendDefaultPii <- true // Adds request URL and headers, IP and name for users, etc. + // ___PRODUCT_OPTION_START___ performance options.TracesSampleRate <- 1.0 // Set this to configure automatic tracing + // ___PRODUCT_OPTION_END___ performance options.SetBeforeSend(fun event hint -> // Never report server names event.ServerName <- null diff --git a/docs/platforms/dotnet/guides/aws-lambda/index.mdx b/docs/platforms/dotnet/guides/aws-lambda/index.mdx index afd3ad9ccda7b..82e03fe40923d 100644 --- a/docs/platforms/dotnet/guides/aws-lambda/index.mdx +++ b/docs/platforms/dotnet/guides/aws-lambda/index.mdx @@ -35,7 +35,7 @@ All `ASP.NET Core` configurations are valid here. But one configuration in parti `FlushOnCompletedRequest` ensures all events are flushed out. This is because the general ASP.NET Core hooks for when the process is exiting are not guaranteed to run in a serverless environment. This setting ensures that no event is lost if AWS recycles the process. -```csharp {"onboardingOptions": {"performance": "14-17"}} +```csharp public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction { protected override void Init(IWebHostBuilder builder) @@ -49,10 +49,12 @@ public class LambdaEntryPoint : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFu o.Debug = true; // Adds request URL and headers, IP and name for users, etc. o.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production o.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Required in Serverless environments options.FlushOnCompletedRequest = true; }) diff --git a/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx b/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx index bf854386b4fc3..22f681b1dfe8f 100644 --- a/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx +++ b/docs/platforms/dotnet/guides/azure-functions-worker/index.mdx @@ -33,7 +33,7 @@ This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extens Sentry integration with Azure Functions is done by calling `.UseSentry()` and specifying the options, for example: -```csharp {"onboardingOptions": {"performance": "12-14"}} +```csharp using Sentry.Azure.Functions.Worker; var builder = FunctionsApplication.CreateBuilder(args); @@ -45,9 +45,11 @@ builder.UseSentry(options => options.Debug = true; // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance }); builder.Build().Run(); @@ -59,7 +61,7 @@ If using the ASP.NET Core integration add `UseSentry` to the `ConfigureFunctions -```csharp {"onboardingOptions": {"performance": "13-15"}} +```csharp using Sentry.Azure.Functions.Worker; var host = new HostBuilder() @@ -72,9 +74,11 @@ var host = new HostBuilder() options.Debug = true; // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance }); }) .Build(); diff --git a/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx b/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx index 82a2aa6950388..359c3ead61f01 100644 --- a/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx +++ b/docs/platforms/dotnet/guides/blazor-webassembly/index.mdx @@ -28,7 +28,7 @@ Sentry integration with Blazor WebAssembly is done by calling `.UseSentry()` and -```csharp {"onboardingOptions": {"performance": "9"}} +```csharp var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.UseSentry(options => { @@ -37,7 +37,9 @@ builder.UseSentry(options => options.Debug = true; // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance options.TracesSampleRate = 0.1; + // ___PRODUCT_OPTION_END___ performance }); // Captures logError and higher as events diff --git a/docs/platforms/dotnet/guides/entityframework/index.mdx b/docs/platforms/dotnet/guides/entityframework/index.mdx index c663056b0f3dd..f93cdd60fd7ca 100644 --- a/docs/platforms/dotnet/guides/entityframework/index.mdx +++ b/docs/platforms/dotnet/guides/entityframework/index.mdx @@ -45,7 +45,7 @@ Add the Entity Framework 6 support to your project in one step: For example, configuring an ASP.NET app with _global.asax_: -```csharp {filename:global.asax} {"onboardingOptions": {"performance": "17-19, 28-37"}} +```csharp {filename:global.asax} using System; using System.Configuration; using Sentry.AspNet; @@ -62,9 +62,11 @@ public class MvcApplication : System.Web.HttpApplication options.Dsn = ConfigurationManager.AppSettings["SentryDsn"]; // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for performance monitoring. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Add the EntityFramework integration options.AddEntityFramework(); }); @@ -73,6 +75,7 @@ public class MvcApplication : System.Web.HttpApplication // Global error catcher protected void Application_Error() => Server.CaptureLastError(); + // ___PRODUCT_OPTION_START___ performance protected void Application_BeginRequest() { Context.StartSentryTransaction(); @@ -83,6 +86,7 @@ public class MvcApplication : System.Web.HttpApplication Context.FinishSentryTransaction(); } + // ___PRODUCT_OPTION_END___ performance public override void Dispose() { _sentrySdk.Dispose(); diff --git a/docs/platforms/dotnet/guides/maui/index.mdx b/docs/platforms/dotnet/guides/maui/index.mdx index 0e077f4dfad8e..ae6fb9c37896f 100644 --- a/docs/platforms/dotnet/guides/maui/index.mdx +++ b/docs/platforms/dotnet/guides/maui/index.mdx @@ -45,7 +45,7 @@ This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extens In your `MauiProgram.cs` file, call `UseSentry` on your `MauiAppBuilder`, and include any options you would like to set. The `Dsn` is the only required parameter. -```csharp {"onboardingOptions": {"performance": "22-25"}} +```csharp public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); @@ -67,9 +67,11 @@ public static MauiApp CreateMauiApp() // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Other Sentry options can be set here. }) diff --git a/docs/platforms/dotnet/guides/uwp/index.mdx b/docs/platforms/dotnet/guides/uwp/index.mdx index 9ba11ed09d016..6f9f4082a4da7 100644 --- a/docs/platforms/dotnet/guides/uwp/index.mdx +++ b/docs/platforms/dotnet/guides/uwp/index.mdx @@ -28,7 +28,7 @@ The SDK should be initialized in the constructor of your application class (usua -```csharp {"onboardingOptions": {"performance": "20-23"}} +```csharp using Sentry.Protocol; using UnhandledExceptionEventArgs = Windows.UI.Xaml.UnhandledExceptionEventArgs; @@ -48,10 +48,12 @@ sealed partial class App : Application // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app. options.IsGlobalModeEnabled = true; diff --git a/docs/platforms/dotnet/guides/winforms/index.mdx b/docs/platforms/dotnet/guides/winforms/index.mdx index 318cf735a49d2..479355d6e8d4a 100644 --- a/docs/platforms/dotnet/guides/winforms/index.mdx +++ b/docs/platforms/dotnet/guides/winforms/index.mdx @@ -30,7 +30,7 @@ You should also set `Application.SetUnhandledExceptionMode(UnhandledExceptionMod A complete example of the recommended startup is as follows: -```csharp {"onboardingOptions": {"performance": "34-37"}} +```csharp using System; using System.Windows.Forms; @@ -64,10 +64,12 @@ namespace WindowsFormsApp1 // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. TracesSampleRate = 1.0, + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app IsGlobalModeEnabled = true, diff --git a/docs/platforms/dotnet/guides/winui/index.mdx b/docs/platforms/dotnet/guides/winui/index.mdx index 77693cb7d3e71..beb9ca8e3f0a3 100644 --- a/docs/platforms/dotnet/guides/winui/index.mdx +++ b/docs/platforms/dotnet/guides/winui/index.mdx @@ -32,7 +32,7 @@ In addition to capturing errors, you can monitor interactions between multiple s Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below. -```csharp {"onboardingOptions": {"performance": "19-22"}} +```csharp using Sentry.Protocol; sealed partial class App : Application @@ -50,10 +50,12 @@ sealed partial class App : Application // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app. options.IsGlobalModeEnabled = true; @@ -80,7 +82,7 @@ Do not initialize the SDK in the `OnLaunched` event of the application or the `H -```csharp {"onboardingOptions": {"performance": "21-24"}} +```csharp // Add these to your existing using statements. using Sentry.Protocol; using UnhandledExceptionEventArgs = Microsoft.UI.Xaml.UnhandledExceptionEventArgs; @@ -100,10 +102,12 @@ sealed partial class App : Application // Adds request URL and headers, IP and name for users, etc. o.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. o.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app. o.IsGlobalModeEnabled = true; diff --git a/docs/platforms/dotnet/guides/wpf/index.mdx b/docs/platforms/dotnet/guides/wpf/index.mdx index 965afbb99df94..17bcf507ee843 100644 --- a/docs/platforms/dotnet/guides/wpf/index.mdx +++ b/docs/platforms/dotnet/guides/wpf/index.mdx @@ -30,7 +30,7 @@ The SDK should be initialized in the constructor of your application class (usua The SDK automatically handles `AppDomain.UnhandledException`. On WPF, for production apps (when no debugger is attached), WPF catches exception to show the dialog to the user. You can also configure your app to capture those exceptions before the dialog shows up: -```csharp {"onboardingOptions": {"performance": "18-21"}} +```csharp using System.Windows; public partial class App : Application @@ -48,10 +48,12 @@ public partial class App : Application // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set traces_sample_rate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance // Enable Global Mode since this is a client app options.IsGlobalModeEnabled = true; From 74a435392b3609a40eef0ab347a5eb662defc69f Mon Sep 17 00:00:00 2001 From: Abdellah Hariti Date: Thu, 17 Apr 2025 15:57:13 +0100 Subject: [PATCH 4/4] migrate missed pages --- docs/platforms/dotnet/guides/xamarin/index.mdx | 4 +++- docs/platforms/dotnet/index.mdx | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/platforms/dotnet/guides/xamarin/index.mdx b/docs/platforms/dotnet/guides/xamarin/index.mdx index f5b5c96fc4fe7..4dd41a94aad02 100644 --- a/docs/platforms/dotnet/guides/xamarin/index.mdx +++ b/docs/platforms/dotnet/guides/xamarin/index.mdx @@ -26,7 +26,7 @@ After you’ve completed setting up a project in Sentry, Sentry will give you a You should initialize the SDK as early as possible, for an example, the start of OnCreate on MainActivity for Android, and, the top of FinishedLaunching on AppDelegate for iOS). -```csharp {"onboardingOptions": {"performance": "10-13"}} +```csharp SentryXamarin.Init(options => { options.AddXamarinFormsIntegration(); @@ -36,10 +36,12 @@ SentryXamarin.Init(options => options.Debug = true; // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // Set TracesSampleRate to 1.0 to capture 100% // of transactions for tracing. // We recommend adjusting this value in production options.TracesSampleRate = 1.0; + // ___PRODUCT_OPTION_END___ performance }); // App code diff --git a/docs/platforms/dotnet/index.mdx b/docs/platforms/dotnet/index.mdx index ec16dde93e1cd..fc934b9e77678 100644 --- a/docs/platforms/dotnet/index.mdx +++ b/docs/platforms/dotnet/index.mdx @@ -81,17 +81,21 @@ Install the **NuGet** package to add the Sentry dependency: To capture all errors, even the one during the startup of your application, you should initialize the Sentry .NET SDK as soon as possible. -```csharp {"onboardingOptions": {"performance": "7-8", "profiling": "9-10"}} +```csharp SentrySdk.Init(options => { options.Dsn = "https://eb18e953812b41c3aeb042e666fd3b5c@o447951.ingest.us.sentry.io/5428537"; options.Debug = true; // Adds request URL and headers, IP and name for users, etc. options.SendDefaultPii = true; + // ___PRODUCT_OPTION_START___ performance // A fixed sample rate of 1.0 - 100% of all transactions are getting sent options.TracesSampleRate = 1.0f; + // ___PRODUCT_OPTION_END___ performance + // ___PRODUCT_OPTION_START___ profiling // A sample rate for profiling - this is relative to TracesSampleRate options.ProfilesSampleRate = 1.0f; + // ___PRODUCT_OPTION_END___ profiling }); ```