SPB Git

Repository Public

live-types.ts 1.5 KB 52 lines typescript

1/** Public shape of the live telemetry. Only utilisation figures are published: no address, hostname, process or user. */2export type LiveNode = {3  /** public record id (node-NN) */4  id: string;5  online: boolean;6  /** percentages, 0–100 */7  cpu: number;8  memPct: number;9  memUsedGB: number;10  memTotalGB: number;11  /** null when the GPU reading is unavailable */12  gpu: number | null;13  load1: number;14  uptimeS: number;15  thermal: string | null;16  netInKBs: number;17  netOutKBs: number;18  /** battery percentage for laptops, null otherwise */19  battery: number | null;20};2122export type LiveCluster = {23  online: number;24  total: number;25  /** core-weighted mean over the nodes that answered */26  cpu: number;27  memUsedGB: number;28  memTotalGB: number;29  memPct: number;30  gpu: number | null;31  netInKBs: number;32  netOutKBs: number;33  coresOnline: number;34};3536export type LiveSnapshot = {37  available: boolean;38  /** epoch milliseconds of the collector cycle that produced the figures */39  ts: number;40  /** seconds between two collector cycles */41  intervalS: number;42  cluster: LiveCluster | null;43  nodes: LiveNode[];44};4546export type HistoryPoint = { t: number; cpu: number; mem: number; gpu: number | null };47export type LiveHistory = { available: boolean; window: HistoryWindow; points: HistoryPoint[] };48export type LiveSpark = { available: boolean; nodes: Record<string, number[]> };4950export const HISTORY_WINDOWS = ["1h", "6h", "24h"] as const;51export type HistoryWindow = (typeof HISTORY_WINDOWS)[number];52
Files main
Menu

Theme