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

[ISSUE #4767] Refactor Admin server http handler. #4768

Merged
merged 7 commits into from
Apr 3, 2024

Conversation

karsonto
Copy link
Member

@karsonto karsonto commented Feb 6, 2024

Fixes #4767

Motivation

Explain the content here.
Explain why you want to make the changes and what problem you're trying to solve.

Modifications

Describe the modifications you've done.

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 605 lines in your changes are missing coverage. Please review.

Project coverage is 16.20%. Comparing base (172804a) to head (d383da0).

Files Patch % Lines
...ventmesh/runtime/admin/handler/MetricsHandler.java 0.00% 49 Missing ⚠️
...esh/runtime/admin/handler/AbstractHttpHandler.java 0.00% 47 Missing ⚠️
...ntmesh/runtime/admin/handler/TCPClientHandler.java 0.00% 42 Missing ⚠️
...tmesh/runtime/admin/handler/GrpcClientHandler.java 0.00% 39 Missing ⚠️
...e/admin/handler/RedirectClientByIpPortHandler.java 0.00% 31 Missing ⚠️
...tmesh/runtime/admin/handler/HTTPClientHandler.java 0.00% 29 Missing ⚠️
...ime/admin/handler/RedirectClientByPathHandler.java 0.00% 29 Missing ⚠️
...dmin/handler/RedirectClientBySubSystemHandler.java 0.00% 27 Missing ⚠️
...ime/admin/handler/RejectClientByIpPortHandler.java 0.00% 27 Missing ⚠️
.../admin/handler/RejectClientBySubSystemHandler.java 0.00% 26 Missing ⚠️
... and 18 more
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #4768       +/-   ##
=============================================
+ Coverage          0   16.20%   +16.20%     
- Complexity        0     1711     +1711     
=============================================
  Files             0      856      +856     
  Lines             0    30898    +30898     
  Branches          0     2684     +2684     
=============================================
+ Hits              0     5007     +5007     
- Misses            0    25424    +25424     
- Partials          0      467      +467     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xwm1992
Copy link
Contributor

xwm1992 commented Feb 19, 2024

HttpCommand will be deprecated, we will only use requestURI method for http request, no need to add the requestURI for HttpCommand, you can add the @Deprecated annotation for HttpCommand. @karsonto

@karsonto
Copy link
Member Author

In addition to the admin server, HttpCommand is also used in the Processor of the http server. This class should not be deprecated. @xwm1992

@Pil0tXia
Copy link
Member

So HttpCommand shall be deprecated or not?

@xwm1992
Copy link
Contributor

xwm1992 commented Feb 23, 2024

In addition to the admin server, HttpCommand is also used in the Processor of the http server. This class should not be deprecated. @xwm1992

why not use HttpRequest URL instead of HttpCommand ?

@karsonto
Copy link
Member Author

Because in addition to the HttpRequest URL , HttpCommand also wraps other information such as http method header. @xwm1992

@Pil0tXia
Copy link
Member

Any more problems with the usage of HttpCommand?

Copy link
Member

@Pil0tXia Pil0tXia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpCommand will be deprecated, we will only use requestURI method for http request, no need to add the requestURI for HttpCommand, you can add the @Deprecated annotation for HttpCommand.

I agree. HttpCommand is not designed to parse web requests, although it is still in use.

@karsonto You may try another way to get requestURI, or introduce another dto class suitable for parsing web requests.

@codecov-commenter
Copy link

codecov-commenter commented Apr 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 607 lines in your changes are missing coverage. Please review.

Project coverage is 16.20%. Comparing base (172804a) to head (a62d321).

❗ Current head a62d321 differs from pull request most recent head f90458a. Consider uploading reports for the commit f90458a to get more accurate results

Files Patch % Lines
...ventmesh/runtime/admin/handler/MetricsHandler.java 0.00% 49 Missing ⚠️
...esh/runtime/admin/handler/AbstractHttpHandler.java 0.00% 48 Missing ⚠️
...ntmesh/runtime/admin/handler/TCPClientHandler.java 0.00% 42 Missing ⚠️
...tmesh/runtime/admin/handler/GrpcClientHandler.java 0.00% 39 Missing ⚠️
...e/admin/handler/RedirectClientByIpPortHandler.java 0.00% 31 Missing ⚠️
...tmesh/runtime/admin/handler/HTTPClientHandler.java 0.00% 29 Missing ⚠️
...ime/admin/handler/RedirectClientByPathHandler.java 0.00% 29 Missing ⚠️
...ime/admin/handler/RejectClientByIpPortHandler.java 0.00% 27 Missing ⚠️
...dmin/handler/RedirectClientBySubSystemHandler.java 0.00% 26 Missing ⚠️
.../admin/handler/RejectClientBySubSystemHandler.java 0.00% 26 Missing ⚠️
... and 19 more
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #4768       +/-   ##
=============================================
+ Coverage          0   16.20%   +16.20%     
- Complexity        0     1710     +1710     
=============================================
  Files             0      857      +857     
  Lines             0    30883    +30883     
  Branches          0     2685     +2685     
=============================================
+ Hits              0     5005     +5005     
- Misses            0    25410    +25410     
- Partials          0      468      +468     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@karsonto
Copy link
Member Author

karsonto commented Apr 3, 2024

@xwm1992 @Pil0tXia I have revised it according to your suggestion.

@karsonto
Copy link
Member Author

karsonto commented Apr 3, 2024

@Pil0tXia All the issues mentioned previously have been resolved.

Copy link
Member

@Pil0tXia Pil0tXia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Pil0tXia Pil0tXia requested a review from xwm1992 April 3, 2024 09:18
@xwm1992 xwm1992 merged commit 98b1ed1 into apache:master Apr 3, 2024
8 of 9 checks passed
Comment on lines -75 to -85
/**
* Handles requests by redirecting matching clients to a target EventMesh server node.
*
* @param httpExchange the exchange containing the request from the client and used to send the response
* @throws IOException if an I/O error occurs while handling the request
*/
@Override
public void handle(HttpExchange httpExchange) throws IOException {
public void handle(HttpRequest httpRequest, ChannelHandlerContext ctx) throws Exception {
String result = "";
try (OutputStream out = httpExchange.getResponseBody()) {
String queryString = httpExchange.getRequestURI().getQuery();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May you please add the short description of JavaDoc back?

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

Successfully merging this pull request may close these issues.

[Enhancement] Integrate Runtime admin endpoints with Netty server phase 2
4 participants