Skip to content

Commit

Permalink
added eventprocessor
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsandfoxes committed Aug 7, 2023
1 parent fde2e76 commit 3a7155d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
34 changes: 34 additions & 0 deletions src/platform-includes/enriching-events/event-processors/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -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()));
```
1 change: 0 additions & 1 deletion src/platforms/common/enriching-events/event-processors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ notSupported:
- android
- apple
- dart
- dotnet
- elixir
- flutter
- go
Expand Down

0 comments on commit 3a7155d

Please sign in to comment.