Skip to content
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

Change the behavior of excluded_exceptions option #822

Merged
merged 4 commits into from
May 27, 2019

Conversation

Jean85
Copy link
Collaborator

@Jean85 Jean85 commented May 23, 2019

This PR stems/fixes #820 and the related getsentry/sentry-symfony#216.

The current behavior of the excluded_exceptions option is broken, since it just excludes exceptions from the exception key in the event payload, which results in broken or empty exception chains reported.

Instead, the correct behavior should be ignoring the automatic capturing of a set of exceptions, like excluding 404 exceptions from frameworks.

tests/ClientTest.php Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
tests/ClientTest.php Outdated Show resolved Hide resolved
tests/ClientTest.php Outdated Show resolved Hide resolved
tests/ClientTest.php Outdated Show resolved Hide resolved
@ste93cry ste93cry added this to the 2.1 milestone May 23, 2019
@Jean85 Jean85 requested a review from ste93cry May 23, 2019 13:48
Copy link
Collaborator

@stayallive stayallive left a comment

Choose a reason for hiding this comment

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

👌

@ste93cry
Copy link
Collaborator

I was thinking if it makes sense to do the check of the option in the captureEvent method instead of in captureException (which is just a "proxy" method). The reason is that if someone uses the first one the option will not work, which may not be consistent with the expected behavior

@Jean85
Copy link
Collaborator Author

Jean85 commented May 27, 2019

I considered that approach, but it's less clear: it would have to inspect the exception key of the payload, and it doesn't have a way to discern if that is the origin of the event, or if it's just a collateral.

IMHO the captureException conveys the correct requested behavior, and it's more controllable. If anyone wants to apply a blanket ignore on the exception key of the payload, then before_send is the correct way to go, and it's not something that we should touch ourselves.

@ste93cry
Copy link
Collaborator

it doesn't have a way to discern if that is the origin of the event, or if it's just a collateral

I suppose we should not care if the exception is originating the event or is just additional data of the payload as long as the option works coherently

If anyone wants to apply a blanket ignore on the exception key of the payload, then before_send is the correct way to go, and it's not something that we should touch ourselves

Setting the exception key of the payload is the official way to set an exception on the event object, so applying the option on it would just provide coherent behavior across all methods. I'm really torn on what to do here, maybe an opinion from @HazAT or @stayallive could help us take a decision. Apart from this point, LGTM

@stayallive
Copy link
Collaborator

stayallive commented May 27, 2019

Hmm this is a tricky one, but I would say captureException makes more sense. Since that deals with capturing an exception specifically.

If I were to call captureEvent myself I would not expect it to drop the event because I included an ignored exception. (possibly even nice to have the option to do submit ignored exceptions "manually")

@ste93cry
Copy link
Collaborator

If I were to call captureEvent myself I would not expect it to drop the event because I included an ignored exception

Wouldn't the same reasoning apply to the captureException method?

@stayallive
Copy link
Collaborator

Yes. Yes it would. But since its called excluded_exceptions this makes more sense IMO.

Best case would be to only exclude “auto” captured exceptions. But we have no way of identifying them currently so IMO this would be the best approach.

@ste93cry
Copy link
Collaborator

I'm not really happy with some options (this one being one of them) that apply only in certain situations since they make the behavior less predictable or not predictable at all. However, LGTM, let's see what happens and if someone else complains we will act accordingly 👍

@stayallive
Copy link
Collaborator

Probably a good thing to actually add this option to the documentation and be explicit about how it works there. Than at least it’s documented.

@ste93cry ste93cry merged commit d407aa1 into master May 27, 2019
@ste93cry ste93cry deleted the fix-excluded-exceptions-behavior branch May 27, 2019 17:22
@ste93cry
Copy link
Collaborator

Yup, if someone can take care of opening a PR in the getsentry/sentry-docs repository it would be great!

@Jean85
Copy link
Collaborator Author

Jean85 commented May 28, 2019

Done in getsentry/sentry-docs#1019. To be fair, the docs already described the behavior that this PR implements, I only added the captureEvent clarification.

@pgrimaud
Copy link
Contributor

pgrimaud commented Jun 2, 2019

Hi,

A new release with this fix is ​​expected soon? 😄
I hate having package as dev-master to my composer.json files.

Thanks

@rvanlaak
Copy link
Contributor

rvanlaak commented Nov 5, 2019

Could there be a regression introduced with the v2.2.x minor? getsentry/sentry-symfony#216 (comment)

@Jean85
Copy link
Collaborator Author

Jean85 commented Nov 5, 2019

Nope, that's related to the Symfony bundle. Also, this MR is present and released with d407aa1 since 2.1.1.

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

Successfully merging this pull request may close these issues.

Event without exceptions and an empty message
5 participants