diff --git a/src/platform-includes/enriching-events/event-processors/dotnet.mdx b/src/platform-includes/enriching-events/event-processors/dotnet.mdx new file mode 100644 index 0000000000000..3fe26ba3853f9 --- /dev/null +++ b/src/platform-includes/enriching-events/event-processors/dotnet.mdx @@ -0,0 +1,34 @@ +You can create your own event processors by implementing the `ISentryEventProcessor` interfact. You can also create custom processors for transactions by implementing the `ISentryTransactionProcessor`. + +```csharp +using Sentry; +using Sentry.Extensibility; + +public class CustomEventProcessor : ISentryEventProcessor +{ + public SentryEvent? Process(SentryEvent @event) + { + // Add anything to the event here + // returning `null` will drop the event + return @event; + } +} +``` + +There are multie ways of adding the event processors. Processors run on every event sent after they were added. +Adding it to the options ensures the processor runs with every event after initialization + +```csharp +options.AddEventProcessor(new CustomEventProcessor()); +``` + +After adding it to the scope the processor applies to the current and following scopes +```csharp +SentrySdk.ConfigureScope(scope => scope.AddEventProcessor(new CustomEventProcessor())); +``` + +Event processors added to a local scope using `withScope` only apply to events captured inside that scope. + +```csharp +SentrySdk.WithScope(scope => scope.AddEventProcessor(new CustomEventProcessor())); +``` diff --git a/src/platforms/common/enriching-events/event-processors.mdx b/src/platforms/common/enriching-events/event-processors.mdx index 18ccd4e68add5..0ee804f5c5d11 100644 --- a/src/platforms/common/enriching-events/event-processors.mdx +++ b/src/platforms/common/enriching-events/event-processors.mdx @@ -6,7 +6,6 @@ notSupported: - android - apple - dart - - dotnet - elixir - flutter - go