-
-
Notifications
You must be signed in to change notification settings - Fork 222
Add Hint
support to beforeSend and Event processors
#1469
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
Comments
BeforeSend
callbackBeforeSend
callback
One solution to this is adding |
It would be great to have this |
Blocks getsentry/sentry-unity#492 |
@bruno-garcia can u share an example how u expect the api usage to look if we use the hint approach |
Some user-doc info on How it's used to add screenshot attachments in sentry-java: https://github.com/getsentry/sentry-java/blob/6270232e48719ccbba243a02a6107413fcdbd6df/sentry-android-core/src/main/java/io/sentry/android/core/ScreenshotEventProcessor.java#L95 And also how users can remove the screenshot in BeforeSend: https://github.com/getsentry/sentry-java/pull/2046/files#diff-f2e9a27fd40ccf0ccec3a5f45afc8d2375d5d72826bd39f38bb4c3f58b988603R1875 |
BeforeSend
callbackHint
support to beforeSend and Event processors
Note, this also applies to https://docs.sentry.io/platforms/dotnet/configuration/options/#before-breadcrumb |
Because we've currently implemented I'd like to handle this as follows: public class SentryOptions
{
// ...
internal Func<SentryEvent, Hint, SentryEvent?>? _beforeSend;
public void SetBeforeSend(Func<SentryEvent, SentryEvent?> beforeSend)
{
_beforeSend = (e, _) => beforeSend(e);
}
public void SetBeforeSend(Func<SentryEvent, Hint, SentryEvent?> beforeSend)
{
_beforeSend = beforeSend;
}
[Obsolete("This property will be removed in a future version. Use SetBeforeSend instead.")]
public Func<SentryEvent, SentryEvent?>? BeforeSend
{
get => null;
set => _beforeSend = value is null ? null : (e, _) => value(e);
}
// ...
} The usage would then change from: options.BeforeSend = @event => { ... }; To the following: options.SetBeforeSend(@event => { ... }); ... or when hints are desired: options.SetBeforeSend((@event, hint) => { ... }); |
So looking into this at the moment. It looks mostly straight forward... the bits that are still foggy are how/why the Sentry.NET SDK interacts with the Java SDK on Android. In
So it takes a Java SDK event and hint, should eventually convert both of these to Sentry .NET equivalents, invoke the .NET implementation of Why do we do this? As I understand it, the Java SDK has already implemented hints and already has its own implementation of |
That code is related to .NET Android (e.g. MAUI), which we bundle the native Sentry Android SDK. It applies when there's a native crash in Java code that would otherwise be unable to be handled in .NET. The callback you highlighted is so that a .NET developer can write a For now, please focus on the .NET side only. We can leave this mobile parts unimplemented and create a new work item for bridging hints to |
Uh oh!
There was an error while loading. Please reload this page.
Hi, Sentry is great!
I am however missing a way to add an attachment to an outgoing event in the
BeforeSend
callback.For example:
Am I missing something, or this is a missing feature?
The text was updated successfully, but these errors were encountered: