Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(.NET): Added EventProcessor #7599

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 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,35 @@
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
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved

```csharp
options.AddEventProcessor(new CustomEventProcessor());
```

After adding it to the scope the processor applies to the current and following scopes
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved

```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.
bitsandfoxes marked this conversation as resolved.
Show resolved Hide resolved

```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
Loading