metrics: make the memory y-unit scale more flexible

system memory is in GiB. app memory is usually in MiB
This commit is contained in:
Girish Ramakrishnan
2025-07-04 10:40:53 +02:00
parent 82ea2cd86d
commit 4caf052199
3 changed files with 18 additions and 18 deletions
+4 -10
View File
@@ -39,7 +39,7 @@ const networkWriteTotal = ref(0);
const blockReadTotal = ref(0);
const blockWriteTotal = ref(0);
let systemMemory = {};
const appMemory = app.memoryLimit || app.manifest.memoryLimit || 256*1024*1024;
let systemCpus = {};
let metricStream = null;
@@ -84,13 +84,7 @@ async function onPeriodChange() {
}
onMounted(async () => {
let error, result;
[error, result] = await systemModel.memory();
if (error) return console.error(error);
systemMemory = result;
[error, result] = await systemModel.cpus();
const [error, result] = await systemModel.cpus();
if (error) return console.error(error);
systemCpus = result;
@@ -124,12 +118,12 @@ onUnmounted(async () => {
<GraphItem ref="memoryGraphItem"
title="Memory"
:subtext="`RAM: ${prettyBinarySize(app.memoryLimit || 256*1024*1024)}`"
:subtext="`RAM: ${prettyBinarySize(app.memoryLimit || app.manifest.memoryLimit || 256*1024*1024)}`"
:period="period"
yscale="memory"
:dataset-labels="['Memory']"
:dataset-colors="['#9ad0f5']"
:memory="systemMemory"
:memory="appMemory"
>
</GraphItem>