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

[#1401][part-1] The dashboard supports multiple Coordinator links. #1449

Merged
merged 7 commits into from
Jun 12, 2024

Conversation

yl09099
Copy link
Contributor

@yl09099 yl09099 commented Jan 14, 2024

What changes were proposed in this pull request?

After multiple coordinators are deployed, a dashboard is added to link multiple coordinators.

image

Why are the changes needed?

Fix: #1401

Does this PR introduce any user-facing change?

No.

How was this patch tested?

No.

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2024

Codecov Report

Attention: Patch coverage is 16.00000% with 42 lines in your changes missing coverage. Please review.

Project coverage is 53.91%. Comparing base (6f6d35a) to head (5806b8f).
Report is 49 commits behind head on master.

Files Patch % Lines
...pache/uniffle/dashboard/web/resource/Response.java 0.00% 18 Missing ⚠️
...apache/uniffle/dashboard/web/JettyServerFront.java 0.00% 6 Missing ⚠️
...e/dashboard/web/resource/CoordinatorsResource.java 0.00% 5 Missing ⚠️
...e/uniffle/dashboard/web/proxy/WebProxyServlet.java 0.00% 4 Missing ⚠️
...e/uniffle/dashboard/web/resource/BaseResource.java 0.00% 4 Missing ⚠️
...he/uniffle/dashboard/web/utils/DashboardUtils.java 72.72% 3 Missing ⚠️
...he/uniffle/dashboard/web/resource/WebResource.java 0.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@yl09099 yl09099 force-pushed the uniffle-1141 branch 2 times, most recently from 0e92c00 to eecddd0 Compare January 15, 2024 02:21
@zuston
Copy link
Member

zuston commented Jan 15, 2024

Could you help review this? @xianjingfeng

@zuston zuston requested a review from xianjingfeng January 15, 2024 03:41
//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}
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

@rickyma
Copy link
Contributor

rickyma commented Jan 15, 2024

Can we also fix the following spelling issues in this PR?

My suggesion will be:
ResigerTime -> RegistrationTime
in files:
dashboard/src/main/webapp/src/components/shufflecomponent/ActiveNodeListPage.vue
dashboard/src/main/webapp/src/components/shufflecomponent/DecommissionednodeListPage.vue
dashboard/src/main/webapp/src/components/shufflecomponent/DecommissioningNodeListPage.vue
dashboard/src/main/webapp/src/components/shufflecomponent/LostNodeList.vue
dashboard/src/main/webapp/src/components/shufflecomponent/UnhealthyNodeListPage.vue

@yl09099

@yl09099
Copy link
Contributor Author

yl09099 commented Jan 21, 2024

Can we also fix the following spelling issues in this PR?

My suggesion will be: ResigerTime -> RegistrationTime in files: dashboard/src/main/webapp/src/components/shufflecomponent/ActiveNodeListPage.vue dashboard/src/main/webapp/src/components/shufflecomponent/DecommissionednodeListPage.vue dashboard/src/main/webapp/src/components/shufflecomponent/DecommissioningNodeListPage.vue dashboard/src/main/webapp/src/components/shufflecomponent/LostNodeList.vue dashboard/src/main/webapp/src/components/shufflecomponent/UnhealthyNodeListPage.vue

@yl09099

Have changed.

@yl09099 yl09099 requested a review from xianjingfeng January 24, 2024 05:12
@@ -32,6 +32,7 @@
"core-js": "^3.8.3",
"element-plus": "^2.3.6",
"moment": "^2.29.4",
"pinia": "^2.1.7",
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

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

I suggest remove pinia, we can just use localStorage. @yl09099 @zuston @rickyma PTAL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suggest remove pinia, we can just use localStorage. @yl09099 @zuston @rickyma PTAL

In this case, a global store is required to monitor the address change of the entire page, and localStorage cannot be used, which cannot monitor the change of the requested address.

@rickyma
Copy link
Contributor

rickyma commented Apr 3, 2024

No progress for this? I think we need a more powerful dashboard.

@zuston
Copy link
Member

zuston commented Apr 3, 2024

No progress for this? I think we need a more powerful dashboard.

Do you have thought on this? feel free to discuss more here

@rickyma
Copy link
Contributor

rickyma commented Apr 4, 2024

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:

@zuston

Copy link

github-actions bot commented Apr 14, 2024

Test Results

 2 434 files  +1   2 434 suites  +1   5h 1m 41s ⏱️ + 1m 23s
   935 tests +1     934 ✅ +1   1 💤 ±0  0 ❌ ±0 
10 829 runs  +1  10 815 ✅ +1  14 💤 ±0  0 ❌ ±0 

Results for commit af382be. ± Comparison against base commit cc3f52b.

♻️ This comment has been updated with latest results.

@rickyma
Copy link
Contributor

rickyma commented Apr 15, 2024

This is a flaky test. We can ignore this for now. I have already created an issue for this #1628.

It is ready for review? Can anyone review this? We wanna use this on production this month. @yl09099

@zuston
Copy link
Member

zuston commented Apr 16, 2024

@xianjingfeng Could you help review this?

@zuston zuston requested a review from xianjingfeng April 16, 2024 02:32
@rickyma
Copy link
Contributor

rickyma commented Apr 16, 2024

ping @xianjingfeng

@@ -16,4 +16,16 @@
*/

module.exports ={
// 可以通过配置 vue.config.js 文件来设置代理,以将请求代理到后端服务器。
Copy link
Member

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?

Copy link
Contributor Author

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() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public Response getCoordinatorServers() {
public Response<Map<String, String>> getCoordinatorServers() {

@@ -59,6 +59,12 @@ const routes = [
name: 'applicationpage',
component: ApplicationPage,
},
{
path: '/nullpage',
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary?

Copy link
Contributor Author

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.

@yl09099 yl09099 force-pushed the uniffle-1141 branch 2 times, most recently from 4617229 to 02dcaa1 Compare June 5, 2024 12:27
@yl09099 yl09099 force-pushed the uniffle-1141 branch 3 times, most recently from 5806b8f to 9c1d448 Compare June 9, 2024 14:32
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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 {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public class CoordinatorsResource extends BaseResource {
public class CoordinatorResource extends BaseResource {


package org.apache.uniffle.dashboard.web.resource;

public class Response<T> {
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Map<String, String> stringStringMap = DashboardUtils.convertToMap(coordinatorStr);
Map<String, String> coordinatorAddressMap = DashboardUtils.convertToMap(coordinatorStr);

@xianjingfeng
Copy link
Member

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) {
Copy link
Contributor

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")
Copy link
Contributor

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);
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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

@rickyma
Copy link
Contributor

rickyma commented Jun 11, 2024

Left some minor comments. Once done, we can merge this

@yl09099
Copy link
Contributor Author

yl09099 commented Jun 11, 2024

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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?

@rickyma
Copy link
Contributor

rickyma commented Jun 11, 2024

LGTM. @xianjingfeng We can merge this.

cc @zuston @jerqi

Copy link
Contributor

@jerqi jerqi left a comment

Choose a reason for hiding this comment

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

LGTM.

@xianjingfeng xianjingfeng merged commit fe2efe0 into apache:master Jun 12, 2024
41 checks passed
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.

[Umbrella] Enhance dashboard capabilities.
6 participants