This is an automated email from the ASF dual-hosted git repository.

zuston pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b8f4e092 [MINOR] feat(coordinator/dashboard): Show start time of 
CoordinatorServer to dashboard (#2038)
7b8f4e092 is described below

commit 7b8f4e092924e5c9a869b66ad2203c4478e07277
Author: maobaolong <[email protected]>
AuthorDate: Mon Aug 19 11:19:15 2024 +0800

    [MINOR] feat(coordinator/dashboard): Show start time of CoordinatorServer 
to dashboard (#2038)
    
    ### What changes were proposed in this pull request?
    
    Add start time of coordinator in dashboard
    
    ### Why are the changes needed?
    
    Without this PR, I don't know whether the coordinator has been restarted.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Add start time of coordinator in dashboard
    
    ### How was this patch tested?
    
    <img width="2371" alt="image" 
src="https://github.com/user-attachments/assets/7cf3b338-3ae8-484b-8586-dcfc1b8ac25e";>
---
 .../org/apache/uniffle/coordinator/CoordinatorServer.java    |  6 ++++++
 .../coordinator/web/resource/CoordinatorServerResource.java  |  5 +++--
 .../src/main/webapp/src/pages/CoordinatorServerPage.vue      | 12 ++++++++----
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git 
a/coordinator/src/main/java/org/apache/uniffle/coordinator/CoordinatorServer.java
 
b/coordinator/src/main/java/org/apache/uniffle/coordinator/CoordinatorServer.java
index a4e74f5d5..847afda83 100644
--- 
a/coordinator/src/main/java/org/apache/uniffle/coordinator/CoordinatorServer.java
+++ 
b/coordinator/src/main/java/org/apache/uniffle/coordinator/CoordinatorServer.java
@@ -61,6 +61,7 @@ public class CoordinatorServer {
   private static final Logger LOG = 
LoggerFactory.getLogger(CoordinatorServer.class);
 
   private final CoordinatorConf coordinatorConf;
+  private final long startTimeMs;
   private JettyServer jettyServer;
   private ServerInterface server;
   private ClusterManager clusterManager;
@@ -73,6 +74,7 @@ public class CoordinatorServer {
   private String id;
 
   public CoordinatorServer(CoordinatorConf coordinatorConf) throws Exception {
+    this.startTimeMs = System.currentTimeMillis();
     this.coordinatorConf = coordinatorConf;
     try {
       initialization();
@@ -274,4 +276,8 @@ public class CoordinatorServer {
   protected void blockUntilShutdown() throws InterruptedException {
     server.blockUntilShutdown();
   }
+
+  public long getStartTimeMs() {
+    return startTimeMs;
+  }
 }
diff --git 
a/coordinator/src/main/java/org/apache/uniffle/coordinator/web/resource/CoordinatorServerResource.java
 
b/coordinator/src/main/java/org/apache/uniffle/coordinator/web/resource/CoordinatorServerResource.java
index f0e4fc91f..89c7b3555 100644
--- 
a/coordinator/src/main/java/org/apache/uniffle/coordinator/web/resource/CoordinatorServerResource.java
+++ 
b/coordinator/src/main/java/org/apache/uniffle/coordinator/web/resource/CoordinatorServerResource.java
@@ -69,11 +69,11 @@ public class CoordinatorServerResource extends BaseResource 
{
 
   @GET
   @Path("/info")
-  public Response<Map<String, String>> getCoordinatorInfo() {
+  public Response<Map<String, Object>> getCoordinatorInfo() {
     return execute(
         () -> {
           final CoordinatorConf coordinatorConf = 
getCoordinatorServer().getCoordinatorConf();
-          Map<String, String> coordinatorServerInfo = new HashMap<>();
+          Map<String, Object> coordinatorServerInfo = new HashMap<>();
           coordinatorServerInfo.put(
               "coordinatorId", 
coordinatorConf.getString(CoordinatorUtils.COORDINATOR_ID, "none"));
           coordinatorServerInfo.put("serverIp", RssUtils.getHostIp());
@@ -83,6 +83,7 @@ public class CoordinatorServerResource extends BaseResource {
               "serverWebPort", 
String.valueOf(coordinatorConf.get(JETTY_HTTP_PORT)));
           coordinatorServerInfo.put("version", Constants.VERSION);
           coordinatorServerInfo.put("gitCommitId", Constants.REVISION_SHORT);
+          coordinatorServerInfo.put("startTime", 
getCoordinatorServer().getStartTimeMs());
           return coordinatorServerInfo;
         });
   }
diff --git a/dashboard/src/main/webapp/src/pages/CoordinatorServerPage.vue 
b/dashboard/src/main/webapp/src/pages/CoordinatorServerPage.vue
index 339f0bb6f..9d0cc7a5c 100644
--- a/dashboard/src/main/webapp/src/pages/CoordinatorServerPage.vue
+++ b/dashboard/src/main/webapp/src/pages/CoordinatorServerPage.vue
@@ -89,7 +89,7 @@
                   Version
                 </div>
               </template>
-              {{ pageData.serverInfo.version}}
+              {{ pageData.serverInfo.version }}_{{ 
pageData.serverInfo.gitCommitId }}
             </el-descriptions-item>
             <el-descriptions-item>
               <template #label>
@@ -97,10 +97,12 @@
                   <el-icon :style="iconStyle">
                     <Wallet />
                   </el-icon>
-                  Git CommitId
+                  Start Time
                 </div>
               </template>
-              {{ pageData.serverInfo.gitCommitId}}
+              <template #default>
+                {{ dateFormatter(null, null, pageData.serverInfo.startTime) }}
+              </template>
             </el-descriptions-item>
           </el-descriptions>
         </div>
@@ -131,6 +133,7 @@ import {
   getCoordinatorStacks
 } from '@/api/api'
 import { useCurrentServerStore } from '@/store/useCurrentServerStore'
+import { dateFormatter } from '@/utils/common'
 
 export default {
   setup() {
@@ -254,7 +257,8 @@ export default {
       handlerPromMetrics,
       handlerStacks,
       filteredTableData,
-      searchKeyword
+      searchKeyword,
+      dateFormatter
     }
   }
 }

Reply via email to