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
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) }}
+ {{ latest.toFixed(0) }} {{ unit }} · peak {{ peak.toFixed(0) }}
+ {{ unit }}
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'
|