You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ri...@apache.org on 2022/02/14 11:48:03 UTC
[pinot] branch master updated: Showing Reported Size and Estimated Size in human readable format in UI (#8199)
This is an automated email from the ASF dual-hosted git repository.
richardstartin 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 e7f806b Showing Reported Size and Estimated Size in human readable format in UI (#8199)
e7f806b is described below
commit e7f806bb4978839915b80449cc75fdca12201868
Author: Sanket Shah <sh...@users.noreply.github.com>
AuthorDate: Mon Feb 14 17:17:40 2022 +0530
Showing Reported Size and Estimated Size in human readable format in UI (#8199)
---
.../src/main/resources/app/pages/TenantDetails.tsx | 4 ++--
.../src/main/resources/app/utils/PinotMethodUtils.ts | 4 ++--
pinot-controller/src/main/resources/app/utils/Utils.tsx | 15 ++++++++++++++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx b/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx
index 8b8ed7f..f4b80a3 100644
--- a/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx
+++ b/pinot-controller/src/main/resources/app/pages/TenantDetails.tsx
@@ -468,14 +468,14 @@ const TenantPageDetails = ({ match }: RouteComponentProps<Props>) => {
</Grid>
<Tooltip title="Uncompressed size of all data segments" arrow placement="top-start">
<Grid item xs={2}>
- <strong>Reported Size:</strong> {tableSummary.reportedSize}
+ <strong>Reported Size:</strong> {Utils.formatBytes(tableSummary.reportedSize)}
</Grid>
</Tooltip>
<Grid item xs={2}></Grid>
<Tooltip title="Estimated size of all data segments, in case any servers are not reachable for actual size" arrow placement="top-start">
<Grid item xs={2}>
<strong>Estimated Size: </strong>
- {tableSummary.estimatedSize}
+ {Utils.formatBytes(tableSummary.estimatedSize)}
</Grid>
</Tooltip>
<Grid item xs={2}></Grid>
diff --git a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
index cdcad16..211a9b1 100644
--- a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
+++ b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
@@ -422,8 +422,8 @@ const getAllTableDetails = (tablesList) => {
} = result.data;
singleTableData.push(
tableName,
- reportedSizeInBytes,
- estimatedSizeInBytes
+ Utils.formatBytes(reportedSizeInBytes),
+ Utils.formatBytes(estimatedSizeInBytes)
);
} else if (index % 3 === 1) {
// response of getIdealState API
diff --git a/pinot-controller/src/main/resources/app/utils/Utils.tsx b/pinot-controller/src/main/resources/app/utils/Utils.tsx
index d6e22ac..f279e59 100644
--- a/pinot-controller/src/main/resources/app/utils/Utils.tsx
+++ b/pinot-controller/src/main/resources/app/utils/Utils.tsx
@@ -324,6 +324,18 @@ const encodeString = (str: string) => {
return str;
}
+const formatBytes = (bytes, decimals = 2) => {
+ if (bytes === 0) return '0 Bytes';
+
+ const k = 1024;
+ const dm = decimals < 0 ? 0 : decimals;
+ const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
+
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
+}
+
export default {
sortArray,
tableFormat,
@@ -333,5 +345,6 @@ export default {
serialize,
navigateToPreviousPage,
syncTableSchemaData,
- encodeString
+ encodeString,
+ formatBytes
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org