[#960][part-1] feat(dashboard): Add some dashboard interfaces. - #1053
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1053 +/- ##
============================================
+ Coverage 53.67% 54.40% +0.73%
+ Complexity 2691 2690 -1
============================================
Files 403 388 -15
Lines 23456 21218 -2238
Branches 1992 2003 +11
============================================
- Hits 12589 11543 -1046
+ Misses 10092 8972 -1120
+ Partials 775 703 -72
... and 21 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
d02cbc2 to
a8b4b43
Compare
| return this.settings.toString(); | ||
| } | ||
|
|
||
| public Set<Map.Entry<String, Object>> getAllEntry() { |
| public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) | ||
| throws IOException, ServletException { | ||
| HttpServletResponse response = (HttpServletResponse) res; | ||
| response.setHeader("Access-Control-Allow-Origin", "*"); |
There was a problem hiding this comment.
why cors should be enabled?
There was a problem hiding this comment.
why cors should be enabled?
The port exposed on the front-end page is different from the Coordinator port. As a result, cross-domain request data may occur.
There was a problem hiding this comment.
If users don't need access Coordinator API directly, we don't need to consider the problem of cross-domain. But I found in current implementation(#1055 ), users access Coordinator API directly, right? @yl09099
But as we discuss in #963 (comment), some operations will be executed in the dashboard module. @jerqi
I feel like the goal is not very clear.
There was a problem hiding this comment.
I think we should discuss this thread first. WDYT? @advancedxy @jerqi @yl09099
There was a problem hiding this comment.
I think we should discuss this thread first. WDYT? @advancedxy @jerqi @yl09099
What's wrong with this cross-domain approach? I'm not familiar with it.
There was a problem hiding this comment.
I think we should discuss this thread first. WDYT? @advancedxy @jerqi @yl09099
If we want to collect my metrics or events, we can finish them in the dashboard module. Dashboard will help us to analyze the jobs in the future. Which job write most data? Which job give the biggest pressure? It's the most important thing for coordinator is stable enough.
But it seems that the current design can't achieve this goal. @jerqi Right? @yl09099
There was a problem hiding this comment.
I think we should discuss this thread first. WDYT? @advancedxy @jerqi @yl09099
If we want to collect my metrics or events, we can finish them in the dashboard module. Dashboard will help us to analyze the jobs in the future. Which job write most data? Which job give the biggest pressure? It's the most important thing for coordinator is stable enough.
But it seems that the current design can't achieve this goal. @jerqi Right? @yl09099
Do the demonstration first, and then gradually improve the management function.
There was a problem hiding this comment.
I have removed the controversial cross-domain issues, do I need to change the others? @xianjingfeng @jerqi
There was a problem hiding this comment.
Could we discuss this issue at our meeting this Wednesday. @yl09099 @jerqi
There was a problem hiding this comment.
Could we discuss this issue at our meeting this Wednesday. @yl09099 @jerqi
OK for me.
| @Path("/{id}") | ||
| public Response<ServerNode> node(@PathParam("id") String id) { | ||
| return execute(() -> getClusterManager().getServerNodeById(id)); | ||
| } | ||
|
|
||
| @GET | ||
| @Path("/nodes") | ||
| public Response<List<ServerNode>> nodes(@QueryParam("status") String status) { | ||
| public Response<List<ServerNode>> nodes() { |
There was a problem hiding this comment.
I don't think this is the right REST api to add.
I think we have agreed to use /nodes/, '/nodes/:id` as our REST API style in the #1000
| return execute( | ||
| () -> { | ||
| CoordinatorConf coordinatorConf = getCoordinatorServer().getCoordinatorConf(); | ||
| Set<Map.Entry<String, Object>> allEntry = coordinatorConf.getAllEntry(); |
There was a problem hiding this comment.
I see why getAllEntry is added.
But I'd rather to defined it as Map<String, String> getAll()
| } | ||
|
|
||
| @GET | ||
| @Path("/nodes/{status}") |
| } | ||
|
|
||
| @GET | ||
| @Path("/nodestatustotal") |
There was a problem hiding this comment.
Maybe /nodes/summary would be better.
| private static final String LOSTNODES_URL = URL_PREFIX + "server/nodes/LOST"; | ||
| private static final String UNHEALTHYNODES_URL = URL_PREFIX + "server/nodes/UNHEALTHY"; |
There was a problem hiding this comment.
Like commented earlier, this would be inappropriate
|
|
||
| package org.apache.uniffle.coordinator.web.vo; | ||
|
|
||
| public class AppInfoVO { |
There was a problem hiding this comment.
what does VO stands for? And is there any design principle for this?
There was a problem hiding this comment.
VO is the data used for display, whether it is displayed in a web page, a client, or an APP, as long as this thing is seen by people, it is called VO
There was a problem hiding this comment.
I think we can use org.apache.uniffle.common.Application directly.
| @Context protected ServletContext servletContext; | ||
|
|
||
| @GET | ||
| @Path("/info") |
There was a problem hiding this comment.
Seems the api route is wrong.
This is more like coordinator conf.
The L63-L65 lines are more like a info path.
There was a problem hiding this comment.
Seems the api route is wrong. This is more like coordinator conf.
The L63-L65 lines are more like a info path.
OK,Yeah, I'll fix it
| import org.apache.uniffle.coordinator.web.vo.UserAppNumVO; | ||
|
|
||
| @Produces({MediaType.APPLICATION_JSON}) | ||
| public class ApplicationResource extends BaseResource { |
There was a problem hiding this comment.
@slfan1989 added some related applications interface in #964 , Maybe you guys should be in sync and decide which paths to added
There was a problem hiding this comment.
@asfsecurity Thank you for your help reviewing the code! I discussed offline with @yl09099, we plan to merge #964 first, and then yl09099 will improve. I will improve the code of #964 in 1-2 days.
There was a problem hiding this comment.
@advancedxy @jerqi Could you continue to review this for me?
c3581b8 to
177b535
Compare
| List<AppInfoVO> userToAppList = new ArrayList<>(); | ||
| SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| Map<String, Map<String, Long>> currentUserAndApp = | ||
| getApplicationManager().getQuotaManager().getCurrentUserAndApp(); |
| Set<String> appIds = getApplicationManager().getAppIds(); | ||
| Map<String, Integer> appTotalityMap = new HashMap<>(); | ||
| appTotalityMap.put("appTotality", appIds.size()); | ||
| return appTotalityMap; |
There was a problem hiding this comment.
How about returning appIds.size() directly?
There was a problem hiding this comment.
How about returning
appIds.size()directly?
It feels better to have a unique identifier on the front end to get this value.
|
|
||
| @GET | ||
| @Path("/info") | ||
| public Response<Map> getCoodConf() { |
There was a problem hiding this comment.
| public Response<Map> getCoodConf() { | |
| public Response<Map<String, Object>> getCoordinatorConf() { |
| .filter(node -> ServerStatus.DECOMMISSIONING.equals(node.getStatus())) | ||
| .peek(e -> decommissioningNodes.add(e)) | ||
| .collect(Collectors.toList()); | ||
| return decommissioningNodes; |
There was a problem hiding this comment.
We can remove this line, and line 279, 282.
ba10382 to
0539152
Compare
| } else if (ServerStatus.DECOMMISSIONED.name().equalsIgnoreCase(status)) { | ||
| serverList = clusterManager.getDecommissionedServerList(); | ||
| } else if (ServerStatus.DECOMMISSIONING.name().equalsIgnoreCase(status)) { | ||
| serverList = clusterManager.getDecommissioningServerList(); |
There was a problem hiding this comment.
We can remove L74 to L77 because of #1174 .
If this is removed, how can the two DECOMMISSIONED and DECOMMISSIONING servernodes be obtained?
There was a problem hiding this comment.
You can take a look at the original logic in the master branch.
https://github.com/apache/incubator-uniffle/blob/f793a22dc8e5b821611b662e2a3227faac0731a2/coordinator/src/main/java/org/apache/uniffle/coordinator/web/resource/ServerResource.java#L75-L84
|
|
||
| public static <T> Response<T> success(T data) { | ||
| return new Response<>(SUCCESS_CODE, data, null); | ||
| return new Response<>(SUCCESS_CODE, data, "success"); |
There was a problem hiding this comment.
Why returning success? What is the purpose?
There was a problem hiding this comment.
Why returning
success? What is the purpose?
This method is the success method, but the return message does not have any message, the front end can also judge the success of the message.
|
|
||
| @GET | ||
| @Path("/conf") | ||
| public Response<List<CoordinatorConfVO>> getCoordinatorInfo() { |
There was a problem hiding this comment.
I think we don't need CoordinatorConfVO, Returning Response<Map<String, Object>> is better.
There was a problem hiding this comment.
| public Response<List<CoordinatorConfVO>> getCoordinatorInfo() { | |
| public Response<List<CoordinatorConfVO>> getCoordinatorConf() { |
There was a problem hiding this comment.
I think we don't need
CoordinatorConfVO, ReturningResponse<Map<String, Object>>is better.
I find the object code more readable and difficult to understand using Map form.
|
|
||
| @GET | ||
| @Path("/usertotal") | ||
| public Response<List<UserAppNumVO>> getUserApps() { |
There was a problem hiding this comment.
ditto. Returning Response<Map<String, Integer>> is better.
| } | ||
|
|
||
| @GET | ||
| @Path("/appinfos") |
There was a problem hiding this comment.
| @Path("/appinfos") | |
| @Path("/appInfos") |
8a3b94f to
f793a22
Compare
53c225e to
060b0ac
Compare
|
@jerqi @xianjingfeng Please trigger the compilation for me again, I didn't change anything in Tez |
done. |
bf5e5e3 to
d77aa60
Compare
d77aa60 to
c723014
Compare
xianjingfeng
left a comment
There was a problem hiding this comment.
LGTM. Please take another look. @jerqi @advancedxy
LGTM, @advancedxy Any another suggestion?
|
Wait for two days. See @advancedxy whether has another suggestion. |
|
Merged. Thanks @advancedxy @yl09099 @xianjingfeng |
What changes were proposed in this pull request?
Add a web dashboard for uniffle, providing some dashboard apis
Why are the changes needed?
Provide data support for dashboard
Fix: #960
Does this PR introduce any user-facing change?
Users can obtain relevant metrics information through the new API
How was this patch tested?
Existing UT.