-
-
Notifications
You must be signed in to change notification settings - Fork 444
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 request body extraction for Spring MVC integration #1595
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1595 +/- ##
============================================
- Coverage 76.07% 75.90% -0.18%
- Complexity 1976 2000 +24
============================================
Files 198 202 +4
Lines 6842 6938 +96
Branches 680 689 +9
============================================
+ Hits 5205 5266 +61
- Misses 1305 1334 +29
- Partials 332 338 +6
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I had a couple comments we could discuss on a call if best.
It's rather late and I'm tired so I might be missing something
sentry-spring-boot-starter/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java
Outdated
Show resolved
Hide resolved
sentry-spring/src/main/java/io/sentry/spring/RequestPayloadExtractor.java
Show resolved
Hide resolved
final HttpServletRequest request = resolveHttpServletRequest(servletRequest); | ||
try { | ||
hub.pushScope(); | ||
hub.addBreadcrumb(Breadcrumb.http(request.getRequestURI(), request.getMethod())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need to confirm if this looks like it's an incoming request. I believe this "format" of crumb might have been designed to represent an outgoing HTTP request.
If it won't get confusing with crumbs representing requests done from this process out to the another for example through rest-template, then we're good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's how it's been since 3.0 release. Where can I verify if this is the right format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have an incoming request into a spring process that makes an outgoing request. Would we be able to differentiate the crumbs? Probably at least through the URL.
Doesn't block this PR
sentry-spring/src/main/java/io/sentry/spring/SentrySpringFilter.java
Outdated
Show resolved
Hide resolved
deferring the review to @bruno-garcia as there's already the 1st pass. |
@marandaneto how this would work for OkHttp or other http clients? On the server side, request body is added to events that are triggered within the scope of an HTTP request. I am not sure how would this translate to HTTP clients, as for the clients we just create a breadcrumb and a span. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIce! thanks @maciejwalkowiak
sentry-spring-boot-starter/src/main/java/io/sentry/spring/boot/SentryAutoConfiguration.java
Show resolved
Hide resolved
final HttpServletRequest request = resolveHttpServletRequest(servletRequest); | ||
try { | ||
hub.pushScope(); | ||
hub.addBreadcrumb(Breadcrumb.http(request.getRequestURI(), request.getMethod())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have an incoming request into a spring process that makes an outgoing request. Would we be able to differentiate the crumbs? Probably at least through the URL.
Doesn't block this PR
oh yeah indeed, the OkHttp integration still doesn't raise events if the request failed somehow, so yeah it does not make sense right now. |
📜 Description
Add request body extraction for Spring MVC integration
💡 Motivation and Context
Fixes #1334
💚 How did you test it?
Unit & integration tests, sample projects updated.
📝 Checklist