Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Conversation

@davemt
Copy link
Contributor

@davemt davemt commented Aug 4, 2020

Null return is used when the event should be dropped. This aligns with the current handling in sentry-android code and also with the Sentry unified API definition of event processors.

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

💡 Motivation and Context

Alignment with unified API https://develop.sentry.dev/sdk/unified-api/#terminology

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing
  • No breaking changes

🔮 Next steps

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davemt Thanks for contributing.
You're right that it should be nullable, it was just missing the annotation.

Please add it to the implementations too? Also, since this will break anyone implementing this interface (as it broke the build), please set the base branch to 3.0.0 which we're holding our new breaking changes that will land on version 3.0.0

@davemt davemt force-pushed the eventprocessor-process-nullable-return branch from 8336c81 to 8d66f6a Compare August 4, 2020 18:57
@davemt
Copy link
Contributor Author

davemt commented Aug 4, 2020

The in-project implementations (e.g. MainEventProcessor, DefaultAndroidEventProcessor) happen to not be able to return null and so can technically be marked NotNull, even with the Nullable allowance specified on the interface. Would it be better to mark them as Nullable to match interface regardless?

@davemt davemt changed the base branch from master to 3.0.0 August 4, 2020 19:06
Null return is used when the event should be dropped. This aligns with
the current handling in code and also with the Sentry unified API
definition of event processors.
@davemt davemt force-pushed the eventprocessor-process-nullable-return branch from 8d66f6a to b0247ae Compare August 4, 2020 19:09
@bruno-garcia
Copy link
Member

Would it be better to mark them as Nullable to match interface regardless?

You're right, it's best to mark them explicitly to what they do there: @NotNull. The interface on the other hand is @Nullable.

The code in the client already behaves properly, so it's just a matter of annotation:

for (EventProcessor processor : options.getEventProcessors()) {
event = processor.process(event, hint);
if (event == null) {
options
.getLogger()
.log(
SentryLevel.DEBUG,
"Event was dropped by processor: %s",
processor.getClass().getName());
break;
}
}

@bruno-garcia bruno-garcia merged commit ad2e0d8 into getsentry:3.0.0 Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants