From 1d712fd4a6d7f6cb2d615eb999c602d8d947e528 Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Mon, 22 May 2023 23:32:49 -0600 Subject: [PATCH 01/10] Document TagFilters --- src/platforms/dotnet/guides/extensions-logging/index.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platforms/dotnet/guides/extensions-logging/index.mdx b/src/platforms/dotnet/guides/extensions-logging/index.mdx index 17f55cb14e406..4ef87004ce8cf 100644 --- a/src/platforms/dotnet/guides/extensions-logging/index.mdx +++ b/src/platforms/dotnet/guides/extensions-logging/index.mdx @@ -150,6 +150,10 @@ Whether or not this integration should initialize the SDK. If you intend to call A list of filters which are invoked before processing any log message. This allows you to inspect the details of the log entry before they become a `Breadcrumb` or an `Event` with full access to the `Microsoft.Extensions.Logging` data. +#### TagFilters + +A list of filters which are invoked before processing any log message to filter out undesired tags. + ### Samples - A [simple example](https://github.com/getsentry/sentry-dotnet/tree/main/samples/Sentry.Samples.ME.Logging) using simply the `LoggerFactory`. From f7a6d16315670a22cbf7927b9baebdb73220f38e Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Tue, 23 May 2023 00:01:50 -0600 Subject: [PATCH 02/10] Azure Functions isolated worker SDK --- .../guides/azure-functions-worker/config.yml | 2 + .../guides/azure-functions-worker/index.mdx | 47 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/platforms/dotnet/guides/azure-functions-worker/config.yml create mode 100644 src/platforms/dotnet/guides/azure-functions-worker/index.mdx diff --git a/src/platforms/dotnet/guides/azure-functions-worker/config.yml b/src/platforms/dotnet/guides/azure-functions-worker/config.yml new file mode 100644 index 0000000000000..57b017f1d7f65 --- /dev/null +++ b/src/platforms/dotnet/guides/azure-functions-worker/config.yml @@ -0,0 +1,2 @@ +title: Azure Functions Isolated Worker +sdk: sentry.dotnet.azurefunctions.worker diff --git a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx new file mode 100644 index 0000000000000..3b69f90d7a667 --- /dev/null +++ b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx @@ -0,0 +1,47 @@ +--- +title: Azure Functions Isolated Worker +description: "Learn about Sentry's .NET integration with Azure Functions Isolated Worker." +--- + +Sentry provides an integration with Azure Functions Isolated Worker through the [Sentry.AzureFunctions.Worker NuGet package](https://www.nuget.org/packages/Sentry.AzureFunctions.Worker). +All triggers are supported. + +## Install + +Add the Sentry dependency: + +```powershell {tabTitle:Package Manager} +Install-Package Sentry.AzureFunctions.Worker -Version {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} +``` + +```shell {tabTitle:.NET Core CLI} +dotnet add package Sentry.AzureFunctions.Worker -v {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} +``` + +You can combine this integration with a logging library like `log4net`, `NLog`, or `Serilog`. The logging integration also capture events when an error is logged. + +### Configuring + +All `ASP.NET Core` configurations are valid here. But one configuration in particular is relevant. + +`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 +var host = new HostBuilder() + .ConfigureFunctionsWorkerDefaults((host, builder) => + { + builder.UseSentry(host, options => + { + // o.Dsn = ""; + options.EnableTracing = true; + // When configuring for the first time, to see what the SDK is doing: + // options.Debug = true; + }); + }) + .Build(); +await host.RunAsync(); +``` + +## Samples + +- [Integration with Azure Functions](https://github.com/getsentry/sentry-dotnet/tree/main/src/Sentry.AzureFunctions.Worker) sample demonstrates Sentry with Azure Functions Isolated Worker SDK. (**C#**) From b100389334db6f905e9c559f77262bfc0e64b9bb Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Fri, 26 May 2023 01:56:33 -0600 Subject: [PATCH 03/10] Apply suggestions from code review Co-authored-by: Liza Mock --- src/platforms/dotnet/guides/azure-functions-worker/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx index 3b69f90d7a667..1adf5dcdd2fb7 100644 --- a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx +++ b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx @@ -18,9 +18,9 @@ Install-Package Sentry.AzureFunctions.Worker -Version {{@inject packages.version dotnet add package Sentry.AzureFunctions.Worker -v {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} ``` -You can combine this integration with a logging library like `log4net`, `NLog`, or `Serilog`. The logging integration also capture events when an error is logged. +You can combine this integration with a logging library like `log4net`, `NLog`, or `Serilog`. The logging integration also captures events when an error is logged. -### Configuring +## Configure All `ASP.NET Core` configurations are valid here. But one configuration in particular is relevant. From f4c9c7077bcd410209e7991b89a661a94801a43f Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Fri, 26 May 2023 02:02:00 -0600 Subject: [PATCH 04/10] Update index.mdx Remove unnecessary asp.net core verbage --- src/platforms/dotnet/guides/azure-functions-worker/index.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx index 1adf5dcdd2fb7..68e74a386d0ff 100644 --- a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx +++ b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx @@ -22,9 +22,7 @@ You can combine this integration with a logging library like `log4net`, `NLog`, ## Configure -All `ASP.NET Core` configurations are valid here. But one configuration in particular is relevant. - -`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. +Sentry integration with Azure Functions Isolated Worker is done by calling `.UseSentry()` and specifying the options. E.g.: ```csharp var host = new HostBuilder() From d40a0215c96c864ce9827f159b5f8adccdd09d3e Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Sat, 27 May 2023 13:28:40 -0600 Subject: [PATCH 05/10] Apply suggestions from code review Co-authored-by: Matt Johnson-Pint --- .../guides/azure-functions-worker/config.yml | 2 +- .../dotnet/guides/azure-functions-worker/index.mdx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/platforms/dotnet/guides/azure-functions-worker/config.yml b/src/platforms/dotnet/guides/azure-functions-worker/config.yml index 57b017f1d7f65..76036ff3425d2 100644 --- a/src/platforms/dotnet/guides/azure-functions-worker/config.yml +++ b/src/platforms/dotnet/guides/azure-functions-worker/config.yml @@ -1,2 +1,2 @@ -title: Azure Functions Isolated Worker +title: Azure Functions sdk: sentry.dotnet.azurefunctions.worker diff --git a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx index 68e74a386d0ff..51f62c4f5d937 100644 --- a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx +++ b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx @@ -1,14 +1,14 @@ --- -title: Azure Functions Isolated Worker -description: "Learn about Sentry's .NET integration with Azure Functions Isolated Worker." +title: Azure Functions (Isolated Worker) +description: "Learn about Sentry's .NET integration with Azure Functions." --- -Sentry provides an integration with Azure Functions Isolated Worker through the [Sentry.AzureFunctions.Worker NuGet package](https://www.nuget.org/packages/Sentry.AzureFunctions.Worker). +Sentry provides an integration with Azure Functions through the [Sentry.AzureFunctions.Worker NuGet package](https://www.nuget.org/packages/Sentry.AzureFunctions.Worker). All triggers are supported. ## Install -Add the Sentry dependency: +Add the Sentry dependency to your Azure Functions application: ```powershell {tabTitle:Package Manager} Install-Package Sentry.AzureFunctions.Worker -Version {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} @@ -18,11 +18,11 @@ Install-Package Sentry.AzureFunctions.Worker -Version {{@inject packages.version dotnet add package Sentry.AzureFunctions.Worker -v {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} ``` -You can combine this integration with a logging library like `log4net`, `NLog`, or `Serilog`. The logging integration also captures events when an error is logged. +This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extensions-logging/). This means that besides the Azure Functions related features, through this package you'll also get access to the `ILogger` integration and also the features available in the main [Sentry](/platforms/dotnet/) SDK. ## Configure -Sentry integration with Azure Functions Isolated Worker is done by calling `.UseSentry()` and specifying the options. E.g.: +Sentry integration with Azure Functions (when using the Isolated Worker Process execution mode) is done by calling `.UseSentry()` and specifying the options. E.g.: ```csharp var host = new HostBuilder() @@ -30,7 +30,7 @@ var host = new HostBuilder() { builder.UseSentry(host, options => { - // o.Dsn = ""; + options.Dsn = "___PUBLIC_DSN___"; options.EnableTracing = true; // When configuring for the first time, to see what the SDK is doing: // options.Debug = true; From 5f502a08244777b5d6aed9404c366a85fb6827fa Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Sat, 27 May 2023 13:41:59 -0600 Subject: [PATCH 06/10] Add a tag filter example --- .../dotnet/guides/extensions-logging/index.mdx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/platforms/dotnet/guides/extensions-logging/index.mdx b/src/platforms/dotnet/guides/extensions-logging/index.mdx index 4ef87004ce8cf..ebf874ec4fbbf 100644 --- a/src/platforms/dotnet/guides/extensions-logging/index.mdx +++ b/src/platforms/dotnet/guides/extensions-logging/index.mdx @@ -152,7 +152,17 @@ A list of filters which are invoked before processing any log message. This allo #### TagFilters -A list of filters which are invoked before processing any log message to filter out undesired tags. +A list of filters which are invoked before processing any log message to filter out undesired tags. + +E.g. remove all tags starteing with `PROC_` by registering a tag filter. + +```csharp +SentrySdk.Init(options => +{ + options.Dsn = "___PUBLIC_DSN___"; + options.TagFilters.Add("PROC_"); +} +``` ### Samples From 086522fb7ba486c3a7e2aa028c55082fc5dfdd65 Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Sat, 27 May 2023 13:43:34 -0600 Subject: [PATCH 07/10] Swap configuration samples order --- .../dotnet/guides/azure-functions-worker/index.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx index 51f62c4f5d937..6aa20ef8199dd 100644 --- a/src/platforms/dotnet/guides/azure-functions-worker/index.mdx +++ b/src/platforms/dotnet/guides/azure-functions-worker/index.mdx @@ -10,14 +10,14 @@ All triggers are supported. Add the Sentry dependency to your Azure Functions application: -```powershell {tabTitle:Package Manager} -Install-Package Sentry.AzureFunctions.Worker -Version {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} -``` - ```shell {tabTitle:.NET Core CLI} dotnet add package Sentry.AzureFunctions.Worker -v {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} ``` +```powershell {tabTitle:Package Manager} +Install-Package Sentry.AzureFunctions.Worker -Version {{@inject packages.version('sentry.dotnet.azurefunctions.worker') }} +``` + This package extends [Sentry.Extensions.Logging](/platforms/dotnet/guides/extensions-logging/). This means that besides the Azure Functions related features, through this package you'll also get access to the `ILogger` integration and also the features available in the main [Sentry](/platforms/dotnet/) SDK. ## Configure From b176841ec2a7e47d0b86cd2269a6e0207bdae3d7 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 28 May 2023 10:06:36 -0700 Subject: [PATCH 08/10] Update src/platforms/dotnet/guides/extensions-logging/index.mdx --- src/platforms/dotnet/guides/extensions-logging/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/dotnet/guides/extensions-logging/index.mdx b/src/platforms/dotnet/guides/extensions-logging/index.mdx index ebf874ec4fbbf..2fa99b7cf9a81 100644 --- a/src/platforms/dotnet/guides/extensions-logging/index.mdx +++ b/src/platforms/dotnet/guides/extensions-logging/index.mdx @@ -154,7 +154,7 @@ A list of filters which are invoked before processing any log message. This allo A list of filters which are invoked before processing any log message to filter out undesired tags. -E.g. remove all tags starteing with `PROC_` by registering a tag filter. +For example, to remove all tags starting with `PROC_`, add a tag filter to your `SentryOptions` when initializing the SDK. ```csharp SentrySdk.Init(options => From 31e668ade43b8e8ffca97e987bd996a1a27a0b34 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 28 May 2023 10:06:45 -0700 Subject: [PATCH 09/10] Update src/platforms/dotnet/guides/extensions-logging/index.mdx --- src/platforms/dotnet/guides/extensions-logging/index.mdx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/platforms/dotnet/guides/extensions-logging/index.mdx b/src/platforms/dotnet/guides/extensions-logging/index.mdx index 2fa99b7cf9a81..dec49d4bf0271 100644 --- a/src/platforms/dotnet/guides/extensions-logging/index.mdx +++ b/src/platforms/dotnet/guides/extensions-logging/index.mdx @@ -157,11 +157,7 @@ A list of filters which are invoked before processing any log message to filter For example, to remove all tags starting with `PROC_`, add a tag filter to your `SentryOptions` when initializing the SDK. ```csharp -SentrySdk.Init(options => -{ - options.Dsn = "___PUBLIC_DSN___"; - options.TagFilters.Add("PROC_"); -} +options.TagFilters.Add("PROC_"); ``` ### Samples From f5f5b285c79ae5ca1791c348b073f4c81214289b Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Sun, 28 May 2023 10:14:20 -0700 Subject: [PATCH 10/10] lint --- src/platforms/dotnet/guides/extensions-logging/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platforms/dotnet/guides/extensions-logging/index.mdx b/src/platforms/dotnet/guides/extensions-logging/index.mdx index dec49d4bf0271..6cc1aa9255875 100644 --- a/src/platforms/dotnet/guides/extensions-logging/index.mdx +++ b/src/platforms/dotnet/guides/extensions-logging/index.mdx @@ -152,7 +152,7 @@ A list of filters which are invoked before processing any log message. This allo #### TagFilters -A list of filters which are invoked before processing any log message to filter out undesired tags. +A list of filters which are invoked before processing any log message to filter out undesired tags. For example, to remove all tags starting with `PROC_`, add a tag filter to your `SentryOptions` when initializing the SDK.