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

Add ServerWebExchange as hint in SentryWebExceptionHandler #2974

Closed
usrivastava92 opened this issue Oct 9, 2023 · 2 comments · Fixed by #2977
Closed

Add ServerWebExchange as hint in SentryWebExceptionHandler #2974

usrivastava92 opened this issue Oct 9, 2023 · 2 comments · Fixed by #2977

Comments

@usrivastava92
Copy link
Contributor

Problem Statement

Problem:
In SpringBoot Webflux, exceptions are intercepted by the SentryWebExceptionHandler. Here, a SentryEvent is generated prior to invoking hub.captureEvent(event, hint);. Both ServerHttpRequest and ServerHttpResponse are embedded in the Hint object. Given that the same Hint and Sentry Event objects are forwarded to SentryOptions.BeforeSendCallback, information derived solely from the request or response can be utilized to establish logic within BeforeSendCallback.

This creates a limitation where if a user intends to utilize exchange attributes within BeforeSendCallback to formulate logic, they are restricted from doing so.

Screenshots:
Screenshot 2023-10-09 at 9 02 33 PM

Solution Brainstorm

An easy fix for this problem involves setting ServerWebExchange as a property in internalStorage map of the Hint object

@adinauer
Copy link
Member

Hello @usrivastava92 thanks for the feedback. I presume simply adding ServerWebExchange to Hint, e.g. as WEBFLUX_EXCEPTION_HANDLER_EXCHANGE would solve the problem, correct?

@usrivastava92
Copy link
Contributor Author

usrivastava92 commented Oct 10, 2023

@adinauer that is correct, here is the PR to fix this 🙂

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

Successfully merging a pull request may close this issue.

2 participants