sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Support Spring WebClient wiretap logging as breadcrumbs

Open yhware opened this issue 4 years ago • 2 comments

Problem Statement

When using Spring WebClient, there's an option to configure "wiretap" to show the details of http request and response including the body. https://www.baeldung.com/spring-log-webclient-calls

This information is extremely useful when debugging errors and therefore it would be nice to see it automatically added to the breadcrumb.

Solution Brainstorm

Although the wiretap logs info to the console, the reason sentry can't pick it up seems to be because it's not in the same thread. To solve this, there must be some way of adding wiretap output to sentry's threadlocal based hub.

yhware avatar Nov 29 '22 02:11 yhware

Hello @yhware, sorry for the delayed reply. I assume you are also interested in non error HTTP responses, correct?

We've recently introduced a way to capture HTTP client errors for mobile (see https://docs.sentry.io/platforms/android/configuration/integrations/okhttp/#http-client-errors). If you're also interested in non error HTTP replies that cause problems when handling them, this wouldn't help.

While this does sound useful, it's currently not on our backlog. So I can't say when or if this is going to be implemented.

As a workaround you could try to log something at ERROR level before or instead of capturing an exception to cause an event that is created via the logging integration which can add previous log lines as breadcrumbs (see https://docs.sentry.io/platforms/java/guides/logback/#minimum-log-level). You may need to adjust the maxBreadcrumbs option to include more than the default 100 lines.

adinauer avatar Dec 06 '22 05:12 adinauer

while this may be a useful feature, this has gone stale, and as state there are workarounds available. If there is still interest in this feature please reopen the issue:)

smeubank avatar Dec 12 '24 12:12 smeubank