You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2021/10/21 03:06:14 UTC

[pinot] branch master updated: Show error message on hover of error status of a segment (#7529)

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

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 1bd899c  Show error message on hover of error status of a segment (#7529)
1bd899c is described below

commit 1bd899c9ba45676d1ac25979274391431bdf5ce9
Author: Sanket Shah <sh...@users.noreply.github.com>
AuthorDate: Thu Oct 21 08:36:00 2021 +0530

    Show error message on hover of error status of a segment (#7529)
---
 .../src/main/resources/app/components/Table.tsx    | 22 +++++++++++++++++++---
 .../src/main/resources/app/requests/index.ts       |  5 ++++-
 .../main/resources/app/utils/PinotMethodUtils.ts   | 21 +++++++++++++++++++--
 3 files changed, 42 insertions(+), 6 deletions(-)

diff --git a/pinot-controller/src/main/resources/app/components/Table.tsx b/pinot-controller/src/main/resources/app/components/Table.tsx
index ffb0928..8400d20 100644
--- a/pinot-controller/src/main/resources/app/components/Table.tsx
+++ b/pinot-controller/src/main/resources/app/components/Table.tsx
@@ -163,6 +163,10 @@ const useStyles = makeStyles((theme) => ({
   cellStatusConsuming: {
     color: '#ff9800',
     border: '1px solid #ff9800',
+  },
+  cellStatusError: {
+    color: '#a11',
+    border: '1px solid #a11',
   }
 }));
 
@@ -345,6 +349,15 @@ export default function CustomizedTables({
         />
       );
     }
+    if (str.toLowerCase() === 'error') {
+      return (
+        <StyledChip
+          label={str}
+          className={classes.cellStatusError}
+          variant="outlined"
+        />
+      );
+    }
     if (str?.toLowerCase()?.search('partial-') !== -1) {
       return (
         <StyledChip
@@ -354,7 +367,7 @@ export default function CustomizedTables({
         />
       );
     }
-    return str.toString();
+    return (<span>{str.toString()}</span>);
   };
 
   const renderTableComponent = () => {
@@ -422,7 +435,7 @@ export default function CustomizedTables({
                   .slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
                   .map((row, index) => (
                     <StyledTableRow key={index} hover>
-                      {Object.values(row).map((cell, idx) =>{
+                      {Object.values(row).map((cell: string | {value: string, tooltip: string}, idx) =>{
                         let url = baseURL;
                         if(regexReplace){
                           const regex = /\:.*?:/;
@@ -444,7 +457,10 @@ export default function CustomizedTables({
                             className={isCellClickable ? classes.isCellClickable : (isSticky ? classes.isSticky : '')}
                             onClick={() => {cellClickCallback && cellClickCallback(cell);}}
                           >
-                            {styleCell(cell.toString())}
+                            {typeof cell === 'object' ?
+                              <Tooltip title={cell?.tooltip || ''} placement="top" arrow>{styleCell(cell.value.toString())}</Tooltip>
+                            : styleCell(cell.toString())
+                            }
                           </StyledTableCell>
                         );
                       })}
diff --git a/pinot-controller/src/main/resources/app/requests/index.ts b/pinot-controller/src/main/resources/app/requests/index.ts
index 2502896..af3b53a 100644
--- a/pinot-controller/src/main/resources/app/requests/index.ts
+++ b/pinot-controller/src/main/resources/app/requests/index.ts
@@ -169,4 +169,7 @@ export const getInfo = (): Promise<AxiosResponse<OperationResponse>> =>
   baseApi.get(`/auth/info`);
 
 export const authenticateUser = (authToken): Promise<AxiosResponse<OperationResponse>> =>
-  baseApi.get(`/auth/verify`, {headers:{"Authorization": authToken}});
\ No newline at end of file
+  baseApi.get(`/auth/verify`, {headers:{"Authorization": authToken}});
+
+export const getSegmentDebugInfo = (tableName: string, tableType: string): Promise<AxiosResponse<OperationResponse>> =>
+  baseApi.get(`debug/tables/${tableName}?type=${tableType}&verbosity=10`);
\ No newline at end of file
diff --git a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
index b81bb37..468852d 100644
--- a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
+++ b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
@@ -66,7 +66,8 @@ import {
   getSchemaList,
   getState,
   getInfo,
-  authenticateUser
+  authenticateUser,
+  getSegmentDebugInfo
 } from '../requests';
 import Utils from './Utils';
 const JSONbig = require('json-bigint')({'storeAsString': true})
@@ -507,18 +508,34 @@ const getTableDetails = (tableName) => {
 //      /segments/:tableName/:segmentName/metadata
 // Expected Output: {columns: [], records: []}
 const getSegmentDetails = (tableName, segmentName) => {
+  const tableInfo = tableName.split('_');
   const promiseArr = [];
   promiseArr.push(getExternalView(tableName));
   promiseArr.push(getSegmentMetadata(tableName, segmentName));
+  promiseArr.push(getSegmentDebugInfo(tableInfo[0], tableInfo[1].toLowerCase()));
 
   return Promise.all(promiseArr).then((results) => {
     const obj = results[0].data.OFFLINE || results[0].data.REALTIME;
     const segmentMetaData = results[1].data;
+    const debugObj = results[2].data;
+    let debugInfoObj = {};
+
+    if(debugObj && debugObj[0]){
+      const debugInfosObj = debugObj[0].segmentDebugInfos?.find((o)=>{return o.segmentName === segmentName});
+      if(debugInfosObj){
+        const serverNames = _.keys(debugInfosObj?.serverState || {});
+        serverNames?.map((serverName)=>{
+          debugInfoObj[serverName] = debugInfosObj.serverState[serverName]?.errorInfo?.errorMessage;
+        });
+      }
+    }
+    console.log(debugInfoObj);
 
     const result = [];
     for (const prop in obj[segmentName]) {
       if (obj[segmentName]) {
-        result.push([prop, obj[segmentName][prop]]);
+        const status = obj[segmentName][prop];
+        result.push([prop, status === 'ERROR' ? {value: status, tooltip: debugInfoObj[prop]} : status]);
       }
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org