Skip to content

Commit ce506d6

Browse files
committed
fix: speed and units
1 parent 5e59cbc commit ce506d6

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

src/containers/Tenant/Diagnostics/TenantOverview/MetricsTabs/MetricsTabs.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {useSetting, useTypedSelector} from '../../../../../utils/hooks';
1515
import {calculateMetricAggregates} from '../../../../../utils/metrics';
1616
import {
1717
formatCoresLegend,
18+
formatSpeedLegend,
1819
formatStorageLegend,
1920
} from '../../../../../utils/metrics/formatMetricLegend';
2021
import {TenantTabsGroups, getTenantPath} from '../../../TenantPages';
@@ -143,10 +144,10 @@ export function MetricsTabs({
143144
<Link to={tabLinks.network} className={b('link')}>
144145
<TabCard
145146
label={i18n('cards.network-label')}
146-
sublabel={i18n('context_network-evaluation')}
147+
sublabel={i18n('context_network-usage')}
147148
value={networkMetrics.totalUsed}
148149
limit={networkMetrics.totalLimit}
149-
legendFormatter={formatStorageLegend}
150+
legendFormatter={formatSpeedLegend}
150151
active={metricsTab === TENANT_METRICS_TABS_IDS.network}
151152
helpText={i18n('context_network-description')}
152153
/>

src/containers/Tenant/Diagnostics/TenantOverview/i18n/en.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
"cards.storage-label": "Storage",
2424
"cards.memory-label": "Memory used",
2525
"cards.network-label": "Network",
26-
"cards.network-note": "Network usage is the average outgoing bandwidth usage across all nodes in the database",
26+
"cards.network-note": "Network throughput is the average outgoing bandwidth usage across all nodes in the database",
2727
"context_cpu-load": "CPU load",
2828
"context_storage-groups": "Storage: {{count}} groups",
2929
"context_memory-used": "Memory used",
30-
"context_network-evaluation": "Network evaluation",
30+
"context_network-usage": "Network usage",
3131
"context_cpu-description": "CPU load is calculated as the cumulative usage across all actor system pools in the database",
3232
"context_memory-description": "Memory usage is the total memory consumed by all processes in the database",
3333
"context_storage-description": "Storage usage shows how much data is stored in the database including user data and indexes",
34-
"context_network-description": "Network usage is the average outgoing bandwidth usage across all nodes in the database",
34+
"context_network-description": "Network throughput is the average outgoing bandwidth usage across all nodes in the database",
3535
"charts.queries-per-second": "Queries per second",
3636
"charts.queries-latency": "Queries latencies {{percentile}}",
3737
"charts.cpu-usage": "CPU usage by pool",

src/utils/metrics/formatMetricLegend.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {formatBytes, getBytesSizeUnit} from '../bytesParsers';
12
import {
23
formatNumber,
34
formatNumericValues,
@@ -25,3 +26,27 @@ export function formatCoresLegend({value, capacity}: MetricFormatParams): string
2526
}
2627
return `${formatted[0]} ${i18n('context_of')} ${formatted[1]} ${i18n('context_cores')}`;
2728
}
29+
30+
export function formatSpeedLegend({value, capacity}: MetricFormatParams): string {
31+
// Determine unit based on capacity
32+
const unit = getBytesSizeUnit(capacity);
33+
34+
// Format used value without units
35+
const usedSpeed = formatBytes({
36+
value,
37+
size: unit,
38+
precision: 2,
39+
withSpeedLabel: false,
40+
withSizeLabel: false,
41+
});
42+
43+
// Format limit with speed units
44+
const limitSpeed = formatBytes({
45+
value: capacity,
46+
size: unit,
47+
precision: 2,
48+
withSpeedLabel: true,
49+
});
50+
51+
return `${usedSpeed} ${i18n('context_of')} ${limitSpeed}`;
52+
}

0 commit comments

Comments
 (0)