Skip to content

Add ServerWebExchange as hint in SentryWebExceptionHandler #2974

Description

@usrivastava92

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

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

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions