-
Notifications
You must be signed in to change notification settings - Fork 108
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
Convert rest-java to servlet with virtual threads #7488
Convert rest-java to servlet with virtual threads #7488
Conversation
Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7488 +/- ##
============================================
+ Coverage 92.44% 92.47% +0.02%
+ Complexity 6883 6876 -7
============================================
Files 867 867
Lines 28638 28567 -71
Branches 3353 3336 -17
============================================
- Hits 26475 26416 -59
+ Misses 1392 1382 -10
+ Partials 771 769 -2 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
@@ -45,23 +34,4 @@ MeterBinder processMemoryMetrics() { | |||
MeterBinder processThreadMetrics() { | |||
return new ProcessThreadMetrics(); | |||
} | |||
|
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.
Tomcat doesn't provide an easy to duplicate this functionality. We would have to implement. Although not sure it is worth it. We already have server_http metrics from spring. Uris are slightly different but for our use case we can derive the same information from the server_http metrics.
Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
port: 8084 | ||
shutdown: graceful | ||
tomcat: | ||
connection-timeout: 3s | ||
forward-headers-strategy: framework #Enable spring ForwardedHeaderFilter |
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.
This will wrap enable a filter that wraps the request with a request object that utilizes forwarded for headers for common methods like getRemoteAddr()
...irror-rest-java/src/test/java/com/hedera/mirror/restjava/controller/DummyControllerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
.thenAwait(WAIT) | ||
.expectComplete() | ||
.verify(WAIT); | ||
loggingFilter.doFilter(request, response, new MockFilterChain()); |
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.
nit
loggingFilter.doFilter(request, response, new MockFilterChain()); | |
loggingFilter.doFilter(request, response, chain); |
void filterOnCancel(CapturedOutput output) { | ||
var exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build()); | ||
var request = new MockHttpServletRequest("GET", "/"); | ||
; |
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.
nit
; |
// Disable serial and this-escape warnings due to errors in generated code | ||
options.compilerArgs.addAll(listOf("-Werror", "-Xlint:all", "-Xlint:-serial,-this-escape")) | ||
// Disable deprecation, serial, and this-escape warnings due to errors in generated code | ||
options.compilerArgs.addAll(listOf("-Werror", "-Xlint:all", "-Xlint:-deprecation,-serial,-this-escape")) |
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.
I assume it's again the openapi gradle plugin using deprecated methods? We should file a bug upstream.
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.
Yes will do.. Getting a minimal example put together and will file a bug
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.
there is an existing bug report
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
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.
LGTM
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.
LGTM
* convert to use spring web with virtual threads instead of webflux * update logging filter to be compatible with servlet app * update tests to use mockmvc for controller testing * enable spring ForwardedHeaderFilter filter Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
* convert to use spring web with virtual threads instead of webflux * update logging filter to be compatible with servlet app * update tests to use mockmvc for controller testing * enable spring ForwardedHeaderFilter filter Signed-off-by: Jesse Nelson <jesse@swirldslabs.com>
Description:
Related issue(s):
Fixes #7465
Notes for reviewer:
Checklist