Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ResourceTelemetryDiagnostics.tsx

1,291 lines48.2 KB

1import {
2 ActivityIcon,
3 AlertTriangleIcon,
4 BatteryIcon,
5 ChevronDownIcon,
6 ChevronRightIcon,
7 CpuIcon,
8 DatabaseIcon,
9 GaugeIcon,
10 HardDriveIcon,
11 MemoryStickIcon,
12 RefreshCwIcon,
13 RotateCcwIcon,
14} from "lucide-react";
15import type {
16 BackgroundBooleanState,
17 ResourceAttributionEntry,
18 ResourceTelemetryAggregate,
19 ResourceTelemetryHistoryBucket,
20 ResourceTelemetryIoSemantics,
21 ResourceTelemetryProcess,
22 ResourceTelemetryProcessCategory,
23 ResourceTelemetryProcessSummary,
24 ResourceTelemetrySourceHealth,
25 ResourceTelemetrySourceStatus,
26 ServerProcessSignal,
27} from "@t3tools/contracts";
28import * as DateTime from "effect/DateTime";
29import * as Option from "effect/Option";
30import { useCallback, useMemo, useRef, useState, type ReactNode } from "react";
31import {
32 isAtomCommandInterrupted,
33 squashAtomCommandFailure,
34} from "@t3tools/client-runtime/state/runtime";
35​
36import {
37 useResourceTelemetry,
38 useResourceTelemetryHistory,
39} from "../../lib/resourceTelemetryState";
40import { cn } from "../../lib/utils";
41import { ensureLocalApi } from "../../localApi";
42import { usePrimaryEnvironment } from "../../state/environments";
43import { serverEnvironment } from "../../state/server";
44import { useAtomCommand } from "../../state/use-atom-command";
45import { formatRelativeTime } from "../../timestampFormat";
46import { Button } from "../ui/button";
47import { ScrollArea } from "../ui/scroll-area";
48import { Toggle, ToggleGroup } from "../ui/toggle-group";
49import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
50import { toastManager } from "../ui/toast";
51import {
52 resourceHistoryBarHeight,
53 resourceHistoryCpuScaleMax,
54 shouldShowResourceMonitorRetry,
55 visibleResourceTelemetryProcesses,
56} from "./ResourceTelemetryDiagnostics.logic";
57import { SettingsSection, useRelativeTimeTick } from "./settingsLayout";
58​
59const HISTORY_WINDOWS = [
60 { label: "5m", windowMs: 5 * 60_000, bucketMs: 15_000 },
61 { label: "15m", windowMs: 15 * 60_000, bucketMs: 30_000 },
62 { label: "30m", windowMs: 30 * 60_000, bucketMs: 60_000 },
63 { label: "1h", windowMs: 60 * 60_000, bucketMs: 2 * 60_000 },
64] as const;
65​
66function formatBytes(value: number): string {
67 if (value < 1_024) return `${Math.round(value)} B`;
68 const units = ["KB", "MB", "GB", "TB"] as const;
69 let next = value;
70 let unitIndex = -1;
71 do {
72 next /= 1_024;
73 unitIndex += 1;
74 } while (next >= 1_024 && unitIndex < units.length - 1);
75 return `${next.toFixed(next >= 100 ? 0 : next >= 10 ? 1 : 2)} ${units[unitIndex]}`;
77​
78function formatRate(value: number): string {
79 return `${formatBytes(value)}/s`;
81​
82function formatCpuTime(valueMs: number): string {
83 const seconds = valueMs / 1_000;
84 if (seconds < 60) return `${seconds.toFixed(seconds >= 10 ? 1 : 2)}s`;
85 const minutes = seconds / 60;
86 if (minutes < 60) return `${minutes.toFixed(minutes >= 10 ? 1 : 2)}m`;
87 return `${(minutes / 60).toFixed(2)}h`;
89​
90function formatDurationMicros(value: number): string {
91 if (value < 1_000) return `${Math.round(value)} µs`;
92 if (value < 1_000_000) return `${(value / 1_000).toFixed(2)} ms`;
93 return `${(value / 1_000_000).toFixed(2)} s`;
95​
96function formatSampleInterval(valueMs: number): string {
97 if (valueMs < 1_000) return `${Math.max(0, Math.round(valueMs))} ms`;
98 const seconds = valueMs / 1_000;
99 return `${seconds.toLocaleString(undefined, { maximumFractionDigits: 1 })} ${
100 seconds === 1 ? "second" : "seconds"
101 }`;
103​
104function processIdentityKey(process: ResourceTelemetryProcess): string {
105 return `${process.identity.pid}:${process.identity.startTimeMs}`;
107​
108function processSummaryIdentityKey(process: ResourceTelemetryProcessSummary): string {
109 return `${process.identity.pid}:${process.identity.startTimeMs}`;
111​
112function formatProcessName(process: Pick<ResourceTelemetryProcess, "command" | "name">): string {
113 if (process.name.trim()) return process.name;
114 const firstToken = process.command.trim().split(/\s+/)[0] ?? process.command;
115 const normalized = firstToken.replace(/^['"]|['"]$/g, "");
116 return normalized.split(/[\\/]/).findLast((segment) => segment.length > 0) ?? normalized;
118​
119function categoryLabel(category: ResourceTelemetryProcessCategory): string {
120 switch (category) {
121 case "server":
122 return "Server";
123 case "server-child":
124 return "Backend child";
125 case "provider-root":
126 return "Provider";
127 case "terminal-root":
128 return "Terminal";
129 case "electron-main":
130 return "Electron main";
131 case "electron-renderer":
132 return "Renderer";
133 case "electron-gpu":
134 return "GPU";
135 case "electron-utility":
136 return "Electron utility";
137 case "resource-monitor":
138 return "Monitor";
139 case "unknown-t3":
140 return "T3 process";
141 }
143​
144function categoryDotClass(category: ResourceTelemetryProcessCategory): string {
145 if (category === "resource-monitor") return "bg-amber-500";
146 if (category.startsWith("electron-")) return "bg-sky-500";
147 if (category === "server") return "bg-violet-500";
148 return "bg-emerald-500";
150​
151function ioSemanticsLabel(semantics: ResourceTelemetryIoSemantics): string {
152 switch (semantics) {
153 case "storage":
154 return "Storage bytes";
155 case "logical":
156 return "Logical bytes";
157 case "all-io":
158 return "All I/O bytes";
159 case "unavailable":
160 return "Unavailable";
161 }
163​
164function booleanStateLabel(
165 value: BackgroundBooleanState,
166 labels: { readonly true: string; readonly false: string },
167): string {
168 if (value === "true") return labels.true;
169 if (value === "false") return labels.false;
170 return "Unknown";
172​
173function sourceStatusTone(status: ResourceTelemetrySourceStatus): "default" | "warning" | "danger" {
174 if (status === "healthy") return "default";
175 if (status === "starting" || status === "degraded") return "warning";
176 return "danger";
178​
179function SourceStatusBadge({
180 label,
181 status,
182 presentation,
183}: {
184 label: string;
185 status: ResourceTelemetrySourceStatus;
186 presentation?:
187 | {
188 readonly label: string;
189 readonly tone: "neutral";
190 }
191 | undefined;
192}) {
193 const tone = presentation?.tone ?? sourceStatusTone(status);
194 return (
195 <span
196 className={cn(
197 "inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.08em]",
198 tone === "neutral" && "border-border/70 bg-muted/45 text-muted-foreground",
199 tone === "default" &&
200 "border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
201 tone === "warning" &&
202 "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",
203 tone === "danger" && "border-destructive/30 bg-destructive/10 text-destructive",
204 )}
205 >
206 <span
207 className={cn(
208 "size-1.5 rounded-full",
209 tone === "neutral" && "bg-muted-foreground/55",
210 tone === "default" && "bg-emerald-500",
211 tone === "warning" && "bg-amber-500",
212 tone === "danger" && "bg-destructive",
213 )}
214 />
215 {label} {presentation?.label ?? status}
216 </span>
217 );
219​
220function LastSampleLabel({ sampledAt }: { sampledAt: DateTime.Utc | null }) {
221 useRelativeTimeTick();
222 if (!sampledAt) {
223 return <span className="text-[11px] text-muted-foreground/55">Waiting for sample</span>;
224 }
225 const relative = formatRelativeTime(DateTime.formatIso(sampledAt));
226 if (!relative) {
227 return <span className="text-[11px] text-muted-foreground/55">Waiting for sample</span>;
228 }
229 return (
230 <span className="text-[11px] text-muted-foreground/60">
231 Updated <span className="font-mono tabular-nums">{relative.value}</span>
232 {relative.suffix ? ` ${relative.suffix}` : ""}
233 </span>
234 );
236​
237function IconStat({
238 icon,
239 label,
240 value,
241 detail,
242 tone = "default",
243}: {
244 icon: ReactNode;
245 label: string;
246 value: string;
247 detail?: string | undefined;
248 tone?: "default" | "warning" | "danger";
249}) {
250 return (
251 <div className="group min-w-0 px-4 py-4 sm:px-5">
252 <div className="flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.11em] text-muted-foreground/70">
253 <span className="text-muted-foreground/55 transition-colors group-hover:text-foreground/65">
254 {icon}
255 </span>
256 <span className="truncate">{label}</span>
257 </div>
258 <div
259 className={cn(
260 "mt-2.5 truncate font-mono text-2xl font-semibold tracking-[-0.05em] tabular-nums text-foreground",
261 tone === "warning" && "text-amber-600 dark:text-amber-300",
262 tone === "danger" && "text-destructive",
263 )}
264 >
265 {value}
266 </div>
267 {detail ? (
268 <div className="mt-1.5 truncate text-[10px] text-muted-foreground/60">{detail}</div>
269 ) : null}
270 </div>
271 );
273​
274function AggregateCard({
275 label,
276 accentClass,
277 aggregate,
278}: {
279 label: string;
280 accentClass: string;
281 aggregate: ResourceTelemetryAggregate;
282}) {
283 return (
284 <div className="relative overflow-hidden border-t border-border/60 px-4 py-4 first:border-t-0 md:border-t-0 md:border-l md:first:border-l-0 sm:px-5">
285 <span className={cn("absolute inset-x-5 top-0 h-0.5 rounded-full opacity-75", accentClass)} />
286 <div className="flex items-center justify-between gap-3">
287 <div className="text-[10px] font-semibold uppercase tracking-[0.11em] text-muted-foreground/75">
288 {label}
289 </div>
290 <div className="rounded-md bg-muted/55 px-1.5 py-0.5 font-mono text-[9px] tabular-nums text-muted-foreground/70">
291 {aggregate.processCount} {aggregate.processCount === 1 ? "process" : "processes"}
292 </div>
293 </div>
294 <div className="mt-3.5 grid grid-cols-2 gap-x-4 gap-y-2.5">
295 <MetricPair label="CPU" value={`${aggregate.currentCpuPercent.toFixed(1)}%`} />
296 <MetricPair label="Memory" value={formatBytes(aggregate.currentRssBytes)} />
297 <MetricPair label="Read" value={formatRate(aggregate.ioReadBytesPerSecond)} />
298 <MetricPair label="Write" value={formatRate(aggregate.ioWriteBytesPerSecond)} />
299 </div>
300 </div>
301 );
303​
304function MetricPair({ label, value }: { label: string; value: string }) {
305 return (
306 <div className="min-w-0">
307 <div className="text-[9px] font-semibold uppercase tracking-[0.08em] text-muted-foreground/45">
308 {label}
309 </div>
310 <div className="truncate font-mono text-xs font-medium tabular-nums text-foreground/90">
311 {value}
312 </div>
313 </div>
314 );
316​
317function HealthSource({ label, health }: { label: string; health: ResourceTelemetrySourceHealth }) {
318 const expectedInBrowser =
319 health.status === "unavailable" &&
320 Option.exists(health.lastError, (error) => error.includes("'web' mode"));
321 return (
322 <div className="flex items-start justify-between gap-4 border-t border-border/50 py-3 first:border-t-0">
323 <div className="min-w-0">
324 <div className="text-[13px] font-medium text-foreground">{label}</div>
325 <div className="mt-1 text-[11px] leading-relaxed text-muted-foreground/65">
326 {expectedInBrowser
327 ? "Available when this page runs inside the desktop app."
328 : Option.match(health.lastError, {
329 onNone: () => "No reported errors",
330 onSome: (error) => error,
331 })}
332 </div>
333 </div>
334 <SourceStatusBadge
335 label=""
336 status={health.status}
337 presentation={
338 expectedInBrowser
339 ? {
340 label: "Desktop only",
341 tone: "neutral",
342 }
343 : undefined
344 }
345 />
346 </div>
347 );
349​
350function DetailRow({
351 label,
352 value,
353 valueClassName,
354}: {
355 label: string;
356 value: ReactNode;
357 valueClassName?: string | undefined;
358}) {
359 return (
360 <div className="flex items-center justify-between gap-4 border-t border-border/50 py-2.5 first:border-t-0">
361 <span className="text-[11px] text-muted-foreground/75">{label}</span>
362 <span
363 className={cn(
364 "min-w-0 truncate text-right font-mono text-[11px] tabular-nums text-foreground/85",
365 valueClassName,
366 )}
367 >
368 {value}
369 </span>
370 </div>
371 );
373​
374function HistoryWindowSelector({
375 selectedWindowMs,
376 onSelect,
377}: {
378 selectedWindowMs: number;
379 onSelect: (windowMs: number) => void;
380}) {
381 return (
382 <ToggleGroup
383 aria-label="Resource history period"
384 variant="segmented"
385 value={[String(selectedWindowMs)]}
386 onValueChange={(next) => {
387 const selected = HISTORY_WINDOWS.find((option) => String(option.windowMs) === next[0]);
388 if (selected) onSelect(selected.windowMs);
389 }}
390 >
391 {HISTORY_WINDOWS.map((option) => (
392 <Toggle key={option.windowMs} value={String(option.windowMs)}>
393 {option.label}
394 </Toggle>
395 ))}
396 </ToggleGroup>
397 );
399​
400function ResourceHistoryChart({
401 buckets,
402}: {
403 buckets: ReadonlyArray<ResourceTelemetryHistoryBucket>;
404}) {
405 const maxCpu = resourceHistoryCpuScaleMax(buckets);
406 const maxIo = Math.max(1, ...buckets.map((bucket) => bucket.ioReadBytes + bucket.ioWriteBytes));
407​
408 return (
409 <div className="border-t border-border/60 px-4 py-4 sm:px-5">
410 <div className="mb-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] text-muted-foreground/65">
411 <span className="inline-flex items-center gap-1.5">
412 <span className="h-1.5 w-3 rounded-full bg-foreground/70" /> CPU average
413 </span>
414 <span className="inline-flex items-center gap-1.5">
415 <span className="h-1.5 w-3 rounded-full bg-sky-500/70" /> I/O reads
416 </span>
417 <span className="inline-flex items-center gap-1.5">
418 <span className="h-1.5 w-3 rounded-full bg-amber-500/80" /> I/O writes
419 </span>
420 </div>
421 <div className="flex h-32 items-end gap-1 overflow-hidden rounded-lg border border-border/40 bg-muted/8 px-2 pt-3 pb-2">
422 {buckets.map((bucket) => {
423 const cpuHeight = resourceHistoryBarHeight({
424 value: bucket.avgCpuPercent,
425 max: maxCpu,
426 minimumVisiblePercent: 2,
427 });
428 const readHeight = resourceHistoryBarHeight({
429 value: bucket.ioReadBytes,
430 max: maxIo,
431 minimumVisiblePercent: 1,
432 });
433 const writeHeight = resourceHistoryBarHeight({
434 value: bucket.ioWriteBytes,
435 max: maxIo,
436 minimumVisiblePercent: 1,
437 });
438 return (
439 <Tooltip key={DateTime.formatIso(bucket.startedAt)}>
440 <TooltipTrigger
441 render={
442 <div className="grid h-full min-w-1 flex-1 grid-cols-3 items-end gap-px">
443 <span
444 className="block rounded-t-sm bg-foreground/65"
445 style={{ height: `${cpuHeight}%` }}
446 />
447 <span
448 className="block rounded-t-sm bg-sky-500/70"
449 style={{ height: `${readHeight}%` }}
450 />
451 <span
452 className="block rounded-t-sm bg-amber-500/80"
453 style={{ height: `${writeHeight}%` }}
454 />
455 </div>
456 }
457 />
458 <TooltipPopup side="top" className="space-y-0.5 text-left">
459 <div>CPU avg {bucket.avgCpuPercent.toFixed(1)}%</div>
460 <div>CPU peak {bucket.maxCpuPercent.toFixed(1)}%</div>
461 <div>Read {formatBytes(bucket.ioReadBytes)}</div>
462 <div>Write {formatBytes(bucket.ioWriteBytes)}</div>
463 </TooltipPopup>
464 </Tooltip>
465 );
466 })}
467 </div>
468 </div>
469 );
471​
472function ProcessTreeName({
473 process,
474 collapsed,
475 onToggle,
476}: {
477 process: ResourceTelemetryProcess;
478 collapsed: boolean;
479 onToggle: (process: ResourceTelemetryProcess) => void;
480}) {
481 const name = formatProcessName(process);
482 const hasChildren = process.childPids.length > 0;
483 const ChevronIcon = collapsed ? ChevronRightIcon : ChevronDownIcon;
484 return (
485 <div
486 className="grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2"
487 style={{ paddingLeft: `${Math.min(process.depth, 7) * 10}px` }}
488 >
489 {hasChildren ? (
490 <Button
491 size="icon-micro"
492 variant="ghost-muted"
493 onClick={() => onToggle(process)}
494 aria-label={collapsed ? `Expand ${name}` : `Collapse ${name}`}
495 >
496 <ChevronIcon className="size-3.5" />
497 </Button>
498 ) : (
499 <span className="size-5" aria-hidden />
500 )}
501 <span className={cn("size-1.5 rounded-full", categoryDotClass(process.category))} />
502 <Tooltip>
503 <TooltipTrigger
504 render={<span className="min-w-0 truncate font-medium text-foreground">{name}</span>}
505 />
506 <TooltipPopup
507 side="top"
508 className="max-w-[min(520px,calc(100vw-2rem))] whitespace-normal break-words text-left font-mono text-[11px]"
509 >
510 {process.command || process.name}
511 </TooltipPopup>
512 </Tooltip>
513 </div>
514 );
516​
517function canSignalProcess(process: ResourceTelemetryProcess): boolean {
518 return (
519 process.category === "server-child" ||
520 process.category === "provider-root" ||
521 process.category === "terminal-root"
522 );
524​
525function ProcessActions({
526 process,
527 signalingKeys,
528 onSignal,
529}: {
530 process: ResourceTelemetryProcess;
531 signalingKeys: ReadonlySet<string>;
532 onSignal: (process: ResourceTelemetryProcess, signal: ServerProcessSignal) => void;
533}) {
534 if (!canSignalProcess(process)) {
535 return <span className="text-[10px] text-muted-foreground/35">—</span>;
536 }
537 const isSignaling = signalingKeys.has(processIdentityKey(process));
538 return (
539 <div className="flex items-center justify-end gap-1.5">
540 <button
541 type="button"
542 disabled={isSignaling}
543 className="cursor-pointer text-[10px] font-semibold text-muted-foreground hover:text-foreground disabled:opacity-50"
544 onClick={() => onSignal(process, "SIGINT")}
545 >
546 INT
547 </button>
548 <button
549 type="button"
550 disabled={isSignaling}
551 className="cursor-pointer text-[10px] font-semibold text-destructive hover:underline disabled:opacity-50"
552 onClick={() => onSignal(process, "SIGKILL")}
553 >
554 KILL
555 </button>
556 </div>
557 );
559​
560function ProcessTable({
561 processes,
562 signalingKeys,
563 onSignal,
564}: {
565 processes: ReadonlyArray<ResourceTelemetryProcess>;
566 signalingKeys: ReadonlySet<string>;
567 onSignal: (process: ResourceTelemetryProcess, signal: ServerProcessSignal) => void;
568}) {
569 const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(() => new Set());
570 const visible = useMemo(
571 () => visibleResourceTelemetryProcesses(processes, collapsed),
572 [collapsed, processes],
573 );
574 const toggle = useCallback((process: ResourceTelemetryProcess) => {
575 const identityKey = processIdentityKey(process);
576 setCollapsed((current) => {
577 const next = new Set(current);
578 if (next.has(identityKey)) {
579 next.delete(identityKey);
580 } else {
581 next.add(identityKey);
582 }
583 return next;
584 });
585 }, []);
586​
587 return (
588 <ScrollArea
589 chainVerticalScroll
590 scrollFade
591 hideScrollbars
592 className="max-h-[min(68vh,48rem)] w-full max-w-full border-t border-border/60"
593 >
594 <table className="w-full min-w-[1320px] table-fixed text-left text-xs">
595 <colgroup>
596 <col className="w-[20%]" />
597 <col className="w-[10%]" />
598 <col className="w-[7%]" />
599 <col className="w-[8%]" />
600 <col className="w-[9%]" />
601 <col className="w-[9%]" />
602 <col className="w-[9%]" />
603 <col className="w-[10%]" />
604 <col className="w-[8%]" />
605 <col className="w-[6%]" />
606 <col className="w-[4%]" />
607 </colgroup>
608 <thead className="sticky top-0 z-10 border-b border-border/60 bg-card text-[10px] uppercase tracking-[0.08em] text-muted-foreground/65">
609 <tr>
610 <th className="px-4 py-2 font-semibold sm:pl-5">Process</th>
611 <th className="px-3 py-2 font-semibold">Category</th>
612 <th className="px-3 py-2 text-right font-semibold">CPU</th>
613 <th className="px-3 py-2 text-right font-semibold">CPU Time</th>
614 <th className="px-3 py-2 text-right font-semibold">Memory</th>
615 <th className="px-3 py-2 text-right font-semibold">Read/s</th>
616 <th className="px-3 py-2 text-right font-semibold">Write/s</th>
617 <th className="px-3 py-2 text-right font-semibold">Read Total</th>
618 <th className="px-3 py-2 text-right font-semibold">Write Total</th>
619 <th className="px-3 py-2 text-right font-semibold">PID</th>
620 <th className="px-2 py-2 text-right font-semibold sm:pr-4">Kill</th>
621 </tr>
622 </thead>
623 <tbody className="divide-y divide-border/50">
624 {visible.length === 0 ? (
625 <tr>
626 <td colSpan={11} className="px-4 py-5 text-xs text-muted-foreground sm:px-5">
627 Waiting for the native process monitor.
628 </td>
629 </tr>
630 ) : null}
631 {visible.map((process) => (
632 <tr key={processIdentityKey(process)} className="hover:bg-muted/20">
633 <td className="px-4 py-2 sm:pl-5">
634 <ProcessTreeName
635 process={process}
636 collapsed={collapsed.has(processIdentityKey(process))}
637 onToggle={toggle}
638 />
639 </td>
640 <td className="truncate px-3 py-2 text-[11px] text-muted-foreground">
641 {categoryLabel(process.category)}
642 </td>
643 <td className="px-3 py-2 text-right font-mono tabular-nums">
644 {process.cpuPercent.toFixed(1)}%
645 </td>
646 <td className="px-3 py-2 text-right font-mono tabular-nums">
647 {formatCpuTime(process.cpuTimeMs)}
648 </td>
649 <td className="px-3 py-2 text-right font-mono tabular-nums">
650 {formatBytes(process.residentBytes)}
651 </td>
652 <td className="px-3 py-2 text-right font-mono tabular-nums text-sky-700 dark:text-sky-300">
653 {formatRate(process.ioReadBytesPerSecond)}
654 </td>
655 <td className="px-3 py-2 text-right font-mono tabular-nums text-amber-700 dark:text-amber-300">
656 {formatRate(process.ioWriteBytesPerSecond)}
657 </td>
658 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
659 {formatBytes(process.ioReadBytes)}
660 </td>
661 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
662 <Tooltip>
663 <TooltipTrigger render={<span>{formatBytes(process.ioWriteBytes)}</span>} />
664 <TooltipPopup side="top">{ioSemanticsLabel(process.ioSemantics)}</TooltipPopup>
665 </Tooltip>
666 </td>
667 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
668 {process.identity.pid}
669 </td>
670 <td className="px-2 py-2 text-right sm:pr-4">
671 <ProcessActions
672 process={process}
673 signalingKeys={signalingKeys}
674 onSignal={onSignal}
675 />
676 </td>
677 </tr>
678 ))}
679 </tbody>
680 </table>
681 </ScrollArea>
682 );
684​
685function HistoryProcessTable({
686 processes,
687}: {
688 processes: ReadonlyArray<ResourceTelemetryProcessSummary>;
689}) {
690 return (
691 <ScrollArea
692 chainVerticalScroll
693 scrollFade
694 hideScrollbars
695 className="max-h-[28rem] w-full max-w-full border-t border-border/60"
696 >
697 <table className="w-full min-w-[1020px] table-fixed text-left text-xs">
698 <colgroup>
699 <col className="w-[24%]" />
700 <col className="w-[11%]" />
701 <col className="w-[10%]" />
702 <col className="w-[10%]" />
703 <col className="w-[11%]" />
704 <col className="w-[11%]" />
705 <col className="w-[11%]" />
706 <col className="w-[7%]" />
707 <col className="w-[5%]" />
708 </colgroup>
709 <thead className="sticky top-0 z-10 border-b border-border/60 bg-card text-[10px] uppercase tracking-[0.08em] text-muted-foreground/65">
710 <tr>
711 <th className="px-4 py-2 font-semibold sm:pl-5">Process</th>
712 <th className="px-3 py-2 font-semibold">Category</th>
713 <th className="px-3 py-2 text-right font-semibold">CPU Time</th>
714 <th className="px-3 py-2 text-right font-semibold">Peak CPU</th>
715 <th className="px-3 py-2 text-right font-semibold">Peak Mem</th>
716 <th className="px-3 py-2 text-right font-semibold">Read</th>
717 <th className="px-3 py-2 text-right font-semibold">Write</th>
718 <th className="px-3 py-2 text-right font-semibold">Samples</th>
719 <th className="px-3 py-2 text-right font-semibold sm:pr-5">PID</th>
720 </tr>
721 </thead>
722 <tbody className="divide-y divide-border/50">
723 {processes.length === 0 ? (
724 <tr>
725 <td colSpan={9} className="px-4 py-5 text-xs text-muted-foreground sm:px-5">
726 No retained process samples in this window.
727 </td>
728 </tr>
729 ) : null}
730 {processes.map((process) => (
731 <tr key={processSummaryIdentityKey(process)} className="hover:bg-muted/20">
732 <td className="px-4 py-2 sm:pl-5">
733 <Tooltip>
734 <TooltipTrigger
735 render={
736 <span className="block truncate font-medium text-foreground">
737 {process.name || process.command}
738 </span>
739 }
740 />
741 <TooltipPopup
742 side="top"
743 className="max-w-[min(520px,calc(100vw-2rem))] whitespace-normal break-words text-left font-mono text-[11px]"
744 >
745 {process.command || process.name}
746 </TooltipPopup>
747 </Tooltip>
748 </td>
749 <td className="truncate px-3 py-2 text-[11px] text-muted-foreground">
750 {categoryLabel(process.category)}
751 </td>
752 <td className="px-3 py-2 text-right font-mono tabular-nums">
753 {formatCpuTime(process.cpuTimeMs)}
754 </td>
755 <td className="px-3 py-2 text-right font-mono tabular-nums">
756 {process.maxCpuPercent.toFixed(1)}%
757 </td>
758 <td className="px-3 py-2 text-right font-mono tabular-nums">
759 {formatBytes(process.peakRssBytes)}
760 </td>
761 <td className="px-3 py-2 text-right font-mono tabular-nums text-sky-700 dark:text-sky-300">
762 {formatBytes(process.ioReadBytes)}
763 </td>
764 <td className="px-3 py-2 text-right font-mono tabular-nums text-amber-700 dark:text-amber-300">
765 {formatBytes(process.ioWriteBytes)}
766 </td>
767 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground">
768 {process.sampleCount}
769 </td>
770 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5">
771 {process.identity.pid}
772 </td>
773 </tr>
774 ))}
775 </tbody>
776 </table>
777 </ScrollArea>
778 );
780​
781function AttributionTable({ entries }: { entries: ReadonlyArray<ResourceAttributionEntry> }) {
782 return (
783 <div className="overflow-x-auto border-t border-border/60">
784 <table className="w-full min-w-[720px] table-fixed text-left text-xs">
785 <colgroup>
786 <col className="w-[22%]" />
787 <col className="w-[28%]" />
788 <col className="w-[14%]" />
789 <col className="w-[14%]" />
790 <col className="w-[10%]" />
791 <col className="w-[12%]" />
792 </colgroup>
793 <thead className="border-b border-border/60 text-[10px] uppercase tracking-[0.08em] text-muted-foreground/65">
794 <tr>
795 <th className="px-4 py-2 font-semibold sm:pl-5">Component</th>
796 <th className="px-3 py-2 font-semibold">Operation</th>
797 <th className="px-3 py-2 text-right font-semibold">Logical Read</th>
798 <th className="px-3 py-2 text-right font-semibold">Logical Write</th>
799 <th className="px-3 py-2 text-right font-semibold">Count</th>
800 <th className="px-3 py-2 text-right font-semibold sm:pr-5">Time</th>
801 </tr>
802 </thead>
803 <tbody className="divide-y divide-border/50">
804 {entries.length === 0 ? (
805 <tr>
806 <td colSpan={6} className="px-4 py-5 text-xs text-muted-foreground sm:px-5">
807 No instrumented application I/O has been recorded yet.
808 </td>
809 </tr>
810 ) : null}
811 {entries.map((entry) => (
812 <tr key={`${entry.component}:${entry.operation}`} className="hover:bg-muted/20">
813 <td className="truncate px-4 py-2 font-medium text-foreground sm:pl-5">
814 {entry.component}
815 </td>
816 <td className="truncate px-3 py-2 text-muted-foreground">{entry.operation}</td>
817 <td className="px-3 py-2 text-right font-mono tabular-nums text-sky-700 dark:text-sky-300">
818 {formatBytes(entry.logicalReadBytes)}
819 </td>
820 <td className="px-3 py-2 text-right font-mono tabular-nums text-amber-700 dark:text-amber-300">
821 {formatBytes(entry.logicalWriteBytes)}
822 </td>
823 <td className="px-3 py-2 text-right font-mono tabular-nums">{entry.count}</td>
824 <td className="px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5">
825 {(entry.durationMs / 1_000).toFixed(2)}s
826 </td>
827 </tr>
828 ))}
829 </tbody>
830 </table>
831 </div>
832 );
834​
835export function ResourceTelemetryDiagnostics() {
836 const [windowMs, setWindowMs] = useState(15 * 60_000);
837 const selectedWindow =
838 HISTORY_WINDOWS.find((option) => option.windowMs === windowMs) ?? HISTORY_WINDOWS[1];
839 const telemetry = useResourceTelemetry();
840 const retryTelemetry = telemetry.retry;
841 const history = useResourceTelemetryHistory({
842 windowMs: selectedWindow.windowMs,
843 bucketMs: selectedWindow.bucketMs,
844 });
845 const primaryEnvironment = usePrimaryEnvironment();
846 const signalServerProcess = useAtomCommand(serverEnvironment.signalProcess, {
847 reportFailure: false,
848 });
849 const [signalingKeys, setSignalingKeys] = useState<ReadonlySet<string>>(() => new Set());
850 const signalingKeysRef = useRef<ReadonlySet<string>>(new Set());
851 signalingKeysRef.current = signalingKeys;
852 const primaryEnvironmentIdRef = useRef(primaryEnvironment?.environmentId);
853 primaryEnvironmentIdRef.current = primaryEnvironment?.environmentId;
854 const [isRetrying, setIsRetrying] = useState(false);
855 const snapshot = telemetry.data;
856 const allT3 = snapshot?.groups.allT3;
857​
858 const signalProcess = useCallback(
859 async (process: ResourceTelemetryProcess, signal: ServerProcessSignal) => {
860 const identityKey = processIdentityKey(process);
861 if (signalingKeysRef.current.has(identityKey)) return;
862 const nextSignalingKeys = new Set(signalingKeysRef.current).add(identityKey);
863 signalingKeysRef.current = nextSignalingKeys;
864 setSignalingKeys(nextSignalingKeys);
865 const clearSignaling = () => {
866 const next = new Set(signalingKeysRef.current);
867 next.delete(identityKey);
868 signalingKeysRef.current = next;
869 setSignalingKeys(next);
870 };
871​
872 if (signal === "SIGKILL") {
873 let confirmed = false;
874 try {
875 confirmed = await ensureLocalApi().dialogs.confirm(
876 `Send SIGKILL to process ${process.identity.pid}? This cannot be handled by the process.`,
877 { variant: "destructive" },
878 );
879 } catch (error) {
880 clearSignaling();
881 toastManager.add({
882 type: "error",
883 title: "Could not confirm signal",
884 description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
885 });
886 return;
887 }
888 if (!confirmed) {
889 clearSignaling();
890 return;
891 }
892 }
893 const environmentId = primaryEnvironmentIdRef.current;
894 if (environmentId === undefined) {
895 clearSignaling();
896 return;
897 }
898 void signalServerProcess({
899 environmentId,
900 input: {
901 pid: process.identity.pid,
902 startTimeMs: process.identity.startTimeMs,
903 signal,
904 },
905 })
906 .then((result) => {
907 if (result._tag === "Failure") {
908 if (isAtomCommandInterrupted(result)) return;
909 throw squashAtomCommandFailure(result);
910 }
911 if (result.value.signaled) return;
912 toastManager.add({
913 type: "error",
914 title: `Could not send ${signal}`,
915 description: Option.getOrElse(
916 result.value.message,
917 () => `Failed to send ${signal} to process ${process.identity.pid}.`,
918 ),
919 });
920 })
921 .catch((error: unknown) => {
922 toastManager.add({
923 type: "error",
924 title: `Could not send ${signal}`,
925 description: error instanceof Error ? error.message : `Failed to send ${signal}.`,
926 });
927 })
928 .finally(() => {
929 clearSignaling();
930 });
931 },
932 [signalServerProcess],
933 );
934​
935 const retryCollector = useCallback(() => {
936 setIsRetrying(true);
937 void retryTelemetry()
938 .catch((error: unknown) => {
939 toastManager.add({
940 type: "error",
941 title: "Could not restart resource monitor",
942 description:
943 error instanceof Error ? error.message : "The resource monitor retry failed.",
944 });
945 })
946 .finally(() => {
947 setIsRetrying(false);
948 });
949 }, [retryTelemetry]);
950​
951 const speedLimit = snapshot ? Option.getOrNull(snapshot.speedLimitPercent) : null;
952 const collectorNeedsRetry = shouldShowResourceMonitorRetry({
953 nativeStatus: snapshot?.health.native.status ?? null,
954 error: telemetry.error,
955 });
956 const hasHostPowerSignal =
957 snapshot !== null &&
958 (snapshot.power.onBattery !== "unknown" ||
959 snapshot.power.lowPowerMode !== "unknown" ||
960 snapshot.power.idle !== "unknown" ||
961 snapshot.power.locked !== "unknown" ||
962 snapshot.power.thermalState !== "unknown");
963​
964 return (
965 <>
966 <SettingsSection
967 title="Resource monitor"
968 icon={<ActivityIcon className="size-4 text-muted-foreground" />}
969 headerAction={
970 <div className="flex items-center gap-2">
971 {snapshot ? (
972 <SourceStatusBadge label="Native" status={snapshot.health.native.status} />
973 ) : null}
974 <LastSampleLabel sampledAt={snapshot?.readAt ?? null} />
975 <Tooltip>
976 <TooltipTrigger
977 render={
978 <Button
979 size="icon-micro"
980 variant="ghost"
981 disabled={telemetry.isPending}
982 onClick={telemetry.refresh}
983 aria-label="Refresh resource telemetry"
984 >
985 <RefreshCwIcon
986 className={cn("size-3", telemetry.isPending && "animate-spin")}
987 />
988 </Button>
989 }
990 />
991 <TooltipPopup side="top">Refresh telemetry snapshot</TooltipPopup>
992 </Tooltip>
993 </div>
994 }
995 >
996 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03),0_8px_30px_rgb(0_0_0/0.035)]">
997 <div className="flex flex-col gap-3 border-b border-border/60 bg-linear-to-r from-muted/45 via-muted/20 to-transparent px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-5">
998 <div>
999 <div className="text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground/70">
1000 T3 system footprint
1001 </div>
1002 <p className="mt-1 max-w-xl text-xs leading-relaxed text-muted-foreground">
1003 Live native counters for the server, providers, terminals, desktop processes, and
1004 the monitor itself.
1005 </p>
1006 </div>
1007 <div className="flex items-center gap-2 text-[10px] text-muted-foreground/65">
1008 <span className="size-1.5 rounded-full bg-emerald-500" />
1009 Sampling every {snapshot ? formatSampleInterval(snapshot.sampleIntervalMs) : "..."}
1010 </div>
1011 </div>
1012 <div className="grid grid-cols-2 divide-x divide-y divide-border/55 md:grid-cols-3">
1013 <IconStat
1014 icon={<CpuIcon className="size-3.5" />}
1015 label="Current CPU"
1016 value={allT3 ? `${allT3.currentCpuPercent.toFixed(1)}%` : "..."}
1017 detail={allT3 ? `${formatCpuTime(allT3.cpuTimeMs)} observed CPU time` : undefined}
1018 />
1019 <IconStat
1020 icon={<MemoryStickIcon className="size-3.5" />}
1021 label="Resident memory"
1022 value={allT3 ? formatBytes(allT3.currentRssBytes) : "..."}
1023 detail={
1024 allT3 ? `${formatBytes(allT3.peakRssBytes)} combined process peaks` : undefined
1026 />
1027 <IconStat
1028 icon={<ActivityIcon className="size-3.5" />}
1029 label="Process count"
1030 value={allT3 ? String(allT3.processCount) : "..."}
1031 detail={
1032 allT3 ? `${allT3.processStarts} starts · ${allT3.processExits} exits` : undefined
1034 />
1035 <IconStat
1036 icon={<HardDriveIcon className="size-3.5" />}
1037 label="Read throughput"
1038 value={allT3 ? formatRate(allT3.ioReadBytesPerSecond) : "..."}
1039 detail={allT3 ? `${formatBytes(allT3.ioReadBytes)} observed` : undefined}
1040 />
1041 <IconStat
1042 icon={<DatabaseIcon className="size-3.5" />}
1043 label="Write throughput"
1044 value={allT3 ? formatRate(allT3.ioWriteBytesPerSecond) : "..."}
1045 detail={allT3 ? `${formatBytes(allT3.ioWriteBytes)} observed` : undefined}
1046 tone={
1047 allT3 && allT3.ioWriteBytesPerSecond >= 10 * 1_024 * 1_024
1048 ? "danger"
1049 : allT3 && allT3.ioWriteBytesPerSecond >= 1_024 * 1_024
1050 ? "warning"
1051 : "default"
1053 />
1054 <IconStat
1055 icon={<GaugeIcon className="size-3.5" />}
1056 label="CPU speed limit"
1057 value={
1058 snapshot ? (speedLimit === null ? "Unknown" : `${speedLimit.toFixed(0)}%`) : "..."
1060 detail={snapshot ? `${snapshot.power.thermalState} thermal state` : undefined}
1061 tone={speedLimit !== null && speedLimit < 80 ? "warning" : "default"}
1062 />
1063 </div>
1064 {telemetry.error ? (
1065 <div className="flex items-start gap-2 border-t border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5">
1066 <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
1067 <span>{telemetry.error}</span>
1068 </div>
1069 ) : null}
1070 {snapshot ? (
1071 <div className="grid border-t border-border/60 bg-muted/10 md:grid-cols-3">
1072 <AggregateCard
1073 label="Backend + agents"
1074 accentClass="bg-emerald-500/80"
1075 aggregate={snapshot.groups.backend}
1076 />
1077 <AggregateCard
1078 label="Desktop"
1079 accentClass="bg-sky-500/80"
1080 aggregate={snapshot.groups.electron}
1081 />
1082 <AggregateCard
1083 label="Monitor overhead"
1084 accentClass="bg-amber-500/80"
1085 aggregate={snapshot.groups.monitor}
1086 />
1087 </div>
1088 ) : null}
1089 </div>
1090 </SettingsSection>
1091​
1092 <SettingsSection
1093 title="Host & collection"
1094 icon={<GaugeIcon className="size-4 text-muted-foreground" />}
1095 headerAction={
1096 collectorNeedsRetry ? (
1097 <Button size="xs" variant="outline" disabled={isRetrying} onClick={retryCollector}>
1098 <RotateCcwIcon className={cn("size-3", isRetrying && "animate-spin")} />
1099 Retry monitor
1100 </Button>
1101 ) : null
1104 <div className="grid overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)] md:grid-cols-2 md:divide-x md:divide-border/60">
1105 <div className="px-4 py-4 sm:px-5">
1106 <div className="mb-3 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70">
1107 <span className="flex size-6 items-center justify-center rounded-md bg-muted/60">
1108 <BatteryIcon className="size-3.5" />
1109 </span>
1110 Host state
1111 </div>
1112 {hasHostPowerSignal && snapshot ? (
1113 <>
1114 <DetailRow
1115 label="Power source"
1116 value={booleanStateLabel(snapshot.power.onBattery, {
1117 true: "Battery",
1118 false: "External power",
1119 })}
1120 />
1121 <DetailRow
1122 label="Low power mode"
1123 value={booleanStateLabel(snapshot.power.lowPowerMode, {
1124 true: "Enabled",
1125 false: "Disabled",
1126 })}
1127 />
1128 <DetailRow
1129 label="Idle"
1130 value={`${booleanStateLabel(snapshot.power.idle, {
1131 true: "Idle",
1132 false: "Active",
1133 })}${
1134 snapshot.power.idleSeconds === null
1135 ? ""
1136 : ` · ${Math.round(snapshot.power.idleSeconds)}s`
1137 }`}
1138 />
1139 <DetailRow
1140 label="Session"
1141 value={
1142 snapshot.power.suspended
1143 ? "Suspended"
1144 : booleanStateLabel(snapshot.power.locked, {
1145 true: "Locked",
1146 false: "Unlocked",
1147 })
1149 />
1150 <DetailRow
1151 label="Thermal"
1152 value={snapshot.power.thermalState}
1153 valueClassName={
1154 snapshot.power.thermalState === "serious" ||
1155 snapshot.power.thermalState === "critical"
1156 ? "text-destructive"
1157 : undefined
1159 />
1160 </>
1161 ) : (
1162 <div className="rounded-xl border border-dashed border-border/70 bg-muted/20 px-4 py-5">
1163 <div className="text-[13px] font-medium text-foreground">
1164 Desktop host signals not connected
1165 </div>
1166 <p className="mt-1.5 max-w-sm text-[11px] leading-relaxed text-muted-foreground/70">
1167 Power, idle, lock, and thermal state are supplied by the desktop host. Process
1168 telemetry remains fully active in this browser session.
1169 </p>
1170 </div>
1171 )}
1172 </div>
1173 <div className="border-t border-border/60 px-4 py-4 md:border-t-0 sm:px-5">
1174 <div className="mb-3 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70">
1175 <span className="flex size-6 items-center justify-center rounded-md bg-muted/60">
1176 <GaugeIcon className="size-3.5" />
1177 </span>
1178 Collection health
1179 </div>
1180 {snapshot ? (
1181 <>
1182 <HealthSource label="Native process monitor" health={snapshot.health.native} />
1183 <HealthSource label="Electron main process" health={snapshot.health.desktop} />
1184 <DetailRow
1185 label="Collection time"
1186 value={formatDurationMicros(snapshot.health.collectionDurationMicros)}
1187 />
1188 <DetailRow
1189 label="Process scan"
1190 value={`${snapshot.health.retainedProcessCount}/${snapshot.health.scannedProcessCount} retained`}
1191 />
1192 <DetailRow
1193 label="Inaccessible"
1194 value={String(snapshot.health.inaccessibleProcessCount)}
1195 valueClassName={
1196 snapshot.health.inaccessibleProcessCount > 0
1197 ? "text-amber-600 dark:text-amber-300"
1198 : undefined
1200 />
1201 <DetailRow
1202 label="Sidecar"
1203 value={Option.match(snapshot.health.sidecarVersion, {
1204 onNone: () => "Unavailable",
1205 onSome: (version) =>
1206 `${version}${Option.match(snapshot.health.sidecarPid, {
1207 onNone: () => "",
1208 onSome: (pid) => ` · PID ${pid}`,
1209 })}`,
1210 })}
1211 />
1212 <DetailRow label="Restarts" value={String(snapshot.health.restartCount)} />
1213 </>
1214 ) : (
1215 <div className="py-4 text-xs text-muted-foreground">
1216 Waiting for collector health.
1217 </div>
1218 )}
1219 </div>
1220 </div>
1221 </SettingsSection>
1222​
1223 <SettingsSection
1224 title="Resource timeline"
1225 icon={<HardDriveIcon className="size-4 text-muted-foreground" />}
1226 headerAction={
1227 <div className="flex items-center gap-2">
1228 <HistoryWindowSelector selectedWindowMs={windowMs} onSelect={setWindowMs} />
1229 <Button
1230 size="icon-micro"
1231 variant="ghost"
1232 disabled={history.isPending}
1233 onClick={history.refresh}
1234 aria-label="Refresh resource history"
1236 <RefreshCwIcon className={cn("size-3", history.isPending && "animate-spin")} />
1237 </Button>
1238 </div>
1241 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)]">
1242 {history.error ? (
1243 <div className="flex items-start gap-2 border-b border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5">
1244 <AlertTriangleIcon className="mt-0.5 size-3.5 shrink-0" />
1245 <span>{history.error}</span>
1246 </div>
1247 ) : null}
1248 <ResourceHistoryChart buckets={history.data?.buckets ?? []} />
1249 <HistoryProcessTable processes={history.data?.topProcesses ?? []} />
1250 </div>
1251 </SettingsSection>
1252​
1253 <SettingsSection
1254 title="Live process tree"
1255 icon={<CpuIcon className="size-4 text-muted-foreground" />}
1256 headerAction={
1257 snapshot ? (
1258 <span className="text-[10px] text-muted-foreground/55">
1259 Identity: <span className="font-mono">PID + start time</span>
1260 </span>
1261 ) : null
1264 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)]">
1265 <ProcessTable
1266 processes={snapshot?.processes ?? []}
1267 signalingKeys={signalingKeys}
1268 onSignal={signalProcess}
1269 />
1270 </div>
1271 </SettingsSection>
1272​
1273 <SettingsSection
1274 title="Instrumented application I/O"
1275 icon={<DatabaseIcon className="size-4 text-muted-foreground" />}
1276 headerAction={
1277 <span className="text-[10px] text-muted-foreground/55">Logical bytes by operation</span>
1280 <div className="overflow-hidden rounded-2xl border border-border/70 bg-card shadow-[0_1px_1px_rgb(0_0_0/0.03)]">
1281 <div className="bg-muted/15 px-4 py-3 text-[11px] leading-relaxed text-muted-foreground sm:px-5">
1282 Native counters identify which process is reading or writing. These application-level
1283 counters identify known T3 operations so process spikes can be correlated with specific
1284 persistence and logging paths.
1285 </div>
1286 <AttributionTable entries={snapshot?.attribution.entries ?? []} />
1287 </div>
1288 </SettingsSection>
1289 </>
1290 );