Skip to content

Count callback_error for native Android events when BeforeSend throws #5682

Description

@jamescrosswell

Part of #5634. Blocked by getsentry/sentry-java#6141, and a Java SDK bump to the release that ships it.

Branch: main. No public API change, and getsentry/sentry-java#6141 targets sentry-java 8.x, so the fix arrives with a regular Java SDK bump.

When the user's BeforeSend throws on a native Android event, #5610's BeforeSendWrapper returns null (Platforms/Android/SentrySdk.cs:246-255). sentry-java then counts before_send / error (SentryClient.java:171-177). sentry-java 8.58.0 has no callback_error reason yet (DiscardReason.java).

getsentry/sentry-java#6141 (part of getsentry/sentry-java#6081) adds DiscardReason.CALLBACK_ERROR and records it when a beforeSend* callback throws. sentry-java already drops the event on a throw; it just counts it as before_send today.

To investigate once it ships

Instead of returning null, BeforeSendCallback.Execute could throw a Java exception. sentry-java would then drop the event and count callback_error itself. This depends on how .NET for Android marshals managed exceptions across JNI, which needs checking on a device.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions