Skip to content

Commit 5179e97

Browse files
nix-web-monitor: break down running activity by kind in the summary (#289)
Surfaces running `file_transfer` / `copy_path` / `query_path_info` counts in the summary bar next to the running-builds figure. ## Why A run can show many "running" build rows while the host CPU sits near idle (e.g. 20 builds dispatched to a remote builder). The wall-clock is going into substituter transfers, store copies, and path-info queries, not compute. The summary previously showed only running builds and a download count, so the cause was not legible at a glance. ## What Adds `copying` (running `copy_path` + `copy_paths`) and `querying` (running `query_path_info`) chips alongside the existing `downloading` chip, all counted straight from the activity list. ## Design note Nix's internal-json stream does not link an input download to the specific build that needs it: substitutions are parented to the global `realise` / `copy_paths` coordinators, not to a build activity. So a truthful per-build "this row is slow because of these downloads" attribution is not derivable from the stream. This change gives the honest fleet-wide breakdown instead. A deeper panel correlation (merging the builds and activities trees, bidirectional selection highlight) is a good follow-up that benefits from visual iteration. Third of three PRs (after #287 and #288).
1 parent cddc6c1 commit 5179e97

1 file changed

Lines changed: 27 additions & 7 deletions

File tree

packages/nix-web-monitor/server/site/src/components/SummaryBar.svelte

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,21 @@
6767
return Math.max(0, end - startedAtMs);
6868
});
6969
70-
/// Substituter transfers still in flight. Counted straight from the activity
71-
/// list so the figure is exact even when no byte progress is reported.
72-
const downloading = $derived(
73-
snapshot.activities.filter(
74-
(activity) => activity.activityType.name === 'file_transfer' && activity.status === 'running'
75-
).length
76-
);
70+
/// Running activities by kind. This is the breakdown that explains a run whose
71+
/// build rows look busy while the host CPU sits idle: the wall-clock is going
72+
/// into substituter transfers, store copies, and path-info queries, not
73+
/// compute. Nix's stream does not link an input download to the specific build
74+
/// that needs it, so this is the honest fleet-wide view rather than a per-build
75+
/// attribution.
76+
function runningOfType(name: string): number {
77+
return snapshot.activities.filter(
78+
(activity) => activity.activityType.name === name && activity.status === 'running'
79+
).length;
80+
}
81+
82+
const downloading = $derived(runningOfType('file_transfer'));
83+
const copying = $derived(runningOfType('copy_path') + runningOfType('copy_paths'));
84+
const querying = $derived(runningOfType('query_path_info'));
7785
7886
/// Monotonic total of bytes pulled from substituters: each file-transfer
7987
/// activity's `done` counter summed. Stopped transfers keep their final value,
@@ -144,6 +152,18 @@
144152
{/if}
145153
</div>
146154
{/if}
155+
{#if copying > 0}
156+
<div class="kpi kpi-info">
157+
<span class="kpi-num">{copying}</span>
158+
<span class="kpi-label">copying</span>
159+
</div>
160+
{/if}
161+
{#if querying > 0}
162+
<div class="kpi kpi-info">
163+
<span class="kpi-num">{querying}</span>
164+
<span class="kpi-label">querying</span>
165+
</div>
166+
{/if}
147167
{#if counts.succeeded > 0}
148168
<div class="kpi kpi-good">
149169
<span class="kpi-num">{counts.succeeded}</span>

0 commit comments

Comments
 (0)