From d7a278ebdacd640719abeca039099f8bae7f414e Mon Sep 17 00:00:00 2001 From: Stefan Zimmermann <5945920+StefanZ8n@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:09:46 +0100 Subject: [PATCH 1/2] Derive run throughput sparkline from bytes written The sparkline plotted the controller's 5s snapshot of the agents' instantaneous MB/s, summed over VMs still working. On short runs a VM writes its few GiB between two snapshots and reports done before the next, so the series was mostly 0 and "peak 0" sat next to a real avgMBps. Derive the rate from the cumulative bytesWritten each sample already stores (averaged over >=10s to avoid agent/poll aliasing), keep the snapshot where it is higher, and show only the peak for finished runs instead of an always-zero "latest". Co-Authored-By: Claude Opus 5.5 --- web/src/components/Sparkline.vue | 7 ++++--- web/src/throughput.ts | 31 +++++++++++++++++++++++++++++++ web/src/views/DeploymentsView.vue | 4 +++- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 web/src/throughput.ts diff --git a/web/src/components/Sparkline.vue b/web/src/components/Sparkline.vue index 01dd63c..564b098 100644 --- a/web/src/components/Sparkline.vue +++ b/web/src/components/Sparkline.vue @@ -3,8 +3,8 @@ import { computed } from 'vue' // A dependency-free inline-SVG line chart for a throughput series. const props = withDefaults( - defineProps<{ values: number[]; width?: number; height?: number; unit?: string }>(), - { width: 220, height: 40, unit: 'MB/s' }, + defineProps<{ values: number[]; width?: number; height?: number; unit?: string; live?: boolean }>(), + { width: 220, height: 40, unit: 'MB/s', live: false }, ) const max = computed(() => Math.max(1, ...props.values)) @@ -39,7 +39,8 @@ const latest = computed(() => props.values[props.values.length - 1] ?? 0) /> - {{ latest.toFixed(0) }} {{ unit }} · peak {{ peak.toFixed(0) }} + peak {{ peak.toFixed(0) }} + diff --git a/web/src/throughput.ts b/web/src/throughput.ts new file mode 100644 index 0000000..e90fc0f --- /dev/null +++ b/web/src/throughput.ts @@ -0,0 +1,31 @@ +import type { RunSample } from './api' + +const MiB = 1024 * 1024 + +// Minimum span a rate is averaged over. Agents report every 5s and the +// controller samples every 5s, so a single interval aliases (0, 2x, 0, ...); +// averaging over two intervals smooths that out. +const WINDOW_SEC = 10 + +// throughputSeries turns a run's samples into a MB/s series (MiB-based, like +// the run summary's avgMBps) for the sparkline. +// +// The stored mbps is a snapshot of the agents' instantaneous rate, summed over +// VMs still working. On short runs it is mostly 0: a VM writes its few GiB +// between two snapshots and reports done before the next one. The cumulative +// bytesWritten in every sample doesn't miss anything, so the rate is derived +// from it and the snapshot is used only when it is higher (a real +// instantaneous burst). +export function throughputSeries(samples: RunSample[]): number[] { + const t = samples.map((s) => Date.parse(s.ts) / 1000) + let lo = 0 + return samples.map((s, i) => { + while (lo < i - 1 && t[i] - t[lo + 1] >= WINDOW_SEC) lo++ + let derived = 0 + const dt = t[i] - t[lo] + if (i > 0 && dt > 0) { + derived = Math.max(0, s.bytesWritten - samples[lo].bytesWritten) / MiB / dt + } + return Math.max(derived, s.mbps) + }) +} diff --git a/web/src/views/DeploymentsView.vue b/web/src/views/DeploymentsView.vue index 3751569..bb240d4 100644 --- a/web/src/views/DeploymentsView.vue +++ b/web/src/views/DeploymentsView.vue @@ -19,6 +19,7 @@ import SpecForm from '../components/SpecForm.vue' import SearchableSelect from '../components/SearchableSelect.vue' import MultiSelect from '../components/MultiSelect.vue' import Sparkline from '../components/Sparkline.vue' +import { throughputSeries } from '../throughput' const deployments = ref([]) const profiles = ref([]) @@ -156,7 +157,7 @@ async function loadSamples(deploymentId: string, runs: Run[]) { if (run.type !== 'initial-fill' && run.type !== 'incremental' && run.type !== 'verify') continue try { const s = await api.listRunSamples(deploymentId, run.id) - runSamples.value = { ...runSamples.value, [run.id]: s.map((p) => p.mbps) } + runSamples.value = { ...runSamples.value, [run.id]: throughputSeries(s) } } catch { /* ignore */ } @@ -1662,6 +1663,7 @@ const labelClass = 'block text-xs font-medium text-slate-500 mb-1' Date: Mon, 16 Nov 2026 11:11:04 +0100 Subject: [PATCH 2/2] Add changelog entry for the sparkline fix Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8b6b5b..e5e334f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ project follows [Semantic Versioning](https://semver.org/). ## [Unreleased] +### Fixed + +- The throughput sparkline of short runs no longer stays flat at "peak 0" + next to a real average. It is now derived from the bytes written over time + instead of point-in-time rate snapshots that missed most of a short write, + and finished runs show their peak instead of an always-zero current rate. + ## [1.2.0] — 2026-10-14 ### Added