diff --git a/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx b/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx index d542e65460..c83e9f23d1 100644 --- a/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx +++ b/src/containers/Tenant/Diagnostics/TenantOverview/TenantOverview.tsx @@ -79,28 +79,36 @@ export function TenantOverview({ const { cpu, blobStorage, - tableStorage, + tabletStorage, memory, cpuUsage, blobStorageLimit, - tableStorageLimit, + tabletStorageLimit, memoryLimit, } = calculateTenantMetrics(tenant); + // If there is table storage limit (data_size_hard_quota), + // use it for metric card instead of blob storage limit + // When datasize exceeds or equals to quota + // all write operations to the database are finished with error + const isTabletStorageLimitSet = tabletStorageLimit && tabletStorageLimit > 0; + const storageUsed = isTabletStorageLimitSet ? tabletStorage : blobStorage; + const storageLimit = isTabletStorageLimitSet ? tabletStorageLimit : blobStorageLimit; + const calculatedMetrics: TenantMetrics = { memoryUsed: memory, memoryLimit, cpuUsed: cpu, cpuUsage, - storageUsed: blobStorage, - storageLimit: blobStorageLimit, + storageUsed, + storageLimit, }; const storageMetrics = { blobStorageUsed: blobStorage, blobStorageLimit, - tableStorageUsed: tableStorage, - tableStorageLimit, + tabletStorageUsed: tabletStorage, + tabletStorageLimit, }; const renderName = () => { diff --git a/src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.tsx b/src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.tsx index 3349c45b30..26c7c12347 100644 --- a/src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.tsx +++ b/src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TenantStorage.tsx @@ -1,7 +1,7 @@ import InfoViewer from '../../../../../components/InfoViewer/InfoViewer'; import {ProgressViewer} from '../../../../../components/ProgressViewer/ProgressViewer'; +import {LabelWithPopover} from '../../../../../components/LabelWithPopover'; import {formatStorageValues} from '../../../../../utils/dataFormatters/dataFormatters'; -import {getSizeWithSignificantDigits} from '../../../../../utils/bytesParsers'; import {TenantDashboard} from '../TenantDashboard/TenantDashboard'; @@ -11,12 +11,13 @@ import {storageDashboardConfig} from './storageDashboardConfig'; import {TopTables} from './TopTables'; import {TopGroups} from './TopGroups'; import {b} from '../utils'; +import i18n from '../i18n'; export interface TenantStorageMetrics { blobStorageUsed?: number; blobStorageLimit?: number; - tableStorageUsed?: number; - tableStorageLimit?: number; + tabletStorageUsed?: number; + tabletStorageLimit?: number; } interface TenantStorageProps { @@ -25,21 +26,21 @@ interface TenantStorageProps { } export function TenantStorage({tenantName, metrics}: TenantStorageProps) { - const {blobStorageUsed, tableStorageUsed, blobStorageLimit, tableStorageLimit} = metrics; - const formatValues = (value?: number, total?: number) => { - const size = getSizeWithSignificantDigits(Number(blobStorageLimit || blobStorageUsed), 0); - - return formatStorageValues(value, total, size); - }; + const {blobStorageUsed, tabletStorageUsed, blobStorageLimit, tabletStorageLimit} = metrics; const info = [ { - label: 'Database storage', + label: ( + + ), value: ( + ), value: ( { const cpu = isNumeric(CoresUsed) ? Number(CoresUsed) * 1_000_000 : undefined; const memory = isNumeric(MemoryUsed) ? Number(MemoryUsed) : undefined; const blobStorage = isNumeric(StorageAllocatedSize) ? Number(StorageAllocatedSize) : undefined; - const tableStorage = isNumeric(Metrics.Storage) ? Number(Metrics.Storage) : undefined; + const tabletStorage = isNumeric(Metrics.Storage) ? Number(Metrics.Storage) : undefined; // We use system pool usage and user pool usage to calculate cpu usage because // only these pools directly indicate resources available to perform user queries @@ -51,7 +51,7 @@ export const calculateTenantMetrics = (tenant?: TTenant) => { const blobStorageLimit = isNumeric(StorageAllocatedLimit) ? Number(StorageAllocatedLimit) : undefined; - const tableStorageLimit = isNumeric(DatabaseQuotas.data_size_hard_quota) + const tabletStorageLimit = isNumeric(DatabaseQuotas.data_size_hard_quota) ? Number(DatabaseQuotas.data_size_hard_quota) : undefined; @@ -59,11 +59,11 @@ export const calculateTenantMetrics = (tenant?: TTenant) => { cpu, memory, blobStorage, - tableStorage, + tabletStorage, cpuUsage, memoryLimit, blobStorageLimit, - tableStorageLimit, + tabletStorageLimit, }; };