-
Notifications
You must be signed in to change notification settings - Fork 154
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
[#1401][part-1] The dashboard supports multiple Coordinator links. #1449
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1449 +/- ##
============================================
- Coverage 54.86% 53.91% -0.96%
- Complexity 2358 2947 +589
============================================
Files 368 440 +72
Lines 16379 23613 +7234
Branches 1504 2197 +693
============================================
+ Hits 8986 12730 +3744
- Misses 6862 10095 +3233
- Partials 531 788 +257 ☔ View full report in Codecov by Sentry. |
0e92c00
to
eecddd0
Compare
Could you help review this? @xianjingfeng |
//The system obtains data from global variables and requests the interface to obtain new data after data changes. | ||
const currentServerStore= useCurrentServerStore() | ||
currentServerStore.$subscribe((mutable,state)=>{ | ||
const headrs={"targetAddress":state.currentServer} |
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.
Is it better that passing this parameter through cookie?
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.
Is it better that passing this parameter through cookie?
This is global. The role of cookies is not well understood.
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.
It is not graceful to set the header before each request. Some code is redundant.
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.
Or maybe you can use local storage and get targetAddress
from the local storage before invoking the http interfaces
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.
dashboard/src/main/java/org/apache/uniffle/dashboard/web/proxy/WebProxyServlet.java
Outdated
Show resolved
Hide resolved
dashboard/src/main/java/org/apache/uniffle/dashboard/web/utils/DashboardUtils.java
Outdated
Show resolved
Hide resolved
dashboard/src/main/java/org/apache/uniffle/dashboard/web/views/GainCoordinatorsServlet.java
Outdated
Show resolved
Hide resolved
Can we also fix the following spelling issues in this PR? My suggesion will be: |
Have changed. |
@@ -32,6 +32,7 @@ | |||
"core-js": "^3.8.3", | |||
"element-plus": "^2.3.6", | |||
"moment": "^2.29.4", | |||
"pinia": "^2.1.7", |
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 just learned about pinia. Can the data in the store be shared between tabs of a browser?
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 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.
No progress for this? I think we need a more powerful dashboard. |
Do you have thought on this? feel free to discuss more here |
I believe the dashboard should be updated regularly, as it provides the most intuitive experience for users. And it facilitates the management and operation of the RSS cluster for dev and ops. I think it could be improved by:
|
@xianjingfeng Could you help review this? |
ping @xianjingfeng |
@@ -16,4 +16,16 @@ | |||
*/ | |||
|
|||
module.exports ={ | |||
// 可以通过配置 vue.config.js 文件来设置代理,以将请求代理到后端服务器。 |
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.
Could you translate this sentence into english?
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.
Could you translate this sentence into english?
done.
|
||
@GET | ||
@Path("/coordinatorList") | ||
public Response getCoordinatorServers() { |
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.
public Response getCoordinatorServers() { | |
public Response<Map<String, String>> getCoordinatorServers() { |
dashboard/src/main/java/org/apache/uniffle/dashboard/web/resource/GainCoordinatorsResource.java
Outdated
Show resolved
Hide resolved
@@ -59,6 +59,12 @@ const routes = [ | |||
name: 'applicationpage', | |||
component: ApplicationPage, | |||
}, | |||
{ | |||
path: '/nullpage', |
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.
Is this necessary?
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.
Is this necessary?
This is a must to prevent clicking on the drop-down box to jump to the road with links.
4617229
to
02dcaa1
Compare
5806b8f
to
9c1d448
Compare
@@ -89,7 +92,9 @@ private void setRootServletHandler() { | |||
HandlerList handlers = new HandlerList(); | |||
ResourceHandler resourceHandler = addResourceHandler(); | |||
String coordinatorWebAddress = conf.getString(DashboardConf.COORDINATOR_WEB_ADDRESS); | |||
ServletContextHandler servletContextHandler = addProxyHandler(coordinatorWebAddress); | |||
Map<String, String> stringStringMap = DashboardUtils.convertToMap(coordinatorWebAddress); |
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.
Map<String, String> stringStringMap = DashboardUtils.convertToMap(coordinatorWebAddress); | |
Map<String, String> coordinatorAddressMap = DashboardUtils.convertToMap(coordinatorWebAddress); |
@Produces({MediaType.APPLICATION_JSON}) | ||
public class WebResource { | ||
@Path("coordinator") | ||
public Class<CoordinatorsResource> getGainCoordinatorsResource() { |
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.
public Class<CoordinatorsResource> getGainCoordinatorsResource() { | |
public Class<CoordinatorsResource> getCoordinatorResource() { |
import org.apache.hbase.thirdparty.javax.ws.rs.core.MediaType; | ||
|
||
@Produces({MediaType.APPLICATION_JSON}) | ||
public class CoordinatorsResource extends BaseResource { |
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.
public class CoordinatorsResource extends BaseResource { | |
public class CoordinatorResource extends BaseResource { |
|
||
package org.apache.uniffle.dashboard.web.resource; | ||
|
||
public class Response<T> { |
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.
Could we move it to the common module? And the same class in the coordinator module.
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.
Could we move it to the common module? And the same class in the coordinator module.
This Response is in the Coordinator module. The Coordinator module is introduced into the dashboard here, which feels a bit awkward. Just like you said, it needs to be migrated to the common module, but I don't think it should be done in this PR.
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.
Could we move it to the common module? And the same class in the coordinator module.
This Response is in the Coordinator module. The Coordinator module is introduced into the dashboard here, which feels a bit awkward. Just like you said, it needs to be migrated to the common module, but I don't think it should be done in this PR.
I'm introducing front-end code inspection to change this.
private static final Logger log = LoggerFactory.getLogger(DashboardUtils.class); | ||
|
||
public static Map<String, String> convertToMap(String coordinatorStr) { | ||
HashMap<String, String> stringMap = Maps.newHashMap(); |
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.
HashMap<String, String> stringMap = Maps.newHashMap(); | |
HashMap<String, String> coordinatorAddressMap = Maps.newHashMap(); |
public void testConvertToMap() { | ||
String coordinatorStr = | ||
"http://coordinator.hostname00:19998/,http://coordinator.hostname01:19998/,http://coordinator.hostname02:19998/,http://coordinator.hostname03:19998/"; | ||
Map<String, String> stringStringMap = DashboardUtils.convertToMap(coordinatorStr); |
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.
Map<String, String> stringStringMap = DashboardUtils.convertToMap(coordinatorStr); | |
Map<String, String> coordinatorAddressMap = DashboardUtils.convertToMap(coordinatorStr); |
LGTM except some minor comments. Please take another look @rickyma |
protected <T> Response<T> execute(Callable<T> callable) { | ||
try { | ||
return Response.success(callable.call()); | ||
} catch (Throwable e) { |
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.
e.getMessage()
: Some exceptions stack trace will be lost. Can we log the full stack trace here?
@Context protected ServletContext servletContext; | ||
|
||
@GET | ||
@Path("/coordinatorList") |
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.
/coordinators
is more in line with the RESTful style.
import org.slf4j.LoggerFactory; | ||
|
||
public class DashboardUtils { | ||
private static final Logger log = LoggerFactory.getLogger(DashboardUtils.class); |
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.
log
-> LOG
Constants are usually modified with static final and named in uppercase.
public class DashboardUtils { | ||
private static final Logger log = LoggerFactory.getLogger(DashboardUtils.class); | ||
|
||
public static Map<String, String> convertToMap(String coordinatorStr) { |
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.
coordinatorStr -> coordinatorAddressesStr
or
coordinatorStr -> addressesStr
if it could be other addresses, e.g. dashboard addresses/server address and so on.
public class DashboardUtils { | ||
private static final Logger log = LoggerFactory.getLogger(DashboardUtils.class); | ||
|
||
public static Map<String, String> convertToMap(String coordinatorStr) { |
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.
convertToMap
-> convertAddressesStrToMap
easier to be understood
Left some minor comments. Once done, we can merge this |
All done.Thanks! |
export function getAllCoordinatorAddrees(params) { | ||
return http.get('/coordinator/coordinatorList', params, {}, 1) | ||
export function getAllCoordinatorAddrees(params,headers) { | ||
return http.get('/coordinator/coordinators', params, headers, 1) |
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 is a little bit weird.
The RESTful style should be something like:
/plural noun
/plural noun/id
e.g.
/coordinators
/coordinators/1
You can refer to https://blog.restcase.com/5-basic-rest-api-design-guidelines/.
I don't know if it is convenient for you to refactor this.
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 is a little bit weird.
The RESTful style should be something like: /plural noun /plural noun/id
e.g. /coordinators /coordinators/1
You can refer to https://blog.restcase.com/5-basic-rest-api-design-guidelines/. I don't know if it is convenient for you to refactor this.
The other interfaces did not follow the restful structure, and there was a PR in the front that I wanted to use the restful structure was rejected.
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.
/coordinator/coordinators
is indeed weird. Can you try to find a solution?
LGTM. @xianjingfeng We can merge this. |
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.
What changes were proposed in this pull request?
After multiple coordinators are deployed, a dashboard is added to link multiple coordinators.
Why are the changes needed?
Fix: #1401
Does this PR introduce any user-facing change?
No.
How was this patch tested?
No.