---
title: "Filtering"
description: "Learn more about how to configure your SDK to filter events reported to Sentry."
url: https://docs.sentry.io/platforms/godot/configuration/filtering/
---

# Filtering | Sentry for Godot Engine

When you add Sentry to your app, you get a lot of valuable information about errors and performance. And lots of information is good -- as long as it's the right information, at a reasonable volume.

The Sentry SDKs have several configuration options to help you filter out events.

We also offer [Inbound Filters](https://docs.sentry.io/concepts/data-management/filtering.md) to filter events in sentry.io. We recommend filtering at the client level though, because it removes the overhead of sending events you don't actually want. Learn more about the [fields available in an event](https://develop.sentry.dev/sdk/foundations/transport/event-payloads/).

## [Filtering Error Events](https://docs.sentry.io/platforms/godot/configuration/filtering.md#filtering-error-events)

Configure your SDK to filter error events by using the `before_send` callback method and configuring, enabling, or disabling integrations.

### [Using `before_send`](https://docs.sentry.io/platforms/godot/configuration/filtering.md#using-before-send)

All Sentry SDKs support the `before_send` callback method. Because it's called immediately before the event is sent to the server, this is your last chance to decide not to send data or to edit it. `before_send` receives the event object as a parameter, which you can use to either modify the event’s data or drop it completely by returning `null`, based on custom logic and the data available on the event.

**GDScript**

```gdscript
class_name ProjectMainLoop
extends SceneTree
## Tip: Set "ProjectMainLoop" as your main loop type in the project settings
##      under `application/run/main_loop_type`.

func _initialize() -> void:
	SentrySDK.init(func(options: SentryOptions) -> void:
		options.before_send = _before_send
	)

func _before_send(event: SentryEvent) -> SentryEvent:
	if event.environment.contains("editor"):
		# Discard event if running from the editor.
		return null
	var error_message: String = event.get_exception_value(0)
	if error_message.contains("Bruno"):
		# Remove sensitive information from the event.
		var redacted_message := error_message.replace("Bruno", "REDACTED")
		event.set_exception_value(0, redacted_message)
	return event
```

**C#**

```csharp
// The .NET before-send hook filters events captured from your C# code.
SentrySdk.Init(options =>
{
    options.SetBeforeSend((sentryEvent, hint) =>
    {
        if (sentryEvent.Environment?.Contains("editor") == true)
        {
            // Discard the event if running from the editor.
            return null;
        }

        foreach (var exception in sentryEvent.SentryExceptions ?? [])
        {
            if (exception.Value?.Contains("Bruno") == true)
            {
                // Remove sensitive information from the event.
                exception.Value = exception.Value.Replace("Bruno", "REDACTED");
            }
        }

        return sentryEvent;
    });
});
```

In C#, `options.SetBeforeSend` filters managed events, such as exceptions from your game's C# code and third-party .NET libraries. Native events are captured in the native layer; to filter them from C#, set `options.Native.SetBeforeSend` inside your `SentrySdk.Init`. This is most useful for engine, GDScript, and GDExtension errors. The callback receives a `SentryNativeEvent` that you can inspect, modify, or drop by returning `null`. Native crash events aren't passed to this callback.

```csharp
SentrySdk.Init(options =>
{
    options.Native.SetBeforeSend(nativeEvent =>
    {
        // Drop a noisy error that you can't fix.
        if (nativeEvent.GetExceptionValue(0)?.Contains("Noisy error") == true)
        {
            return null;
        }
        return nativeEvent;
    });
});
```

Note also that breadcrumbs can be filtered, as discussed in [our Breadcrumbs documentation](https://docs.sentry.io/product/error-monitoring/breadcrumbs.md).
