Skip to content

Add a beforeSend / event-filter hook to SkipSentryOptions for client-side noise filtering #4

Description

@vincentborko

Gap

SkipSentryOptions currently exposes dsn, debug, environment, release, dist, sampleRate, tracesSampleRate, session-tracking, attachStacktrace, etc. — but there is no beforeSend / event-filter hook.

Both underlying SDKs support one:

  • Sentry Cocoa — options.beforeSend = { event in ... } (SentryBeforeSendEventCallback, return nil to drop).
  • Sentry Android — options.setBeforeSend { event, hint -> ... } (BeforeSendCallback, return null to drop).

Because SkipSentry doesn't surface this, apps cannot filter events client-side before they leave the device.

Use case

A SkipFuse app routinely produces a small set of expected, non-actionable errors — cancelled in-flight network requests (user navigates away mid-request), transient offline/connectivity blips that are auto-retried, user-cancelled auth sheets, etc. These are noise, not bugs. The standard Sentry answer is a client-side beforeSend that drops events whose message / exception values match a known-noise list.

Without a bridged hook, the only workaround is to downgrade such benign failures to a lower log level so they never become Sentry events — which loses the local log signal and is easy to get wrong.

Proposal

Add a beforeSend hook to SkipSentryOptions and bridge it into both native init paths.

The native event types differ per platform (Sentry.Event vs io.sentry.SentryEvent) and can't cross the Skip bridge, so the hook would receive a lightweight, bridgeable, read-only projection of the event (message + exception type/value + level) and return it to keep or nil to drop:

SkipSentry.start { options in
    options.dsn = "..."
    options.beforeSend = { event in
        let text = ([event.message] + event.exceptionValues).compactMap { $0 }.joined(separator: " ").lowercased()
        return NOISE.contains(where: text.contains) ? nil : event
    }
}

Happy to send a PR (wrapper struct + both init paths + tests on iOS and Android/Robolectric).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions