console: Boxes, today's fleet view in the operator shell, with background jobs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
13 files changed,
+383
−239
approved_operator_pages_copy_test.go+2 −0internal/console/claim_invariant_fixtures_test.go+1 −0internal/console/claim_invariant_probes_read_test.go+2 −1internal/console/opboxes.go+125 −0internal/console/regionlabels_test.go+1 −1internal/console/server.go+19 −61internal/console/server_test.go+107 −39internal/console/storepage_test.go+1 −1internal/console/templates/fleet.html+0 −135internal/console/templates/ops_boxes.html+122 −0internal/console/testdata/claim-routes.txt+1 −0internal/console/testdata/perf-budgets.txt+1 −0internal/console/view.go+1 −1
CI failed — run details
diff --git a/approved_operator_pages_copy_test.go b/approved_operator_pages_copy_test.go| index ddcf5c125..35947eef5 100644 |
| --- a/approved_operator_pages_copy_test.go |
| +++ b/approved_operator_pages_copy_test.go |
| @@ -57,6 +57,8 @@ var operatorPagesCopyBuilt = []string{ |
| "OPS-91", "OPS-92", "OPS-93", "OPS-94", "OPS-95", "OPS-96", "OPS-97", "OPS-98", |
| "OPS-99", "OPS-100", "OPS-101", "OPS-102", |
| "OPS-149", "OPS-150", "OPS-151", "OPS-152", "OPS-153", |
| + // Task 8: Boxes. |
| + "OPS-137", "OPS-146", "OPS-147", |
| } |
| // operatorPagesBuiltRows is entryBuiltRows for operatorPagesCopyBuilt. |
diff --git a/internal/console/claim_invariant_fixtures_test.go b/internal/console/claim_invariant_fixtures_test.go| index 3925fee44..756574d35 100644 |
| --- a/internal/console/claim_invariant_fixtures_test.go |
| +++ b/internal/console/claim_invariant_fixtures_test.go |
| @@ -889,6 +889,7 @@ var claimFixtures = map[string]claimFixture{ |
| "route GET /auth/email/link": claimNonApp("an emailed link's confirm page: sets the login-CSRF nonce cookie; spends nothing"), |
| "route GET /auth/signin": claimNonApp("starts an OAuth flow: the auth cookie and its PKCE state"), |
| "route GET /fleet": claimRead("operator fleet view"), |
| + "route GET /fleet/boxes": claimRead("operator boxes view: fleet.json, box snapshots, the storage queue"), |
| "route GET /fleet/economics": claimRead("operator economics view"), |
| "route GET /fleet/economics/accounts": claimRead("operator per-account economics table"), |
| "route GET /fleet/index": claimRead("operator section index; reads nothing remote"), |
diff --git a/internal/console/claim_invariant_probes_read_test.go b/internal/console/claim_invariant_probes_read_test.go| index 64f463f93..6ad520beb 100644 |
| --- a/internal/console/claim_invariant_probes_read_test.go |
| +++ b/internal/console/claim_invariant_probes_read_test.go |
| @@ -168,7 +168,8 @@ var claimReadProbes = map[string]claimProbe{ |
| "route GET /settings": claimPageRead(nil, "/settings", "<h1>Your settings</h1>"), |
| "route GET /auth/cli": claimPageRead(nil, "/auth/cli", "<h1>Approve a terminal</h1>"), |
| "route GET /invite/{token}": claimInvitePageProbe(), |
| - "route GET /fleet": claimPageRead(nil, "/fleet", "<h1>Fleet status</h1>"), |
| + "route GET /fleet": claimPageRead(nil, "/fleet", "<h1>Boxes</h1>"), |
| + "route GET /fleet/boxes": claimPageRead(nil, "/fleet/boxes", "<h1>Boxes</h1>"), |
| "route GET /fleet/economics": claimPageRead(nil, "/fleet/economics", "<h1>Fleet economics</h1>"), |
| "route GET /fleet/economics/accounts": claimPageRead(nil, "/fleet/economics/accounts", "<h1>Fleet economics: accounts</h1>"), |
| "route GET /fleet/index": claimPageRead(nil, "/fleet/index", "rst-shell-console=\"index\""), |
diff --git a/internal/console/opboxes.go b/internal/console/opboxes.go| new file mode 100644 |
| index 000000000..9dc64626b |
| --- /dev/null |
| +++ b/internal/console/opboxes.go |
| @@ -0,0 +1,125 @@ |
| +package console |
| + |
| +import ( |
| + "context" |
| + "log" |
| + "net/http" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/status" |
| +) |
| + |
| +// Boxes (/fleet/boxes): what /fleet showed before the operator pages, in |
| +// the operator shell, with the background jobs table at the end. The reads |
| +// below are the ones the dashboard shares with it, so both read the same |
| +// way: each a direct read, once per view, with no cache (the operator |
| +// pages are seldom viewed). |
| + |
| +// now is the operator pages' clock: opNow, or time.Now when it is nil, so |
| +// a &Server{} literal stays safe. Every operator handler and seam reads |
| +// time through it. |
| +func (s *Server) now() time.Time { |
| + if s.opNow != nil { |
| + return s.opNow() |
| + } |
| + return time.Now() |
| +} |
| + |
| +// opFleetJSON is status/fleet.json, read once. Nil with no error means no |
| +// snapshot has been published yet. |
| +func (s *Server) opFleetJSON(ctx context.Context, p *page) (*status.Fleet, error) { |
| + return FleetView(ctx, s.cfg.Releases) |
| +} |
| + |
| +// opHostRows is every box report, listed and read once (HostRows). |
| +func (s *Server) opHostRows(ctx context.Context, p *page) ([]HostRow, error) { |
| + return HostRows(ctx, s.cfg.Releases, s.now()) |
| +} |
| + |
| +// opStorePending is the number of pending storage applications, read once |
| +// under storeTimeout, for a store operator. It is nil, nil for anyone else |
| +// and for a deployment with no bucket. |
| +func (s *Server) opStorePending(ctx context.Context, p *page) (*int, error) { |
| + if p.Op == nil || !p.Op.StoreOperator || s.cfg.Releases == nil { |
| + return nil, nil |
| + } |
| + ctx, cancel := context.WithTimeout(ctx, storeTimeout) |
| + defer cancel() |
| + applications, err := s.pendingStoreApplications(ctx) |
| + if err != nil { |
| + return nil, err |
| + } |
| + n := len(applications) |
| + return &n, nil |
| +} |
| + |
| +// handleBoxes serves Boxes, for signed-in operators only, behind |
| +// operatorOnly's 404-to-everyone gate. |
| +func (s *Server) handleBoxes(w http.ResponseWriter, r *http.Request) { |
| + addr, raw, ok := s.operatorOnly(w, r) |
| + if !ok { |
| + return |
| + } |
| + ctx := r.Context() |
| + p := s.opPage(addr, raw, "boxes") |
| + f, err := s.opFleetJSON(ctx, &p) |
| + if err != nil { |
| + log.Printf("console: fleet view: %v", err) |
| + s.renderMessage(w, r, http.StatusInternalServerError, "Error", "Could not read fleet status. Please try again.") |
| + return |
| + } |
| + // The private host detail is an EXTRA read on a page that already has its |
| + // answer: a bucket that won't list the boxes costs the operator the |
| + // per-host block, not the whole page, so this degrades with a log line |
| + // rather than turning a readable page into a 500. |
| + hosts, err := s.opHostRows(ctx, &p) |
| + if err != nil { |
| + log.Printf("console: fleet hosts: %v", err) |
| + hosts = nil |
| + } |
| + // Region labels (spec §5 rows 10, 11): box regions from the cached name |
| + // map, each app's stored region from SQLite and one registry listing. |
| + labels := map[string]string{} |
| + if f != nil { |
| + for _, b := range f.Boxes { |
| + if _, name := s.boxRegion(b.Label); name != "" { |
| + labels[b.Label] = name |
| + } |
| + } |
| + } |
| + for _, h := range hosts { |
| + if _, name := s.boxRegion(h.Label); name != "" { |
| + labels[h.Label] = name |
| + } |
| + } |
| + var appRegions map[string]string |
| + if f != nil { |
| + names := make([]string, 0, len(f.Apps)) |
| + for _, a := range f.Apps { |
| + names = append(names, a.Name) |
| + } |
| + appRegions = s.fleetAppRegions(names) |
| + } |
| + p.Fleet, p.Hosts, p.BoxRegions, p.FleetAppRegions = f, hosts, labels, appRegions |
| + if p.Op.StoreOperator { |
| + n, err := s.opStorePending(ctx, &p) |
| + if err != nil { |
| + log.Printf("console: boxes storage queue: %v", err) |
| + } |
| + p.StorePending, p.StoreQueueUnknown = n, n == nil |
| + } |
| + p.Jobs = opJobRows(s.jobs.Snapshot()) |
| + s.render(w, http.StatusOK, "ops_boxes", p) |
| +} |
| + |
| +// memUsedPercent is the share of a host's memory in use, 0 to 100: |
| +// MemTotalBytes less MemAvailBytes over MemTotalBytes. It is -1 when the |
| +// host did not report both, or reported no total. It is the template func |
| +// memUsedPct. |
| +func memUsedPercent(m *status.BoxMetrics) int { |
| + if m == nil || m.MemTotalBytes == nil || m.MemAvailBytes == nil || *m.MemTotalBytes <= 0 { |
| + return -1 |
| + } |
| + used := *m.MemTotalBytes - *m.MemAvailBytes |
| + return int(min(max(used*100 / *m.MemTotalBytes, 0), 100)) |
| +} |
diff --git a/internal/console/regionlabels_test.go b/internal/console/regionlabels_test.go| index 4937143ed..977aee0c6 100644 |
| --- a/internal/console/regionlabels_test.go |
| +++ b/internal/console/regionlabels_test.go |
| @@ -309,7 +309,7 @@ func TestFleetPagesUseTheBoxMap(t *testing.T) { |
| if _, err := tb.fx.rel.Put(context.Background(), "status/fleet.json", raw, ""); err != nil { |
| t.Fatal(err) |
| } |
| - page := tb.textAt(t, "/fleet") |
| + page := tb.textAt(t, "/fleet/boxes") |
| for _, want := range []string{"London (UK)", "far away", "Dublin (IE)"} { // box B, an unknown box's word, shop's stored region |
| if !strings.Contains(page, want) { |
| t.Fatalf("platform fleet page lacks %q:\n%s", want, page) |
diff --git a/internal/console/server.go b/internal/console/server.go| index c7d9606e8..55e788bce 100644 |
| --- a/internal/console/server.go |
| +++ b/internal/console/server.go |
| @@ -213,6 +213,14 @@ var templates = template.Must(template.New("").Funcs(template.FuncMap{ |
| "opnum": opNumber, |
| "opHeader": func(title, sub string) opHeader { return opHeader{Title: title, Sub: sub} }, |
| "opEmpty": func(title, body string) opEmpty { return opEmpty{Title: title, Body: body} }, |
| + // opPill, opStat and opMeter build op_status, op_stat and op_meter's |
| + // data in a template; memUsedPct is a host's used memory for its meter. |
| + "opPill": func(label, tone string) opPill { return opPill{Label: label, Tone: tone} }, |
| + "opStat": func(label, value, note string, lead bool) opStat { |
| + return opStat{Label: label, Value: value, Note: note, Lead: lead} |
| + }, |
| + "opMeter": func(percent int, text string) opMeter { return opMeter{Percent: percent, Text: text} }, |
| + "memUsedPct": memUsedPercent, |
| // join renders fleetPageBox.Tags back into the tag form's editable |
| // text input, comma-separated — the exact grammar SetFleetBoxTags |
| // expects back, so an owner opening the form sees the same string they'd |
| @@ -1321,6 +1329,9 @@ type Server struct { |
| // relayNow is the relay paths' clock seam: nil means time.Now. Tests |
| // drive lease expiry with it; nothing in production sets it. |
| relayNow func() time.Time |
| + // opNow is the operator pages' clock seam (Server.now, opboxes.go): |
| + // nil means time.Now. Tests set it; nothing in production does. |
| + opNow func() time.Time |
| // recordView is the record view the run and seed sweeps read through |
| // (recordview.go), set by SetRecordView when CARLOS_CHANGE_INDEX=read |
| @@ -1650,6 +1661,7 @@ func NewServer(cfg Config, st *Store) (*Server, error) { |
| s.registerRoute("GET /auth/confirm", s.handleConfirm) |
| s.registerRoute("POST /auth/signout", s.handleSignout) |
| s.registerRoute("GET /fleet", s.handleFleet) |
| + s.registerRoute("GET /fleet/boxes", s.handleBoxes) |
| s.registerRoute("GET /fleet/index", s.handleOpIndex) |
| s.registerRoute("GET /fleet/store", s.handleStoreApprovalsPage) |
| s.registerRoute("POST /fleet/store/{account}/{decision}", s.handleStoreDecisionPage) |
| @@ -2229,6 +2241,9 @@ type page struct { |
| Fleet *status.Fleet // /fleet: nil means no snapshot published yet |
| + // Jobs is the background jobs table (op_jobs) on Boxes. |
| + Jobs []opJobRow |
| + |
| // /fleet, below the published boxes table: the per-host PRIVATE detail |
| // read straight out of status/boxes/ (HostRows, view.go). Raw numbers |
| // render here and nowhere public — this page is session-gated to |
| @@ -3431,68 +3446,11 @@ func (s *Server) operatorOnly(w http.ResponseWriter, r *http.Request) (address, |
| return addr, raw, true |
| } |
| -// handleFleet serves the private fleet view: everything status/fleet.json |
| -// carries, server-rendered, for signed-in operators only — behind |
| -// operatorOnly's 404-to-everyone gate above. |
| +// handleFleet serves /fleet. Its content moved to Boxes (handleBoxes, |
| +// opboxes.go); until the dashboard takes /fleet over it answers what Boxes |
| +// answers, behind the same gate. |
| func (s *Server) handleFleet(w http.ResponseWriter, r *http.Request) { |
| - addr, raw, ok := s.operatorOnly(w, r) |
| - if !ok { |
| - return |
| - } |
| - f, err := FleetView(r.Context(), s.cfg.Releases) |
| - if err != nil { |
| - log.Printf("console: fleet view: %v", err) |
| - s.renderMessage(w, r, http.StatusInternalServerError, "Error", "Could not read fleet status. Please try again.") |
| - return |
| - } |
| - // The private host detail is an EXTRA read on a page that already has its |
| - // answer: a bucket that won't list the boxes costs the operator the |
| - // per-host block, not the whole fleet page, so this degrades with a log |
| - // line rather than turning a readable page into a 500. |
| - hosts, err := HostRows(r.Context(), s.cfg.Releases, time.Now()) |
| - if err != nil { |
| - log.Printf("console: fleet hosts: %v", err) |
| - hosts = nil |
| - } |
| - // Region labels (spec §5 rows 10, 11): box regions from the cached name |
| - // map, each app's stored region from SQLite and one registry listing. |
| - labels := map[string]string{} |
| - if f != nil { |
| - for _, b := range f.Boxes { |
| - if _, name := s.boxRegion(b.Label); name != "" { |
| - labels[b.Label] = name |
| - } |
| - } |
| - } |
| - for _, h := range hosts { |
| - if _, name := s.boxRegion(h.Label); name != "" { |
| - labels[h.Label] = name |
| - } |
| - } |
| - var appRegions map[string]string |
| - if f != nil { |
| - names := make([]string, 0, len(f.Apps)) |
| - for _, a := range f.Apps { |
| - names = append(names, a.Name) |
| - } |
| - appRegions = s.fleetAppRegions(names) |
| - } |
| - p := page{Title: "Fleet status", Address: addr, CSRF: raw, Fleet: f, Hosts: hosts, |
| - BoxRegions: labels, FleetAppRegions: appRegions} |
| - if s.storeOperator(addr) { |
| - p.StoreQueueUnknown = true |
| - if s.cfg.Releases != nil { |
| - ctx, cancel := context.WithTimeout(r.Context(), storeTimeout) |
| - applications, err := s.pendingStoreApplications(ctx) |
| - cancel() |
| - if err == nil { |
| - n := len(applications) |
| - p.StorePending = &n |
| - p.StoreQueueUnknown = false |
| - } |
| - } |
| - } |
| - s.render(w, http.StatusOK, "fleet", p) |
| + s.handleBoxes(w, r) |
| } |
| // handleFleetMetrics serves the operator host/process monitoring dashboard — |
diff --git a/internal/console/server_test.go b/internal/console/server_test.go| index 2a2312923..00506aae1 100644 |
| --- a/internal/console/server_test.go |
| +++ b/internal/console/server_test.go |
| @@ -1750,11 +1750,12 @@ func seedFleetJSON(t *testing.T, fx *consoleFixture) *status.Fleet { |
| return f |
| } |
| -// TestFleetOperatorOnly is Task 9's core gate: signed out, signed in but not |
| -// an operator, and a revoked operator all get exactly the same 404 an |
| -// actually-missing route gets — role existence must not be probeable. |
| -// Granting flips the same session straight into the rendered fleet view. |
| -func TestFleetOperatorOnly(t *testing.T) { |
| +// TestBoxesOperatorOnly is the operator gate on /fleet/boxes: signed out, |
| +// signed in but not an operator, and a revoked operator all get exactly the |
| +// same 404 an actually-missing route gets — role existence must not be |
| +// probeable. Granting flips the same session straight into the Boxes view, |
| +// today's fleet content under the Boxes heading. |
| +func TestBoxesOperatorOnly(t *testing.T) { |
| fx := newConsoleFixture(t) |
| seedFleetJSON(t, fx) |
| @@ -1763,72 +1764,139 @@ func TestFleetOperatorOnly(t *testing.T) { |
| if statusGhost != http.StatusNotFound { |
| t.Fatalf("sanity: a missing route = %d, want 404", statusGhost) |
| } |
| - if status, _, body := get(t, out, fx.ts.URL+"/fleet"); status != http.StatusNotFound || body != bodyGhost { |
| - t.Fatalf("signed-out /fleet = %d %q, want the same 404 as a missing route (%d %q)", status, body, statusGhost, bodyGhost) |
| + if status, _, body := get(t, out, fx.ts.URL+"/fleet/boxes"); status != http.StatusNotFound || body != bodyGhost { |
| + t.Fatalf("signed-out /fleet/boxes = %d %q, want the same 404 as a missing route (%d %q)", status, body, statusGhost, bodyGhost) |
| } |
| // Signed in and owns kass, but is not an operator: still the same 404. |
| owner := signInPaul(t, fx) |
| - if status, _, body := get(t, owner, fx.ts.URL+"/fleet"); status != http.StatusNotFound || body != bodyGhost { |
| - t.Fatalf("non-operator /fleet = %d %q, want the same 404 as a missing route", status, body) |
| + if status, _, body := get(t, owner, fx.ts.URL+"/fleet/boxes"); status != http.StatusNotFound || body != bodyGhost { |
| + t.Fatalf("non-operator /fleet/boxes = %d %q, want the same 404 as a missing route", status, body) |
| } |
| if err := fx.st.SetOperator("paul@keymail.dev", true); err != nil { |
| t.Fatal(err) |
| } |
| - status, _, body := get(t, owner, fx.ts.URL+"/fleet") |
| - if status != 200 || !strings.Contains(body, "Fleet status") { |
| - t.Errorf("operator fleet view: %d %s", status, body) |
| + status, _, body := get(t, owner, fx.ts.URL+"/fleet/boxes") |
| + if status != 200 || !strings.Contains(body, "<h1>Boxes</h1>") { |
| + t.Errorf("operator boxes view: %d %s", status, body) |
| } |
| - for _, want := range []string{"ada-stargazing", "eu-west-1", "Boxes", "Apps", "Services"} { |
| + for _, want := range []string{"ada-stargazing", "eu-west-1", `id="box-ada-stargazing"`, |
| + "<h2>Boxes</h2>", "<h2>Apps</h2>", "<h2>Services</h2>", |
| + "Every box, its apps, and the platform's background jobs."} { |
| if !strings.Contains(body, want) { |
| - t.Fatalf("/fleet missing %q in:\n%s", want, body) |
| + t.Fatalf("/fleet/boxes missing %q in:\n%s", want, body) |
| } |
| } |
| + if strings.Contains(body, "See the architecture") { |
| + t.Error("/fleet/boxes still links the architecture: the rail carries it") |
| + } |
| // Revoked: back to the exact same 404. |
| if err := fx.st.SetOperator("paul@keymail.dev", false); err != nil { |
| t.Fatal(err) |
| } |
| - if status, _, body := get(t, owner, fx.ts.URL+"/fleet"); status != http.StatusNotFound || body != bodyGhost { |
| - t.Fatalf("revoked operator /fleet = %d %q, want the same 404", status, body) |
| + if status, _, body := get(t, owner, fx.ts.URL+"/fleet/boxes"); status != http.StatusNotFound || body != bodyGhost { |
| + t.Fatalf("revoked operator /fleet/boxes = %d %q, want the same 404", status, body) |
| } |
| } |
| -// TestFleetEmptyState: a deployment where the status-lease holder has never |
| +// TestBoxesEmptyState: a deployment where the status-lease holder has never |
| // published status/fleet.json must render the page's empty state, never a |
| // 500 — the object simply not existing yet is not an error. |
| -func TestFleetEmptyState(t *testing.T) { |
| +func TestBoxesEmptyState(t *testing.T) { |
| fx := newConsoleFixture(t) |
| c := signInPaul(t, fx) |
| if err := fx.st.SetOperator("paul@keymail.dev", true); err != nil { |
| t.Fatal(err) |
| } |
| - status, _, body := get(t, c, fx.ts.URL+"/fleet") |
| - if status != 200 || !strings.Contains(body, "Fleet status") || !strings.Contains(body, "No snapshots yet") { |
| + status, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| + if status != 200 || !strings.Contains(body, "<h1>Boxes</h1>") || !strings.Contains(body, "No snapshots yet") { |
| t.Fatalf("empty fleet state: %d %s", status, body) |
| } |
| } |
| -// TestFleetKeylessReadable: /fleet is a read, so a deployment with no |
| +// TestBoxesKeylessReadable: /fleet/boxes is a read, so a deployment with no |
| // CARLOS_RELEASE_KEY configured (promotions disabled, console read-only) |
| // must still serve it to an operator. |
| -func TestFleetKeylessReadable(t *testing.T) { |
| +func TestBoxesKeylessReadable(t *testing.T) { |
| fx := newConsoleFixtureKeyed(t, false) |
| seedFleetJSON(t, fx) |
| c := signInPaul(t, fx) |
| if err := fx.st.SetOperator("paul@keymail.dev", true); err != nil { |
| t.Fatal(err) |
| } |
| - status, _, body := get(t, c, fx.ts.URL+"/fleet") |
| - if status != 200 || !strings.Contains(body, "Fleet status") { |
| - t.Fatalf("keyless /fleet = %d %s, want 200 with Fleet status", status, body) |
| + status, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| + if status != 200 || !strings.Contains(body, "<h1>Boxes</h1>") { |
| + t.Fatalf("keyless /fleet/boxes = %d %s, want 200 with the Boxes heading", status, body) |
| + } |
| +} |
| + |
| +// TestBoxesShowsBackgroundJobs: a pass's failed run shows on Boxes' jobs |
| +// table with its label, the Failed word and its error as the note. |
| +func TestBoxesShowsBackgroundJobs(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + c := signInOperator(t, fx) |
| + _ = fx.srv.jobs.Run(context.Background(), "StartEconomicsPass", func(context.Context) error { |
| + return errors.New("could not read usage for 24 Oct") |
| + }) |
| + status, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| + if status != 200 { |
| + t.Fatalf("/fleet/boxes = %d: %s", status, body) |
| + } |
| + i := strings.Index(body, `id="jobs"`) |
| + if i < 0 { |
| + t.Fatalf("/fleet/boxes has no jobs table:\n%s", body) |
| + } |
| + jobs := body[i:] |
| + for _, want := range []string{"<span>Economics</span>", ">Failed</span>", "could not read usage for 24 Oct"} { |
| + if !strings.Contains(jobs, want) { |
| + t.Fatalf("/fleet/boxes jobs table missing %q in:\n%s", want, jobs) |
| + } |
| + } |
| +} |
| + |
| +// TestBoxesHostMemoryMeter: a fresh host's row carries a meter of its used |
| +// memory (1 GB available of 2 GB is 50), and a dark host's row none, since |
| +// an unreachable host shows no numbers. |
| +func TestBoxesHostMemoryMeter(t *testing.T) { |
| + fx := newConsoleFixture(t) |
| + seedHostBoxes(t, fx) |
| + c := signInOperator(t, fx) |
| + status, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| + if status != 200 { |
| + t.Fatalf("/fleet/boxes = %d: %s", status, body) |
| + } |
| + i := strings.Index(body, "<h2>Hosts</h2>") |
| + if i < 0 { |
| + t.Fatalf("/fleet/boxes has no Hosts table:\n%s", body) |
| + } |
| + hosts := body[i:] |
| + for _, want := range []string{"<th>Memory</th>", "<th>Last report</th>"} { |
| + if !strings.Contains(hosts, want) { |
| + t.Fatalf("the Hosts table has no %s:\n%s", want, hosts) |
| + } |
| + } |
| + row := func(label string) string { |
| + t.Helper() |
| + j := strings.Index(hosts, label) |
| + if j < 0 { |
| + t.Fatalf("no Hosts row for %s:\n%s", label, hosts) |
| + } |
| + rest := hosts[j:] |
| + return rest[:strings.Index(rest, "</tr>")] |
| + } |
| + if fresh := row("ada-stargazing"); !strings.Contains(fresh, `<meter rst-meter-bar value="50"`) { |
| + t.Errorf("the fresh host's row has no meter at 50:\n%s", fresh) |
| + } |
| + if dark := row("grace-kayaking"); strings.Contains(dark, "<meter rst-meter-bar") { |
| + t.Errorf("the dark host's row has a meter:\n%s", dark) |
| } |
| } |
| // seedHostBoxes writes one fresh and one long-dark box snapshot, both |
| // carrying a private Metrics block, and publishes the merged feed over them — |
| -// the exact pair /fleet's Hosts detail has to tell apart. |
| +// the exact pair /fleet/boxes' Hosts detail has to tell apart. |
| func seedHostBoxes(t *testing.T, fx *consoleFixture) { |
| t.Helper() |
| ctx := context.Background() |
| @@ -1877,9 +1945,9 @@ func TestFleetHostsDetailSuppressesStaleMetrics(t *testing.T) { |
| if err := fx.st.SetOperator("paul@keymail.dev", true); err != nil { |
| t.Fatal(err) |
| } |
| - code, _, body := get(t, c, fx.ts.URL+"/fleet") |
| + code, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| if code != 200 { |
| - t.Fatalf("/fleet = %d: %s", code, body) |
| + t.Fatalf("/fleet/boxes = %d: %s", code, body) |
| } |
| for _, want := range []string{ |
| "Hosts", "ada-stargazing", "abc1234", "connected", |
| @@ -1887,7 +1955,7 @@ func TestFleetHostsDetailSuppressesStaleMetrics(t *testing.T) { |
| "grace-kayaking", "unreachable", |
| } { |
| if !strings.Contains(body, want) { |
| - t.Fatalf("/fleet hosts detail missing %q in:\n%s", want, body) |
| + t.Fatalf("/fleet/boxes hosts detail missing %q in:\n%s", want, body) |
| } |
| } |
| for _, leaked := range []string{"beefcaf", "8.25", "7.0 GB", "9.0 GB", "3.0 GB"} { |
| @@ -1899,7 +1967,7 @@ func TestFleetHostsDetailSuppressesStaleMetrics(t *testing.T) { |
| // TestFleetHostsDegradeWhenUnreadable: the Hosts detail is an extra read on a |
| // page that already had a job. If the boxes can't be listed, the page still |
| -// renders the merged feed it could read — metrics are never the reason /fleet |
| +// renders the merged feed it could read — metrics are never the reason Boxes |
| // 500s. |
| func TestFleetHostsDegradeWhenUnreadable(t *testing.T) { |
| fx := newConsoleFixture(t) |
| @@ -1909,9 +1977,9 @@ func TestFleetHostsDegradeWhenUnreadable(t *testing.T) { |
| if err := fx.st.SetOperator("paul@keymail.dev", true); err != nil { |
| t.Fatal(err) |
| } |
| - code, _, body := get(t, c, fx.ts.URL+"/fleet") |
| - if code != 200 || !strings.Contains(body, "Fleet status") || !strings.Contains(body, "ada-stargazing") { |
| - t.Fatalf("/fleet with an unlistable bucket = %d, want the fleet feed still rendered:\n%s", code, body) |
| + code, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| + if code != 200 || !strings.Contains(body, "<h1>Boxes</h1>") || !strings.Contains(body, "ada-stargazing") { |
| + t.Fatalf("/fleet/boxes with an unlistable bucket = %d, want the fleet feed still rendered:\n%s", code, body) |
| } |
| } |
| @@ -1933,9 +2001,9 @@ func TestFleetHostsEscapesHostSuppliedStrings(t *testing.T) { |
| if err := fx.st.SetOperator("paul@keymail.dev", true); err != nil { |
| t.Fatal(err) |
| } |
| - code, _, body := get(t, c, fx.ts.URL+"/fleet") |
| + code, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| if code != 200 { |
| - t.Fatalf("/fleet = %d: %s", code, body) |
| + t.Fatalf("/fleet/boxes = %d: %s", code, body) |
| } |
| if strings.Contains(body, "<script>alert(1)</script>") { |
| t.Fatalf("a host-supplied release string reached the page unescaped:\n%s", body) |
| @@ -2773,7 +2841,7 @@ func TestConsoleNameBrandsThePages(t *testing.T) { |
| } |
| } |
| -// TestFleetShowsDisplayNames: both tables on /fleet show a named box as its |
| +// TestFleetShowsDisplayNames: both tables on /fleet/boxes show a named box as its |
| // name with the label muted beside it, an unnamed box exactly as before, and |
| // a box-written name escaped like every other string a box supplies. |
| func TestFleetShowsDisplayNames(t *testing.T) { |
| @@ -2800,11 +2868,11 @@ func TestFleetShowsDisplayNames(t *testing.T) { |
| if err := fx.st.SetOperator("paul@keymail.dev", true); err != nil { |
| t.Fatal(err) |
| } |
| - code, _, body := get(t, c, fx.ts.URL+"/fleet") |
| + code, _, body := get(t, c, fx.ts.URL+"/fleet/boxes") |
| if code != 200 { |
| - t.Fatalf("/fleet = %d: %s", code, body) |
| + t.Fatalf("/fleet/boxes = %d: %s", code, body) |
| } |
| - named := `<td>aoife-herding-ie <span class="small">zed-x</span></td>` |
| + named := `<td>aoife-herding-ie <span co-note>zed-x</span></td>` |
| if n := strings.Count(body, named); n != 2 { |
| t.Errorf("named cell %q appears %d times, want 2 (Boxes and Hosts):\n%s", named, n, body) |
| } |
diff --git a/internal/console/storepage_test.go b/internal/console/storepage_test.go| index ca6e300d5..ed44d0404 100644 |
| --- a/internal/console/storepage_test.go |
| +++ b/internal/console/storepage_test.go |
| @@ -84,7 +84,7 @@ func TestStoreQueueGateAndNonmemberDecision(t *testing.T) { |
| if status != 200 || !strings.Contains(body, "operator-only-note") { |
| t.Fatalf("queue=%d %s", status, body) |
| } |
| - _, _, body = get(t, c, fx.ts.URL+"/fleet") |
| + _, _, body = get(t, c, fx.ts.URL+"/fleet/boxes") |
| if !strings.Contains(body, "1 pending") { |
| t.Fatal("fleet has no pending count") |
| } |
diff --git a/internal/console/templates/fleet.html b/internal/console/templates/fleet.html| deleted file mode 100644 |
| index 5a40d0d57..000000000 |
| --- a/internal/console/templates/fleet.html |
| +++ /dev/null |
| @@ -1,135 +0,0 @@ |
| -{{define "fleet"}}{{template "top" .}} |
| -<h1>Fleet status</h1> |
| -{{if .StorePending}}<p><a href="/fleet/store">Object storage applications: {{.StorePending}} pending</a></p>{{else if .StoreQueueUnknown}}<p><a href="/fleet/store">Object storage applications: count unavailable</a></p>{{end}} |
| -<p class="small"><a href="/fleet/architecture">See the architecture →</a></p> |
| -{{if .Fleet}} |
| -<p class="small">Generated {{fmtTime .Fleet.GeneratedAt}}</p> |
| - |
| -<section class="tiles" aria-label="Fleet summary"> |
| - <div class="tile"> |
| - <h2>Instances</h2> |
| - <p class="tile-value">{{intOrDash (mapGet .Fleet.Instances "total")}}</p> |
| - <p class="tile-detail"> |
| - static {{intOrDash (mapGet .Fleet.Instances "static")}} · |
| - resident {{intOrDash (mapGet .Fleet.Instances "resident")}} · |
| - hibernating {{intOrDash (mapGet .Fleet.Instances "hibernating")}} · |
| - awake {{intOrDash (mapGet .Fleet.Instances "awake")}} · |
| - asleep {{intOrDash (mapGet .Fleet.Instances "asleep")}} |
| - </p> |
| - </div> |
| - <div class="tile"> |
| - <h2>Capacity</h2> |
| - <p class="tile-value">{{strOrDash .Fleet.Capacity.Level}}</p> |
| - </div> |
| - <div class="tile"> |
| - <h2>Replication</h2> |
| - <p class="tile-value">{{boolWord .Fleet.Replication.Healthy "healthy" "unhealthy"}}</p> |
| - </div> |
| - <div class="tile"> |
| - <h2>Adoption</h2> |
| - <p class="tile-value">{{boolWord .Fleet.AdoptionRunning "running" "not running"}}</p> |
| - </div> |
| -</section> |
| - |
| -<h2>Boxes</h2> |
| -{{if .Fleet.Boxes}} |
| -<div class="tablewrap"> |
| -<table> |
| - <tr> |
| - <th>Label</th><th>{{$.RegionCopy.PickerLabel}}</th><th>Load</th> |
| - <th>Static</th><th>Resident</th><th>Hibernating</th><th>Awake</th><th>Asleep</th> |
| - <th>Adoption</th> |
| - <th>Config sync</th> |
| - <th></th> |
| - </tr> |
| - {{range .Fleet.Boxes}} |
| - <tr> |
| - <td>{{if .Name}}{{.Name}} <span class="small">{{.Label}}</span>{{else}}{{.Label}}{{end}}</td> |
| - <td>{{with index $.BoxRegions .Label}}{{.}}{{else}}{{emptyOrDash .Region}}{{end}}</td> |
| - <td>{{strOrDash .Load}}</td> |
| - <td>{{.Routes.Static}}</td> |
| - <td>{{.Routes.Resident}}</td> |
| - <td>{{.Routes.Hibernating}}</td> |
| - <td>{{intOrDash .Routes.Awake}}</td> |
| - <td>{{intOrDash .Routes.Asleep}}</td> |
| - <td>{{boolWord .AdoptionRunning "running" "not running"}}</td> |
| - <td>{{boolWord .ConfigPathRunning "armed" "not armed"}}</td> |
| - <td>{{if .Stale}}<span class="chip chip-stale">stale</span>{{end}}</td> |
| - </tr> |
| - {{end}} |
| -</table> |
| -</div> |
| -{{else}}<p class="small">No box snapshots yet.</p>{{end}} |
| - |
| -<h2>Apps</h2> |
| -{{if .Fleet.Apps}} |
| -<div class="tablewrap"> |
| -<table> |
| - <tr><th>Name</th><th>{{$.RegionCopy.PickerLabel}}</th><th>Instances</th><th>Healthy</th><th>Channel</th><th>Version</th></tr> |
| - {{range .Fleet.Apps}} |
| - <tr> |
| - <td>{{.Name}}</td> |
| - <td>{{with index $.FleetAppRegions .Name}}{{.}}{{else}}—{{end}}</td> |
| - <td>{{.Instances}}</td> |
| - <td>{{if .Healthy}}healthy{{else}}unhealthy{{end}}</td> |
| - <td>{{.Channel}}</td> |
| - <td>{{.Version}}</td> |
| - </tr> |
| - {{end}} |
| -</table> |
| -</div> |
| -{{else}}<p class="small">No opted-in apps yet.</p>{{end}} |
| -{{if .Fleet.AppsUnlisted}} |
| -<p class="small">{{.Fleet.AppsUnlisted}} more app{{if ne .Fleet.AppsUnlisted 1}}s{{end}} running, not publicly named.</p> |
| -{{end}} |
| - |
| -<h2>Services</h2> |
| -{{if .Fleet.Services}} |
| -<div class="chips"> |
| - {{range .Fleet.Services}} |
| - <span class="chip {{if .Up}}chip-up{{else}}chip-down{{end}}">{{.Name}} {{if .Up}}up{{else}}down{{end}}</span> |
| - {{end}} |
| -</div> |
| -{{else}}<p class="small">No services reporting.</p>{{end}} |
| - |
| -<p class="small">Aggregate counts and status words only — never hostnames, machine identifiers, or raw utilization figures; anything this page doesn't know shows as an em-dash, never guessed.</p> |
| -{{else}} |
| -<p>No snapshots yet — the fleet status writer hasn't published <code>status/fleet.json</code> on this deployment.</p> |
| -{{end}} |
| - |
| -{{if .Hosts}} |
| -<h2>Hosts</h2> |
| -<div class="tablewrap"> |
| -<table> |
| - <tr> |
| - <th>Host</th><th>Region</th><th>Release</th><th>Tunnel</th> |
| - <th>Memory free</th><th>Load</th><th>Disk free</th><th>Last report</th> |
| - </tr> |
| - {{range .Hosts}} |
| - <tr> |
| - <td>{{if .Name}}{{.Name}} <span class="small">{{.Label}}</span>{{else}}{{.Label}}{{end}}</td> |
| - <td>{{with index $.BoxRegions .Label}}{{.}}{{else}}{{emptyOrDash .Region}}{{end}}</td> |
| - {{if .Metrics}} |
| - <td>{{emptyOrDash .Metrics.Release}}</td> |
| - <td>{{emptyOrDash .Metrics.Tunnel}}</td> |
| - <td>{{bytesOrDash .Metrics.MemAvailBytes}} / {{bytesOrDash .Metrics.MemTotalBytes}}</td> |
| - <td>{{loadOrDash .Metrics.Load1}}</td> |
| - <td>{{bytesOrDash .Metrics.DiskFreeBytes}}</td> |
| - <td>{{fmtTime .LastSeen}}</td> |
| - {{else if .Stale}} |
| - {{/* An unreachable host says how long it has been dark and nothing else: |
| - its last readings are history, and a history rendered in a "now" |
| - column is how an outage gets missed. */}} |
| - <td colspan="5"><span class="chip chip-down">unreachable</span> last heartbeat {{.Dark}} ago</td> |
| - <td>{{fmtTime .LastSeen}}</td> |
| - {{else}} |
| - <td colspan="5" class="small">no metrics block — this host predates raw metric reporting</td> |
| - <td>{{fmtTime .LastSeen}}</td> |
| - {{end}} |
| - </tr> |
| - {{end}} |
| -</table> |
| -</div> |
| -<p class="small">Read from <code>status/boxes/</code> in the deployment bucket, which is not public — these are raw figures, unlike the aggregate feed above, and this page is why they stay behind a session.</p> |
| -{{end}} |
| -{{template "bottom" .}}{{end}} |
diff --git a/internal/console/templates/ops_boxes.html b/internal/console/templates/ops_boxes.html| new file mode 100644 |
| index 000000000..07d7894e4 |
| --- /dev/null |
| +++ b/internal/console/templates/ops_boxes.html |
| @@ -0,0 +1,122 @@ |
| +{{/* Boxes (/fleet/boxes, opboxes.go): what /fleet showed before the |
| + operator pages, in the same order with the same words, on Rastrillo's |
| + components, then the background jobs table. */}} |
| +{{define "ops_boxes"}}{{template "op_top" .}} |
| +{{template "op_page_header" (opHeader .Title "Every box, its apps, and the platform's background jobs.")}} |
| +{{if .StorePending}}<div rst-callout rst-tone="info"><span rst-callout-ic aria-hidden="true">{{icon "info"}}</span><div rst-callout-body><p><a href="/fleet/store">Object storage applications: {{.StorePending}} pending</a></p></div></div> |
| +{{else if .StoreQueueUnknown}}<div rst-callout rst-tone="info"><span rst-callout-ic aria-hidden="true">{{icon "info"}}</span><div rst-callout-body><p><a href="/fleet/store">Object storage applications: count unavailable</a></p></div></div> |
| +{{end}} |
| +{{if .Fleet}} |
| +<p co-note>Generated {{fmtTime .Fleet.GeneratedAt}}</p> |
| + |
| +<section rst-stats aria-label="Fleet summary"> |
| + {{template "op_stat" (opStat "Instances" (intOrDash (mapGet .Fleet.Instances "total")) (printf "static %s · resident %s · hibernating %s · awake %s · asleep %s" (intOrDash (mapGet .Fleet.Instances "static")) (intOrDash (mapGet .Fleet.Instances "resident")) (intOrDash (mapGet .Fleet.Instances "hibernating")) (intOrDash (mapGet .Fleet.Instances "awake")) (intOrDash (mapGet .Fleet.Instances "asleep"))) true)}} |
| + {{template "op_stat" (opStat "Capacity" (strOrDash .Fleet.Capacity.Level) "" false)}} |
| + {{template "op_stat" (opStat "Replication" (boolWord .Fleet.Replication.Healthy "healthy" "unhealthy") "" false)}} |
| + {{template "op_stat" (opStat "Adoption" (boolWord .Fleet.AdoptionRunning "running" "not running") "" false)}} |
| +</section> |
| + |
| +<div rst-box-head><h2>Boxes</h2></div> |
| +{{if .Fleet.Boxes}} |
| +<div rst-card class="co-table-wrap"> |
| +<table co-table> |
| + <tr> |
| + <th>Label</th><th>{{$.RegionCopy.PickerLabel}}</th><th>Load</th> |
| + <th>Static</th><th>Resident</th><th>Hibernating</th><th>Awake</th><th>Asleep</th> |
| + <th>Adoption</th> |
| + <th>Config sync</th> |
| + <th></th> |
| + </tr> |
| + {{range .Fleet.Boxes}} |
| + <tr id="box-{{.Label}}"> |
| + <td>{{if .Name}}{{.Name}} <span co-note>{{.Label}}</span>{{else}}{{.Label}}{{end}}</td> |
| + <td>{{with index $.BoxRegions .Label}}{{.}}{{else}}{{emptyOrDash .Region}}{{end}}</td> |
| + <td>{{strOrDash .Load}}</td> |
| + <td>{{.Routes.Static}}</td> |
| + <td>{{.Routes.Resident}}</td> |
| + <td>{{.Routes.Hibernating}}</td> |
| + <td>{{intOrDash .Routes.Awake}}</td> |
| + <td>{{intOrDash .Routes.Asleep}}</td> |
| + <td>{{boolWord .AdoptionRunning "running" "not running"}}</td> |
| + <td>{{boolWord .ConfigPathRunning "armed" "not armed"}}</td> |
| + <td>{{if .Stale}}{{template "op_status" (opPill "stale" "negative")}}{{end}}</td> |
| + </tr> |
| + {{end}} |
| +</table> |
| +</div> |
| +{{else}}<p co-note>No box snapshots yet.</p>{{end}} |
| + |
| +<div rst-box-head><h2>Apps</h2></div> |
| +{{if .Fleet.Apps}} |
| +<div rst-card class="co-table-wrap"> |
| +<table co-table> |
| + <tr><th>Name</th><th>{{$.RegionCopy.PickerLabel}}</th><th>Instances</th><th>Healthy</th><th>Channel</th><th>Version</th></tr> |
| + {{range .Fleet.Apps}} |
| + <tr> |
| + <td>{{.Name}}</td> |
| + <td>{{with index $.FleetAppRegions .Name}}{{.}}{{else}}—{{end}}</td> |
| + <td>{{.Instances}}</td> |
| + <td>{{if .Healthy}}healthy{{else}}unhealthy{{end}}</td> |
| + <td>{{.Channel}}</td> |
| + <td>{{.Version}}</td> |
| + </tr> |
| + {{end}} |
| +</table> |
| +</div> |
| +{{else}}<p co-note>No opted-in apps yet.</p>{{end}} |
| +{{if .Fleet.AppsUnlisted}} |
| +<p co-note>{{.Fleet.AppsUnlisted}} more app{{if ne .Fleet.AppsUnlisted 1}}s{{end}} running, not publicly named.</p> |
| +{{end}} |
| + |
| +<div rst-box-head><h2>Services</h2></div> |
| +{{if .Fleet.Services}} |
| +<p> |
| + {{range .Fleet.Services}} |
| + {{if .Up}}{{template "op_status" (opPill (printf "%s up" .Name) "positive")}}{{else}}{{template "op_status" (opPill (printf "%s down" .Name) "negative")}}{{end}} |
| + {{end}} |
| +</p> |
| +{{else}}<p co-note>No services reporting.</p>{{end}} |
| + |
| +<p co-note>Aggregate counts and status words only — never hostnames, machine identifiers, or raw utilization figures; anything this page doesn't know shows as an em-dash, never guessed.</p> |
| +{{else}} |
| +<p>No snapshots yet — the fleet status writer hasn't published <code>status/fleet.json</code> on this deployment.</p> |
| +{{end}} |
| + |
| +{{if .Hosts}} |
| +<div rst-box-head><h2>Hosts</h2></div> |
| +<div rst-card class="co-table-wrap"> |
| +<table co-table> |
| + <tr> |
| + <th>Host</th><th>Region</th><th>Release</th><th>Tunnel</th> |
| + <th>Memory</th><th>Load</th><th>Disk free</th><th>Last report</th> |
| + </tr> |
| + {{range .Hosts}} |
| + <tr> |
| + <td>{{if .Name}}{{.Name}} <span co-note>{{.Label}}</span>{{else}}{{.Label}}{{end}}</td> |
| + <td>{{with index $.BoxRegions .Label}}{{.}}{{else}}{{emptyOrDash .Region}}{{end}}</td> |
| + {{if .Metrics}} |
| + <td>{{emptyOrDash .Metrics.Release}}</td> |
| + <td>{{emptyOrDash .Metrics.Tunnel}}</td> |
| + {{$mem := printf "%s / %s" (bytesOrDash .Metrics.MemAvailBytes) (bytesOrDash .Metrics.MemTotalBytes)}}{{$used := memUsedPct .Metrics}} |
| + <td>{{if ge $used 0}}{{template "op_meter" (opMeter $used $mem)}}{{else}}{{$mem}}{{end}}</td> |
| + <td>{{loadOrDash .Metrics.Load1}}</td> |
| + <td>{{bytesOrDash .Metrics.DiskFreeBytes}}</td> |
| + <td>{{fmtTime .LastSeen}}</td> |
| + {{else if .Stale}} |
| + {{/* An unreachable host says how long it has been dark and nothing else: |
| + its last readings are history, and a history rendered in a "now" |
| + column is how an outage gets missed. */}} |
| + <td colspan="5">{{template "op_status" (opPill "unreachable" "negative")}} last heartbeat {{.Dark}} ago</td> |
| + <td>{{fmtTime .LastSeen}}</td> |
| + {{else}} |
| + <td colspan="5" co-note>no metrics block — this host predates raw metric reporting</td> |
| + <td>{{fmtTime .LastSeen}}</td> |
| + {{end}} |
| + </tr> |
| + {{end}} |
| +</table> |
| +</div> |
| +<p co-note>Read from <code>status/boxes/</code> in the deployment bucket, which is not public — these are raw figures, unlike the aggregate feed above, and this page is why they stay behind a session.</p> |
| +{{end}} |
| +{{template "op_jobs" .Jobs}} |
| +{{template "op_bottom" .}}{{end}} |
diff --git a/internal/console/testdata/claim-routes.txt b/internal/console/testdata/claim-routes.txt| index b6881cc5e..21b9363ed 100644 |
| --- a/internal/console/testdata/claim-routes.txt |
| +++ b/internal/console/testdata/claim-routes.txt |
| @@ -112,6 +112,7 @@ route GET /auth/email/link |
| route GET /auth/signin |
| route GET /auth/stepup/callback |
| route GET /fleet |
| +route GET /fleet/boxes |
| route GET /fleet/economics |
| route GET /fleet/economics/accounts |
| route GET /fleet/index |
diff --git a/internal/console/testdata/perf-budgets.txt b/internal/console/testdata/perf-budgets.txt| index 15e05f559..e97fc0aaa 100644 |
| --- a/internal/console/testdata/perf-budgets.txt |
| +++ b/internal/console/testdata/perf-budgets.txt |
| @@ -62,6 +62,7 @@ GET /a/{sqid}/settings calls 2: the account telemetry settings and the storage e |
| GET /a/{sqid}/{$} over: a warm view reads nothing (0 S3 calls; each app's frame is cached); a cold view reads every app's frame (6 S3 calls per app, about 155 ms for one) |
| GET /a/{sqid}/trash over: reads each trashed app's deleted.json marker (1 S3 call warm and cold per app) |
| GET /fleet over: lists and reads every box report, reads status/fleet.json, and lists and reads the storage entitlements (8 S3 calls warm and cold, median about 260 ms) |
| +GET /fleet/boxes over: lists and reads every box report, reads status/fleet.json, and lists and reads the storage entitlements; operator pages are seldom viewed and carry no cache (8 S3 calls warm and cold, median about 260 ms) |
| GET /fleet/economics over: the cold view sweeps usage for every day of the period (162 S3 calls, about 4.1 s); warm views come from the 60 s cache (0 S3 calls) |
| GET /fleet/economics/accounts over: shares /fleet/economics's sweep cache, so its own cold view is that same sweep (0 S3 calls warm) |
| GET /fleet/metrics over: a cold view reads every box's metrics hours for two days (about 120 S3 calls, counted in Overview's cold view); warm views are cached (0 S3 calls), and the walk never sees it cold: the app pages before it fill that cache and perfColdReset leaves it |
diff --git a/internal/console/view.go b/internal/console/view.go| index 01d1c892c..28fd45545 100644 |
| --- a/internal/console/view.go |
| +++ b/internal/console/view.go |
| @@ -972,7 +972,7 @@ type HostRow struct { |
| // A nil store is not an error: a deployment configured without a bucket |
| // handle simply has no host detail to show, and the fleet page renders |
| // without the section rather than failing. Same posture for the caller on a |
| -// read error — see handleFleet. |
| +// read error — see handleBoxes. |
| func HostRows(ctx context.Context, s release.Store, now time.Time) ([]HostRow, error) { |
| if s == nil { |
| return nil, nil |