-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fde2e76
commit 3a7155d
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/platform-includes/enriching-events/event-processors/dotnet.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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())); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ notSupported: | |
- android | ||
- apple | ||
- dart | ||
- dotnet | ||
- elixir | ||
- flutter | ||
- go | ||
|