console remote instances: no remote metrics; page slot reads held a minute
Astra round 6. Remote rows take no CPU, memory or graphs: the box pin, the until window and windowReading are deleted, appResourceMetrics skips remote rows and instanceHealth gives remote records no readings (health from the rollout entry alone). TestRemoteRowsNeverCarrySamples fails if any remote row carries a sample. pageRecords' judged reads hold each host incarnation slot read in the box-report cache for a minute, beside the record version it was read with, so a page view within the minute adds no slot GETs. The request budget test runs with lifetimes on and counts slot GETs. P2 #2 is discussion 415. Census re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 files changed,
+368
−324
docs/superpowers/notes/census-proposal-console-remote-instances.md+4 −4docs/superpowers/notes/console-remote-instances.md+34 −0internal/console/apiinstances.go+13 −29internal/console/apiroutes.go+1 −1internal/console/metricsview.go+7 −101internal/console/remoteinstances.go+112 −16internal/console/remoteinstances_round1_test.go+0 −14internal/console/remoteinstances_round2_test.go+1 −40internal/console/remoteinstances_round4_test.go+0 −39internal/console/remoteinstances_round6_test.go+115 −0internal/console/remoteinstances_test.go+45 −30internal/console/server.go+11 −18internal/console/view.go+12 −23internal/provision/console_remote_instances_census_test.go+5 −1internal/provision/testdata/plan14-root-reads-chain.tsv+1 −1internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv+7 −7
diff --git a/docs/superpowers/notes/census-proposal-console-remote-instances.md b/docs/superpowers/notes/census-proposal-console-remote-instances.md| index a736ebb66..4cfb0af8f 100644 |
| --- a/docs/superpowers/notes/census-proposal-console-remote-instances.md |
| +++ b/docs/superpowers/notes/census-proposal-console-remote-instances.md |
| @@ -5,15 +5,15 @@ Ruling `census-ruling-console-remote-instances`. Every change below keeps the di |
| | unit | change | read sites | what changed | |
| |---|---|---|---| |
| | `internal/console/accountfleet.go` `Server.assembleAccountFleet` | body | unchanged (9) | Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. | |
| -| `internal/console/apiinstances.go` `Server.healthByHost` | body | unchanged (12) | Takes an awake set, a box pin per host and an ownership window per host (since, until) from the caller: readings only from that box and only from samples inside the window, via ownerAppMetricsFrom; registry reads unchanged. | |
| -| `internal/console/apiroutes.go` `Server.handleAPIRoutes` | body | unchanged (33) | Passes nil for healthByHost's new awake, box-pin and ownership-window arguments; nothing else. | |
| +| `internal/console/apiinstances.go` `Server.healthByHost` | body | unchanged (12) | Takes only the caller's ownership start per host (sinceByHost): readings only from samples at or after it, via ownerAppMetricsFrom. The awake set, the box pin and the until window are gone. Registry reads unchanged. | |
| +| `internal/console/apiroutes.go` `Server.handleAPIRoutes` | body | unchanged (33) | Passes nil for healthByHost's ownership-start argument; nothing else. | |
| | `internal/console/claim_retire.go` `Server.retireClaimHostRecord` | body | unchanged (1) | Notes the app in the console's in-memory deletion log (noteRecordDeletion, which also invalidates the pages' held box reports) before retiring a record, for the canary-retire guard; the retire itself is unchanged. | |
| | `internal/console/instancepage.go` `Server.handleAppInstance` | body | unchanged (6) | A remote row (no local registry row) runs none of the hostname-keyed box joins (layout, rollout, updates): it shows only what its row brought through remoteFacts, aliases included. Local rows read layout, rollout join and ListAliases as before. | |
| | `internal/console/metricsview.go` `buildUnitRows` | body | unchanged (2) | Each unit row also keeps its raw per-sample readings (float32 CPU, int64 memory) so an owner's graph can be redrawn from only their samples; reads nothing new. | |
| | `internal/console/metricsview.go` `type UnitRow` | body | unchanged (1) | Two unexported fields carrying those raw per-sample readings; schema only. | |
| | `internal/console/server.go` `Server.channelHosts` | body | unchanged (4) | Canary-retire guard also counts the account's instance records (ListRecordsStrict under the lifetime judge, listRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. | |
| | `internal/console/templates/app_overview.html` `external` | body | unchanged (1) | Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only. | |
| -| `internal/console/apiinstances.go` `Server.instanceHealth` | sites | +whole:Route ×4 | Records with no local registry row get health only from remoteFacts: a box report whose rollout entry names the record's own account and app, generated after the record was created (held down: Failed; transient, unidentified or unread: Can't tell right now), readings pinned to that box and bounded by the record's created_at and the report's generation. Builds registry.Route literals from the record; reads no registry for them. | |
| +| `internal/console/apiinstances.go` `Server.instanceHealth` | sites | +whole:Route ×3 | Records with no local registry row get health only from remoteFacts (a box report whose rollout entry names the record's own account and app, generated after the record was created): awake is Running, held down is Failed, transient or unidentified is Can't tell right now. No metrics readings at all and no registry.Route literal for them. Local records unchanged. | |
| | `internal/console/view.go` `Assemble` | sites | +registry:Host, +whole:Route | Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row (its record's created_at bounds the local row's metrics history); adds rows from the account's records and remoteFacts when given a remote source. | |
| Envelopes re-pinned: `internal/console`, `internal/console/templates`. |
| @@ -34,6 +34,6 @@ Recorded dispositions, which each change must still satisfy: |
| - `internal/console/apiinstances.go` `Server.instanceHealth`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route |
| - `internal/console/view.go` `Assemble`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route |
| -Seal: `9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924` → `c4b872b770e88ffa7ffc349490e05d7ae84257bb1bee5b8c8c92444e319fb222`. |
| +Seal: `9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924` → `dca65b72ab685c21c4029fdf101792d155da7109698390f34c80b658447230fd`. |
| Overlay: `internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/docs/superpowers/notes/console-remote-instances.md b/docs/superpowers/notes/console-remote-instances.md| index 627e15792..950524473 100644 |
| --- a/docs/superpowers/notes/console-remote-instances.md |
| +++ b/docs/superpowers/notes/console-remote-instances.md |
| @@ -379,3 +379,37 @@ The round 4 notes above about the edges file, edges-only identities, |
| exists. The budget line for `control/edges/` is void: the cached load |
| reads `status/boxes/` only, as before round 4. |
| + |
| +## Round 6 review (Astra, 9788f4d1): no remote metrics, held slot reads |
| + |
| +1. **Remote rows take no metrics.** Astra found that a predecessor's |
| + samples could still join a remote row when they were taken after the |
| + record's creation. The coordinator ruled to cut remote metrics rather |
| + than bound them again. A row for an instance on another box shows no |
| + CPU, memory or graphs, and uses the existing no-data wording. Its |
| + health comes from the rollout entry alone: awake is Running, held down |
| + is Failed, and transient or unidentified is "Can't tell right now". |
| + The box pin (`metricsBox`), the upper bound (`until`) and |
| + `windowReading` are deleted. `appResourceMetrics` skips remote rows, |
| + and `instanceHealth` gives remote records no readings. Local rows keep |
| + their readings and their record-bounded history (`since`). |
| + `TestRemoteRowsNeverCarrySamples` puts a fresh sample of the remote |
| + unit on every box and fails if any remote row carries one. The |
| + Metrics item at the top of this note and the round 1 to 4 metrics |
| + fixes describe code that no longer exists. |
| +2. **Held slot reads.** With lifetimes on, each judged record read also |
| + reads the host's incarnation slot. A page view no longer sends those |
| + GETs live every time. `pageRecords` reads through `slotHeldStore`, |
| + which holds each slot read in the box-report cache for `boxReportTTL`. |
| + The read is held only beside the record version it was read with: a |
| + rewritten record misses (`TestHeldSlotReadFollowsTheRecordVersion`), |
| + and `invalidate`, which every deleting path reaches through |
| + `noteRecordDeletion`, drops them all. `TestRemoteInstanceRequestBudget` |
| + now runs with lifetimes on and counts slot GETs: one per remote record |
| + on the first view, none within the minute, one again after it. |
| + Residual: a lifetime that ends without its record changing can show |
| + for up to a minute. That is the same lag the box reports already have, |
| + and only the page rows read this way. The retire guard and the |
| + deleting paths read live. |
| +3. **Detach and recovery bypass the deletion evidence (P2).** Filed as |
| + discussion #415. |
diff --git a/internal/console/apiinstances.go b/internal/console/apiinstances.go| index d88416c67..c56015417 100644 |
| --- a/internal/console/apiinstances.go |
| +++ b/internal/console/apiinstances.go |
| @@ -285,13 +285,11 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma |
| // A record whose route is on another box has no row here. Its health |
| // comes from the box that reports it, the same join the app pages make |
| // (remoteinstances.go): only a report whose rollout names this record's |
| - // own account and app, with readings pinned to that box. A record no |
| + // own account and app. It takes no metrics readings at all: the word |
| + // comes from the rollout's awake, down and transient alone. A record no |
| // box reports stays "Setting up" when every box was read; when the read |
| // was incomplete, the record is placed on a customer fleet, or the only |
| // report names no tenant, its state is unknown and says so. |
| - var awake map[string]bool |
| - boxByHost := map[string]string{} |
| - untilByHost := map[string]time.Time{} |
| if s.cfg.Releases != nil { |
| var facts appFacts |
| loaded := false |
| @@ -309,31 +307,22 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma |
| } |
| continue |
| } |
| - kind := rec.Kind |
| - if kind == "" { |
| - kind = "instance" |
| - } |
| if rep.transient { |
| // Starting or stopping on its box: not asleep, not up. |
| out[rec.Host] = healthUnknown |
| continue |
| } |
| + kind := rec.Kind |
| + if kind == "" { |
| + kind = "instance" |
| + } |
| status := "ready" |
| if rep.down { |
| // Held down after a failed hold-mode build: "Failed", as the |
| // page says. |
| status = "failed" |
| } |
| - routeFor[rec.Host] = registry.Route{Host: rec.Host, Kind: kind, Status: status, |
| - Hibernate: rec.HibernateOrDefault(), Provisioned: true} |
| - boxByHost[rec.Host] = rep.box |
| - untilByHost[rec.Host] = rep.at |
| - if rep.awake { |
| - if awake == nil { |
| - awake = map[string]bool{} |
| - } |
| - awake[rec.Host] = true |
| - } |
| + out[rec.Host] = healthWord(kind, status, rec.HibernateOrDefault(), rep.awake, true) |
| } |
| } |
| // Readings start with each record's created_at, as on the app pages: a |
| @@ -344,7 +333,7 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma |
| sinceByHost[rec.Host] = rec.CreatedAt |
| } |
| } |
| - for h, word := range s.healthByHost(ctx, routeFor, awake, boxByHost, sinceByHost, untilByHost) { |
| + for h, word := range s.healthByHost(ctx, routeFor, sinceByHost) { |
| out[h] = word |
| } |
| return out |
| @@ -363,14 +352,9 @@ func (s *Server) instanceHealth(ctx context.Context, recs []provision.Record) ma |
| // own app. The scoping lives in each caller, beside the reason that |
| // caller's rows are the caller's to see. |
| // |
| -// awake names hosts whose box reports their process awake (an instance on |
| -// another box, joined from its box report by instanceHealth): those read as |
| -// reporting even when the sweep has no sample yet, as the Running tab reads |
| -// them. boxByHost pins such a host's readings to the box whose report was |
| -// accepted for it, and sinceByHost and untilByHost bound a host's readings |
| -// by when its owner came to have it and when its box last vouched for that |
| -// (ownerAppMetricsFrom). All nil for routes the caller has no record for. |
| -func (s *Server) healthByHost(ctx context.Context, routeFor map[string]registry.Route, awake map[string]bool, boxByHost map[string]string, sinceByHost, untilByHost map[string]time.Time) map[string]string { |
| +// sinceByHost bounds a host's readings by when its owner came to have it |
| +// (ownerAppMetricsFrom); nil for routes the caller has no record for. |
| +func (s *Server) healthByHost(ctx context.Context, routeFor map[string]registry.Route, sinceByHost map[string]time.Time) map[string]string { |
| out := make(map[string]string, len(routeFor)) |
| hosts := make([]string, 0, len(routeFor)) |
| unitByHost := map[string]string{} |
| @@ -380,7 +364,7 @@ func (s *Server) healthByHost(ctx context.Context, routeFor map[string]registry. |
| unitByHost[h] = rt.Unit |
| } |
| } |
| - am, err := s.ownerAppMetricsFrom(ctx, hosts, unitByHost, boxByHost, sinceByHost, untilByHost) |
| + am, err := s.ownerAppMetricsFrom(ctx, hosts, unitByHost, sinceByHost) |
| if err != nil { |
| // An unreadable sweep is not knowledge that these instances are |
| // down: every host reads as not-reporting below, which healthWord |
| @@ -400,7 +384,7 @@ func (s *Server) healthByHost(ctx context.Context, routeFor map[string]registry. |
| if status == "" { |
| status = "ready" // registry contract: empty status means ready |
| } |
| - out[h] = healthWord(rt.Kind, status, rt.Hibernate, rep[h] || awake[h], |
| + out[h] = healthWord(rt.Kind, status, rt.Hibernate, rep[h], |
| expectsReadings(rt.Provisioned, rt.Unit, rt.Backing)) |
| } |
| return out |
diff --git a/internal/console/apiroutes.go b/internal/console/apiroutes.go| index 02886c5f9..64206b1ee 100644 |
| --- a/internal/console/apiroutes.go |
| +++ b/internal/console/apiroutes.go |
| @@ -153,7 +153,7 @@ func (s *Server) handleAPIRoutes(w http.ResponseWriter, r *http.Request) { |
| } |
| ctx, cancel := context.WithTimeout(r.Context(), routeListTimeout) |
| defer cancel() |
| - health := s.healthByHost(ctx, routeFor, nil, nil, nil, nil) |
| + health := s.healthByHost(ctx, routeFor, nil) |
| join := loadBoxJoin(ctx, s.cfg.Releases, time.Now()) |
| rows := make([]apiRoute, 0, len(routeFor)) |
| for _, rt := range routeFor { |
diff --git a/internal/console/metricsview.go b/internal/console/metricsview.go| index 0683a5274..70587ba37 100644 |
| --- a/internal/console/metricsview.go |
| +++ b/internal/console/metricsview.go |
| @@ -662,72 +662,6 @@ func unitRawMem(samples []metrics.Sample, unit string) []int64 { |
| return out |
| } |
| -// windowed is a unit's reading and graphs from the samples inside a window. |
| -type windowed struct { |
| - at time.Time |
| - cpu *float64 |
| - mem *int64 |
| - sparkCPU, sparkMem string |
| -} |
| - |
| -// windowReading is a unit's newest reading inside [since, until] and its |
| -// two graphs drawn from only those samples (memory scaled to the peak |
| -// within them). ok is false when the unit has no reading there. |
| -func windowReading(times []time.Time, u UnitRow, since, until time.Time) (windowed, bool) { |
| - if len(times) != len(u.cpu) || len(times) != len(u.mem) { |
| - return windowed{}, false |
| - } |
| - k1 := sort.Search(len(times), func(i int) bool { return !times[i].Before(since) }) |
| - k2 := sort.Search(len(times), func(i int) bool { return times[i].After(until) }) |
| - if k1 >= k2 { |
| - return windowed{}, false |
| - } |
| - var w windowed |
| - for i := k2 - 1; i >= k1; i-- { |
| - hasCPU, hasMem := !math.IsNaN(float64(u.cpu[i])), u.mem[i] >= 0 |
| - if !hasCPU && !hasMem { |
| - continue |
| - } |
| - w.at = times[i] |
| - if hasCPU { |
| - c := float64(u.cpu[i]) |
| - w.cpu = &c |
| - } |
| - if hasMem { |
| - m := u.mem[i] |
| - w.mem = &m |
| - } |
| - break |
| - } |
| - if w.at.IsZero() { |
| - return windowed{}, false |
| - } |
| - n := k2 - k1 |
| - cs := make([]*float64, n) |
| - var peak int64 |
| - for i := k1; i < k2; i++ { |
| - if c := u.cpu[i]; !math.IsNaN(float64(c)) { |
| - f := float64(c) |
| - cs[i-k1] = &f |
| - } |
| - if u.mem[i] > peak { |
| - peak = u.mem[i] |
| - } |
| - } |
| - var ms []*float64 |
| - if peak > 0 { |
| - ms = make([]*float64, n) |
| - for i := k1; i < k2; i++ { |
| - if u.mem[i] >= 0 { |
| - f := float64(u.mem[i]) / float64(peak) |
| - ms[i-k1] = &f |
| - } |
| - } |
| - } |
| - w.sparkCPU, w.sparkMem = sparkPoints(cs, 240, 40), sparkPoints(ms, 240, 40) |
| - return w, true |
| -} |
| - |
| // sparksSince redraws a unit's two graphs from only the samples at or after |
| // since, the memory one scaled to the peak within them. ok is false when |
| // the unit has no sample there at all. |
| @@ -857,20 +791,16 @@ func (m InstanceMetrics) Reporting() bool { return m.Box != "" } |
| // readings, Reporting false), never zeros and never silently dropped — an |
| // owner whose instance is asleep must still see it listed. |
| func (s *Server) OwnerAppMetrics(ctx context.Context, hosts []string, unitByHost map[string]string) ([]InstanceMetrics, error) { |
| - return s.ownerAppMetricsFrom(ctx, hosts, unitByHost, nil, nil, nil) |
| + return s.ownerAppMetricsFrom(ctx, hosts, unitByHost, nil) |
| } |
| // ownerAppMetricsFrom is OwnerAppMetrics where sinceByHost bounds a host's |
| // readings by when its current owner's route or record came to exist |
| -// (graphs redrawn from later samples only; a zero time is no readings), and |
| -// where boxByHost pins a host's |
| -// readings to one box: a host named there takes samples from that box only |
| -// and ignores every other box's samples of its units. The app pages pin an |
| -// instance on another box to the box whose report was accepted for this |
| -// account (remoteinstances.go), so a box serving the same host name for |
| -// another tenant cannot put its readings on this page. A host not named |
| -// there reads as before: the freshest box's sample. |
| -func (s *Server) ownerAppMetricsFrom(ctx context.Context, hosts []string, unitByHost, boxByHost map[string]string, sinceByHost, untilByHost map[string]time.Time) ([]InstanceMetrics, error) { |
| +// (graphs redrawn from later samples only; a zero time is no readings). A |
| +// host not named there reads as before: the freshest box's sample. Only |
| +// instances on the console's own box are ever asked for: an instance on |
| +// another box takes no readings (remoteinstances.go). |
| +func (s *Server) ownerAppMetricsFrom(ctx context.Context, hosts []string, unitByHost map[string]string, sinceByHost map[string]time.Time) ([]InstanceMetrics, error) { |
| // The allowlist, keyed by the unit names each host can legally match. |
| // Matching is exact-string on this map: a unit the caller did not ask |
| // for cannot be reached by any path below. |
| @@ -920,9 +850,6 @@ func (s *Server) ownerAppMetricsFrom(ctx context.Context, hosts []string, unitBy |
| if !ok { |
| continue // not this app's — the whole boundary is this line |
| } |
| - if pinned, ok := boxByHost[host]; ok && pinned != box.Box { |
| - continue // another box's reading of a host pinned to one box |
| - } |
| // Ownership start: a unit name derives from the hostname, and a |
| // hostname can have had another owner earlier in the window. |
| // Nothing before since is this owner's: with no start known, no |
| @@ -932,14 +859,6 @@ func (s *Server) ownerAppMetricsFrom(ctx context.Context, hosts []string, unitBy |
| if bounded && (since.IsZero() || box.At.Before(since)) { |
| continue |
| } |
| - // The upper bound: an instance on another box is proven this |
| - // owner's only up to when its box's report was observed naming |
| - // them. A later sample may be a successor tenant's under the |
| - // same hostname, so it does not join. No bound known: nothing. |
| - until, capped := untilByHost[host] |
| - if capped && until.IsZero() { |
| - continue |
| - } |
| // A host that reports on two boxes at once (a move in flight) |
| // shows the freshest box's reading, not whichever sorted first. |
| if prev, taken := at[host]; taken && !box.At.After(prev) { |
| @@ -955,20 +874,7 @@ func (s *Server) ownerAppMetricsFrom(ctx context.Context, hosts []string, unitBy |
| SparkCPU: u.SparkCPU, |
| SparkMem: u.SparkMem, |
| } |
| - if capped && box.At.After(until) { |
| - // The newest samples are past the bound: the reading and |
| - // both graphs come from the samples inside it, and a reading |
| - // that old is no current reading at all. |
| - if !bounded { |
| - since = time.Time{} |
| - } |
| - w, ok := windowReading(box.times, u, since, until) |
| - if !ok || now.Sub(w.at) > metricsFreshWindow { |
| - delete(at, host) |
| - continue |
| - } |
| - row.ObservedAt, row.CPUFrac, row.MemBytes, row.SparkCPU, row.SparkMem = w.at, w.cpu, w.mem, w.sparkCPU, w.sparkMem |
| - } else if bounded && (len(box.times) == 0 || box.times[0].Before(since)) { |
| + if bounded && (len(box.times) == 0 || box.times[0].Before(since)) { |
| // Part of the window predates the owner: redraw from only |
| // their samples, or draw nothing when that cannot be done. |
| row.SparkCPU, row.SparkMem, _ = sparksSince(box.times, u, since) |
diff --git a/internal/console/remoteinstances.go b/internal/console/remoteinstances.go| index cf2491682..1b19718e6 100644 |
| --- a/internal/console/remoteinstances.go |
| +++ b/internal/console/remoteinstances.go |
| @@ -67,6 +67,105 @@ type boxReportCache struct { |
| loading chan struct{} |
| // now is the cache's clock; nil is time.Now. Tests set it. |
| now func() time.Time |
| + // slots holds the page views' reads of host incarnation slots, the |
| + // lifetime judge's second read (pageRecords), for boxReportTTL each and |
| + // only for the record version they were read beside: a record that |
| + // changes misses, and invalidate drops them all. Keyed by host. |
| + slots map[string]slotRead |
| +} |
| + |
| +// slotRead is one held slot read: the body and version, or absent, read |
| +// beside the record version recETag. |
| +type slotRead struct { |
| + recETag string |
| + raw []byte |
| + etag string |
| + absent bool |
| + at time.Time |
| +} |
| + |
| +// slotCacheMax bounds the held slot reads; past it, expired ones go. |
| +const slotCacheMax = 4096 |
| + |
| +func (c *boxReportCache) slot(host, recETag string) (slotRead, bool) { |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + r, ok := c.slots[host] |
| + if !ok || r.recETag != recETag || c.clock().Sub(r.at) >= boxReportTTL { |
| + return slotRead{}, false |
| + } |
| + return r, true |
| +} |
| + |
| +// holdSlot holds a slot read that began at generation gen, unless an |
| +// invalidation came since. |
| +func (c *boxReportCache) holdSlot(gen uint64, host string, r slotRead) { |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + if gen != c.gen { |
| + return |
| + } |
| + now := c.clock() |
| + if c.slots == nil { |
| + c.slots = map[string]slotRead{} |
| + } |
| + if len(c.slots) >= slotCacheMax { |
| + for h, old := range c.slots { |
| + if now.Sub(old.at) >= boxReportTTL { |
| + delete(c.slots, h) |
| + } |
| + } |
| + } |
| + r.at = now |
| + c.slots[host] = r |
| +} |
| + |
| +func (c *boxReportCache) generation() uint64 { |
| + c.mu.Lock() |
| + defer c.mu.Unlock() |
| + return c.gen |
| +} |
| + |
| +// slotHeldStore is the store one judged page read of host's record goes |
| +// through: the record GET passes through and its version is noted, and the |
| +// slot GET after it is served from the held read for that version when |
| +// there is one. Every other call passes through. |
| +type slotHeldStore struct { |
| + release.Store |
| + c *boxReportCache |
| + host string |
| + recKey, slotKey string |
| + recETag string |
| + recRead bool |
| +} |
| + |
| +func (h *slotHeldStore) Get(ctx context.Context, key string) ([]byte, string, error) { |
| + switch key { |
| + case h.recKey: |
| + raw, etag, err := h.Store.Get(ctx, key) |
| + h.recETag, h.recRead = etag, err == nil |
| + return raw, etag, err |
| + case h.slotKey: |
| + if !h.recRead { |
| + break |
| + } |
| + if r, ok := h.c.slot(h.host, h.recETag); ok { |
| + if r.absent { |
| + return nil, "", os.ErrNotExist |
| + } |
| + return r.raw, r.etag, nil |
| + } |
| + gen := h.c.generation() |
| + raw, etag, err := h.Store.Get(ctx, key) |
| + switch { |
| + case err == nil: |
| + h.c.holdSlot(gen, h.host, slotRead{recETag: h.recETag, raw: raw, etag: etag}) |
| + case errors.Is(err, os.ErrNotExist): |
| + h.c.holdSlot(gen, h.host, slotRead{recETag: h.recETag, absent: true}) |
| + } |
| + return raw, etag, err |
| + } |
| + return h.Store.Get(ctx, key) |
| } |
| func (c *boxReportCache) clock() time.Time { |
| @@ -83,6 +182,7 @@ func (c *boxReportCache) invalidate() { |
| c.mu.Lock() |
| defer c.mu.Unlock() |
| c.valid = false |
| + c.slots = nil |
| c.gen++ |
| } |
| @@ -328,14 +428,9 @@ type remoteRows struct { |
| // Asleep, Not responding or Serving. That includes static sites and |
| // instances that never sleep, which the rollout report does not cover. |
| // |
| -// metricsBox and until: readings join a remote row only from the box whose |
| -// report was accepted, and only up to that report's generation (a later |
| -// sample may be a successor tenant's). "" joins no readings at all. |
| -// |
| -// Unit and Caps are deliberately empty. Unit feeds the metrics allowlist |
| -// (appResourceMetrics), and the metrics boundary for a remote row is the |
| -// host's own carlos-exec@ and carlos-app@ units and nothing a record names. |
| -// Restartable is false: the browser restart door acts on the console box's |
| +// No metrics: a remote row takes no CPU or memory readings and no graphs |
| +// (appResourceMetrics skips it), since no sample on any box is proven to |
| +// be this owner's. Unit and Caps are deliberately empty. Restartable is false: the browser restart door acts on the console box's |
| // registry only. |
| func remoteRoute(rec provision.Record, rep *hostReport, f appFacts, acct string, dns DNSTargets) (RouteView, DomainView) { |
| kind := rec.Kind |
| @@ -354,8 +449,6 @@ func remoteRoute(rec provision.Record, rep *hostReport, f appFacts, acct string, |
| Environment: rec.Environment, |
| Provisioned: true, |
| remote: true, |
| - since: rec.CreatedAt, |
| - bounded: true, |
| } |
| typ := "custom" |
| if strings.HasPrefix(ch, "canary/") { |
| @@ -365,12 +458,10 @@ func remoteRoute(rec provision.Record, rep *hostReport, f appFacts, acct string, |
| switch { |
| case rep != nil: |
| rv.Status = "ready" |
| - rv.until = rep.at |
| rv.Version = rep.version |
| rv.box = rep.box |
| rv.dbBytes = rep.dbBytes |
| rv.aliases = rep.aliases |
| - rv.metricsBox = rep.box |
| switch { |
| case rep.down: |
| // Held down after a failed hold-mode build: the local rows' |
| @@ -408,9 +499,12 @@ func remoteRoute(rec provision.Record, rep *hostReport, f appFacts, acct string, |
| // for. With the record view armed and its latest snapshot Complete the |
| // reads are the snapshot's and make no request: the run and seed sweeps |
| // keep it within a pass of the bucket, and a page view does not refresh it. |
| -// Otherwise it is one LIST plus a GET per record not skipped. A record that |
| -// will not read is logged and left out; one deleted since the listing is |
| -// simply gone. |
| +// Otherwise it is one LIST plus a GET per record not skipped. With lifetimes |
| +// on, each record is judged against its host's incarnation slot, and that |
| +// slot read is held in the box-report cache for boxReportTTL beside the |
| +// record version it was read with (slotHeldStore), so a page view within |
| +// the minute adds no slot GETs. A record that will not read is logged and |
| +// left out; one deleted since the listing is simply gone. |
| func (s *Server) pageRecords(ctx context.Context, acct, app string, skip map[string]bool) ([]provision.Record, error) { |
| if s.cfg.Releases == nil { |
| return nil, nil |
| @@ -441,7 +535,9 @@ func (s *Server) pageRecords(ctx context.Context, acct, app string, skip map[str |
| sort.Strings(hosts) |
| recs := make([]provision.Record, 0, len(hosts)) |
| for _, host := range hosts { |
| - rec, _, err := provision.ReadRecordJudged(ctx, store, provision.JudgeFrom(ctx), acct, app, host) |
| + held := &slotHeldStore{Store: store, c: &s.boxReports, host: host, |
| + recKey: provision.RecordKey(acct, app, host), slotKey: provision.HostIncarnationKey(host)} |
| + rec, _, err := provision.ReadRecordJudged(ctx, held, provision.JudgeFrom(ctx), acct, app, host) |
| switch { |
| case errors.Is(err, os.ErrNotExist): |
| continue |
diff --git a/internal/console/remoteinstances_round1_test.go b/internal/console/remoteinstances_round1_test.go| index 64e63c909..039860939 100644 |
| --- a/internal/console/remoteinstances_round1_test.go |
| +++ b/internal/console/remoteinstances_round1_test.go |
| @@ -65,20 +65,6 @@ func TestRemoteMetricsRefuseRejectedReport(t *testing.T) { |
| } |
| } |
| -// P1: the accepted report is box B's; a fresher sample of the same unit on |
| -// another box is not this row's to show. |
| -func TestRemoteMetricsOnlyFromAcceptedBox(t *testing.T) { |
| - tb := newTwoBoxes(t) |
| - tb.setUp(t, false) |
| - sweepAt(t, tb.fx.rel, status.Label("box-c"), time.Now().Add(2*time.Second), map[string]metrics.UnitSample{ |
| - "carlos-exec@" + remoteHost: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)}, |
| - }) |
| - ov := tb.page(t, "/apps/shop") |
| - if strings.Contains(ov, "66%") || strings.Contains(ov, "7.0 MB") || !strings.Contains(ov, "27%") { |
| - t.Fatalf("overview metrics are not the accepted box's:\n%s", ov) |
| - } |
| -} |
| - |
| // P2: with an incomplete read of the box reports, a remote instance's state |
| // is unknown, and every page says so rather than guessing Asleep. |
| func TestRemoteUnknownStateRendersUnknown(t *testing.T) { |
diff --git a/internal/console/remoteinstances_round2_test.go b/internal/console/remoteinstances_round2_test.go| index 7391a3fbd..ae36f2a9c 100644 |
| --- a/internal/console/remoteinstances_round2_test.go |
| +++ b/internal/console/remoteinstances_round2_test.go |
| @@ -42,32 +42,6 @@ func points(spark string) int { |
| return len(strings.Fields(spark)) |
| } |
| -// P1: the hostname had a previous tenant on the same box. Its samples from |
| -// before this account's record existed must not be in this account's |
| -// graphs: only the current sample, scaled to its own peak. |
| -func TestRemoteMetricsHistoryBoundedByRecord(t *testing.T) { |
| - tb := newTwoBoxes(t) |
| - tb.setUp(t, false) |
| - label := status.Label("box-b") |
| - twoSamples(t, tb.fx.rel, label, "carlos-exec@"+remoteHost, time.Now().Add(-3*time.Hour), time.Now()) |
| - report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), nil, 4096) // vouches for the owner after the sample |
| - tb.fx.srv.boxReports.expire() |
| - views, err := tb.fx.srv.assembleApps(context.Background(), tb.sqid, []string{"shop"}) |
| - if err != nil { |
| - t.Fatal(err) |
| - } |
| - am := tb.fx.srv.appResourceMetrics(context.Background(), &views[0], tb.account(t)) |
| - if len(am) != 1 || !am[0].Reporting() { |
| - t.Fatalf("metrics = %+v", am) |
| - } |
| - if n := points(am[0].SparkCPU); n != 1 || strings.Contains(am[0].SparkCPU, ",4.00") { |
| - t.Fatalf("CPU graph carries samples from before the record (%d points): %q", n, am[0].SparkCPU) |
| - } |
| - if n := points(am[0].SparkMem); n != 1 || !strings.HasSuffix(am[0].SparkMem, ",0.00") { |
| - t.Fatalf("memory graph carries samples or a peak from before the record (%d points): %q", n, am[0].SparkMem) |
| - } |
| -} |
| - |
| // P1, the same leak on the console's own box: an instance created now |
| // whose hostname another tenant's unit used earlier in the window. Its |
| // record's created_at bounds the local row's history too. (A hand route |
| @@ -101,7 +75,7 @@ func TestOwnerMetricsSinceRules(t *testing.T) { |
| twoSamples(t, fx.rel, "box-x", "carlos-exec@"+host, time.Now().Add(-3*time.Hour), time.Now().Add(-90*time.Second)) |
| for name, since := range map[string]time.Time{"unknown start": {}, "start after the newest sample": time.Now().Add(-time.Minute)} { |
| fx.srv.metricsCache = metricsCache{} |
| - am, err := fx.srv.ownerAppMetricsFrom(context.Background(), []string{host}, nil, nil, map[string]time.Time{host: since}, nil) |
| + am, err := fx.srv.ownerAppMetricsFrom(context.Background(), []string{host}, nil, map[string]time.Time{host: since}) |
| if err != nil { |
| t.Fatal(err) |
| } |
| @@ -189,19 +163,6 @@ func TestRemoteUnknownStaticIsNotServed(t *testing.T) { |
| } |
| } |
| -// P1: a remote row with no ownership start (a record without created_at) |
| -// joins no readings, even from its accepted box. |
| -func TestRemoteRowWithoutStartHasNoReadings(t *testing.T) { |
| - fx := newConsoleFixture(t) |
| - const host = "nostart.example.com" |
| - sweepAt(t, fx.rel, "box-x", time.Now(), map[string]metrics.UnitSample{"carlos-exec@" + host: {CPUFrac: p(0.5), MemBytes: pi64(1 << 20)}}) |
| - view := &AppView{Routes: []RouteView{{Host: host, Kind: "instance", Account: fx.sqid, Provisioned: true, remote: true, metricsBox: "box-x"}}} |
| - am := fx.srv.appResourceMetrics(context.Background(), view, &Account{ID: OpsAccountID, Sqid: fx.sqid}) |
| - if len(am) != 1 || am[0].Reporting() { |
| - t.Fatalf("metrics for a remote row with no start = %+v, want none", am) |
| - } |
| -} |
| - |
| // P1, `carlos instances list`: the box's newest sample of the hostname is |
| // from before this account's record existed (a previous tenant's process). |
| // It must not make this record Running. |
diff --git a/internal/console/remoteinstances_round4_test.go b/internal/console/remoteinstances_round4_test.go| index 053e5c892..c0470a852 100644 |
| --- a/internal/console/remoteinstances_round4_test.go |
| +++ b/internal/console/remoteinstances_round4_test.go |
| @@ -56,45 +56,6 @@ func TestRemoteResidentInstanceIsUnknown(t *testing.T) { |
| } |
| } |
| -// P1 #1: the hostname passes to a successor tenant on the same box while |
| -// this account's ownership is still what the console holds (a stale record |
| -// snapshot, a cached report naming this account). The successor's samples, |
| -// newer than the report that vouched for this account, never join. |
| -func TestRemoteSuccessorSamplesNeverJoin(t *testing.T) { |
| - tb := newTwoBoxes(t) |
| - tb.create(t, tb.token, tb.sqid, "shop", remoteHost, "uk", "") |
| - tb.reconcile(t, "v3") |
| - time.Sleep(2100 * time.Millisecond) // created_at is whole seconds |
| - mine := time.Now().Add(-time.Second) |
| - unit := "carlos-exec@" + remoteHost |
| - chunk := func(samples ...metrics.Sample) { |
| - t.Helper() |
| - if err := metrics.WriteRaw(context.Background(), tb.fx.rel, metrics.RawChunk{V: 1, Box: status.Label("box-b"), |
| - Hour: metrics.HourOf(samples[0].At.UTC()), Samples: samples}); err != nil { |
| - t.Fatal(err) |
| - } |
| - } |
| - ownSample := metrics.Sample{At: mine.UTC(), Units: map[string]metrics.UnitSample{unit: {CPUFrac: p(0.27), MemBytes: pi64(3 << 20)}}} |
| - chunk(ownSample) |
| - report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), nil, 4096) // vouches for this account now |
| - time.Sleep(1100 * time.Millisecond) |
| - // The successor's process, after the report: same unit name, same box. |
| - successor := metrics.Sample{At: time.Now().UTC(), Units: map[string]metrics.UnitSample{unit: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)}}} |
| - if metrics.HourOf(successor.At) != metrics.HourOf(ownSample.At) { |
| - t.Skip("the two samples straddle an hour boundary") |
| - } |
| - chunk(ownSample, successor) |
| - for _, path := range []string{"/apps/shop", "/apps/shop/instances", "/apps/shop/instances/" + remoteHost} { |
| - body := tb.page(t, path) |
| - if strings.Contains(body, "66%") || strings.Contains(body, "7.0 MB") { |
| - t.Fatalf("%s shows a sample newer than the report vouching for this account:\n%s", path, body) |
| - } |
| - } |
| - if ov := tb.page(t, "/apps/shop"); !strings.Contains(ov, "27%") { |
| - t.Fatalf("overview lost the sample the report does vouch for:\n%s", ov) |
| - } |
| -} |
| - |
| // P1 #1: a console deletion invalidates the ownership the pages hold. With |
| // the record view armed and its snapshot still holding the record, the |
| // deleted instance's row is gone from the next page view. |
diff --git a/internal/console/remoteinstances_round6_test.go b/internal/console/remoteinstances_round6_test.go| new file mode 100644 |
| index 000000000..ab612b988 |
| --- /dev/null |
| +++ b/internal/console/remoteinstances_round6_test.go |
| @@ -0,0 +1,115 @@ |
| +package console |
| + |
| +import ( |
| + "context" |
| + "net/http" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "github.com/carlosframework/platform/internal/metrics" |
| + "github.com/carlosframework/platform/internal/provision" |
| + "github.com/carlosframework/platform/internal/status" |
| +) |
| + |
| +// Astra round 6, P1 #1: remote rows take no metrics. Every box that could |
| +// hold a sample of the remote host's unit has a fresh one (its own box, the |
| +// console's box, a third box), and its own box's rollout says it is asleep. |
| +// No remote row on any page, nor `carlos instances list`, may carry a |
| +// reading, a graph or a Running word drawn from a sample. The local row on |
| +// the console's box keeps its readings. |
| +func TestRemoteRowsNeverCarrySamples(t *testing.T) { |
| + tb := newTwoBoxes(t) |
| + tb.setUp(t, true) |
| + unit := "carlos-exec@" + remoteHost |
| + for _, box := range []string{status.Label("box-b"), "box-console", status.Label("box-c")} { |
| + sweep(t, tb.fx.rel, box, map[string]metrics.UnitSample{ |
| + unit: {CPUFrac: p(0.66), MemBytes: pi64(7 << 20)}, |
| + "carlos-exec@" + localHost: {CPUFrac: p(0.12), MemBytes: pi64(5 << 20)}, |
| + }) |
| + } |
| + report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), nil, 4096) // asleep |
| + tb.fx.srv.boxReports.expire() |
| + tb.fx.srv.metricsCache = metricsCache{} |
| + |
| + views, err := tb.fx.srv.assembleApps(context.Background(), tb.sqid, []string{"shop"}) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + remote := map[string]bool{} |
| + for _, rt := range views[0].Routes { |
| + if rt.remote { |
| + remote[rt.Host] = true |
| + } |
| + } |
| + if !remote[remoteHost] || remote[localHost] { |
| + t.Fatalf("fixture: remote rows = %v", remote) |
| + } |
| + local := false |
| + for _, m := range tb.fx.srv.appResourceMetrics(context.Background(), &views[0], tb.account(t)) { |
| + if remote[m.Host] { |
| + t.Fatalf("a remote row carries a metrics row: %+v", m) |
| + } |
| + if m.Host == localHost && m.Reporting() && m.CPUFrac != nil { |
| + local = true |
| + } |
| + } |
| + if !local { |
| + t.Fatal("the local row lost its readings") |
| + } |
| + |
| + for _, path := range []string{"/apps/shop", "/apps/shop/instances", "/apps/shop/instances/" + remoteHost} { |
| + body := tb.page(t, path) |
| + for _, bad := range []string{"66%", "7.0 MB", "27%", "3.0 MB"} { |
| + if strings.Contains(body, bad) { |
| + t.Fatalf("%s shows a remote reading %q:\n%s", path, bad, body) |
| + } |
| + } |
| + } |
| + if row := instanceRow(t, tb.page(t, "/apps/shop/instances"), remoteHost); strings.Contains(row, "Running") || strings.Contains(row, "<polyline") { |
| + t.Fatalf("a sample made the remote row Running or drew its graph: %s", row) |
| + } |
| + if ov := tb.page(t, "/apps/shop"); !strings.Contains(ov, "12%") { |
| + t.Fatalf("overview lost the local row's reading:\n%s", ov) |
| + } |
| + // Two records, and only the local one is Running from its sample. |
| + if code, _, out := rawReq(t, http.MethodGet, instancesURL(tb.fx, tb.sqid, "shop"), tb.token, ""); code != http.StatusOK || |
| + strings.Count(out, `"health":"Running"`) != 1 { |
| + t.Fatalf("instances list = %d %s", code, out) |
| + } |
| +} |
| + |
| +// Astra round 6, P2 #3: a page view's slot read is held only beside the |
| +// record version it was read with. Here the host's lifetime ends and its |
| +// record is rewritten within the minute: the next page view reads the slot |
| +// afresh and drops the row, rather than judging the new record by the held |
| +// slot. |
| +func TestHeldSlotReadFollowsTheRecordVersion(t *testing.T) { |
| + ltClock := useLifetimesClock(t) |
| + tb := newTwoBoxes(t) |
| + turnLifetimesOn(t, tb.fx.srv, ltClock) |
| + tb.setUp(t, false) |
| + if run := tb.page(t, "/apps/shop/instances"); !strings.Contains(run, remoteHost) { |
| + t.Fatalf("fixture: the remote row is missing:\n%s", run) |
| + } |
| + ctx := context.Background() |
| + slot, slotETag, err := provision.ReadHostIncarnation(ctx, tb.fx.rel, remoteHost) |
| + if err != nil || slot == nil { |
| + t.Fatalf("fixture: slot %+v %v", slot, err) |
| + } |
| + slot.State = provision.SlotRetired |
| + if _, err := provision.WriteHostIncarnation(ctx, tb.fx.rel, remoteHost, *slot, slotETag); err != nil { |
| + t.Fatal(err) |
| + } |
| + key := provision.RecordKey(tb.sqid, "shop", remoteHost) |
| + raw, etag, err := tb.fx.rel.Get(ctx, key) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + if _, err := tb.fx.rel.Put(ctx, key, append(raw, '\n'), etag); err != nil { |
| + t.Fatal(err) |
| + } |
| + if run := tb.page(t, "/apps/shop/instances"); strings.Contains(run, remoteHost) { |
| + t.Fatalf("a rewritten record was judged by the slot read held for its old version:\n%s", run) |
| + } |
| +} |
diff --git a/internal/console/remoteinstances_test.go b/internal/console/remoteinstances_test.go| index 6208dc964..9e6ee7c4a 100644 |
| --- a/internal/console/remoteinstances_test.go |
| +++ b/internal/console/remoteinstances_test.go |
| @@ -226,13 +226,14 @@ func (tb *twoBoxes) setUp(t *testing.T, local bool) { |
| if err != nil { |
| t.Fatal(err) |
| } |
| - // The sample first, then the reports, as on a box: a remote row's |
| - // readings are bounded by when its box's report vouched for its owner. |
| + // B samples the host's unit, and its rollout says the process is |
| + // awake. A remote row takes no readings: the sample is there only so |
| + // the pages can be shown never to carry it. |
| sweep(t, tb.fx.rel, status.Label("box-b"), map[string]metrics.UnitSample{ |
| "carlos-exec@" + remoteHost: {CPUFrac: p(0.27), MemBytes: pi64(3 << 20)}, |
| }) |
| report(t, tb.fx.rel, regA, "box-a", "ie", time.Now(), nil, 1024) |
| - report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), nil, 4096) |
| + report(t, tb.fx.rel, tb.regB, "box-b", "uk", time.Now(), map[string]bool{remoteHost: true}, 4096) |
| } |
| // TestRemoteInstanceMintsOnlyOnItsBox pins the fixture itself: the record |
| @@ -260,21 +261,26 @@ func TestRemoteInstancePages(t *testing.T) { |
| t.Fatalf("account home does not show the remote instance as deployed:\n%s", home) |
| } |
| - // Overview: one instance, B's version, B's CPU and memory, B's database |
| - // size, not the empty state. |
| + // Overview: one instance, B's version and database size, not the empty |
| + // state, and none of B's CPU or memory readings. |
| ov := tb.page(t, "/apps/shop") |
| for _, bad := range []string{"No instances yet", "Not deployed yet", "nothing running yet"} { |
| if strings.Contains(ov, bad) { |
| t.Fatalf("overview still says %q:\n%s", bad, ov) |
| } |
| } |
| - for _, want := range []string{"27%", "3.0 MB", "4.0 KB", "DNS & certs OK"} { |
| + for _, want := range []string{"4.0 KB", "DNS & certs OK"} { |
| if !strings.Contains(ov, want) { |
| t.Fatalf("overview is missing %q:\n%s", want, ov) |
| } |
| } |
| + for _, bad := range []string{"27%", "3.0 MB"} { |
| + if strings.Contains(ov, bad) { |
| + t.Fatalf("overview shows a remote reading %q:\n%s", bad, ov) |
| + } |
| + } |
| - // Running: the row, Running from B's sweep, no restart button. |
| + // Running: the row, Running from B's rollout report, no restart button. |
| run := tb.page(t, "/apps/shop/instances") |
| row := instanceRow(t, run, remoteHost) |
| if !strings.Contains(row, "Running") || !strings.Contains(row, "v3") { |
| @@ -634,12 +640,12 @@ func (s remoteFailingRecordStore) List(ctx context.Context, prefix string) ([]st |
| return s.Store.List(ctx, prefix) |
| } |
| -// budgetStore counts the reads the request budget is about: box reports |
| -// and instance records. |
| +// budgetStore counts the reads the request budget is about: box reports, |
| +// instance records and host incarnation slots. |
| type budgetStore struct { |
| release.Store |
| - mu sync.Mutex |
| - boxLists, boxGets, recLists, recGets int |
| + mu sync.Mutex |
| + boxLists, boxGets, recLists, recGets, slotGets int |
| } |
| func (c *budgetStore) note(key string, list bool) { |
| @@ -654,6 +660,8 @@ func (c *budgetStore) note(key string, list bool) { |
| c.recLists++ |
| case strings.HasPrefix(key, "apps/") && strings.Contains(key, "/instances/"): |
| c.recGets++ |
| + case strings.HasPrefix(key, "control/host-incarnations/") && !list: |
| + c.slotGets++ |
| } |
| } |
| @@ -667,27 +675,34 @@ func (c *budgetStore) Get(ctx context.Context, key string) ([]byte, string, erro |
| return c.Store.Get(ctx, key) |
| } |
| -func (c *budgetStore) counts() [4]int { |
| +func (c *budgetStore) counts() [5]int { |
| c.mu.Lock() |
| defer c.mu.Unlock() |
| - return [4]int{c.boxLists, c.boxGets, c.recLists, c.recGets} |
| + return [5]int{c.boxLists, c.boxGets, c.recLists, c.recGets, c.slotGets} |
| } |
| func (c *budgetStore) reset() { |
| c.mu.Lock() |
| defer c.mu.Unlock() |
| - c.boxLists, c.boxGets, c.recLists, c.recGets = 0, 0, 0, 0 |
| + c.boxLists, c.boxGets, c.recLists, c.recGets, c.slotGets = 0, 0, 0, 0, 0 |
| } |
| -// TestRemoteInstanceRequestBudget counts store calls per page view. Armed |
| -// record view: the first Overview view reads the box reports once (one LIST |
| -// and one GET per box) and no record; a second view within a minute reads |
| -// nothing; after the minute it reads the reports once more. Every app tab |
| -// shares the one read. Unarmed: the records cost one LIST plus one GET per |
| -// record, the read the Logs tab always made. |
| +// TestRemoteInstanceRequestBudget counts store calls per page view, with |
| +// lifetimes on, so every record read is judged against its host's slot. |
| +// Armed record view: the first Overview view reads the box reports once |
| +// (one LIST and one GET per box), no record, and the remote record's slot |
| +// once; a second view within a minute reads nothing; after the minute it |
| +// reads the reports and the slot once more. Every app tab shares the one |
| +// read. Unarmed: the records cost one LIST plus one GET per record, the |
| +// read the Logs tab always made, and the slot read is still held. |
| func TestRemoteInstanceRequestBudget(t *testing.T) { |
| + ltClock := useLifetimesClock(t) |
| tb := newTwoBoxes(t) |
| + turnLifetimesOn(t, tb.fx.srv, ltClock) |
| tb.setUp(t, false) |
| + if slot, _, err := provision.ReadHostIncarnation(context.Background(), tb.fx.rel, remoteHost); err != nil || slot == nil { |
| + t.Fatalf("fixture: the remote instance has no lifetime slot: %+v %v", slot, err) |
| + } |
| cs := &budgetStore{Store: tb.fx.rel} |
| tb.fx.srv.cfg.Releases = cs |
| v := provision.NewRecordView(cs, release.NewChangeWatch(cs)) |
| @@ -707,8 +722,8 @@ func TestRemoteInstanceRequestBudget(t *testing.T) { |
| cs.reset() |
| tb.page(t, "/apps/shop") |
| - if got := cs.counts(); got != [4]int{1, 2, 0, 0} { |
| - t.Fatalf("first armed overview: box LIST/GET, record LIST/GET = %v, want [1 2 0 0]", got) |
| + if got := cs.counts(); got != [5]int{1, 2, 0, 0, 1} { |
| + t.Fatalf("first armed overview: box LIST/GET, record LIST/GET, slot GET = %v, want [1 2 0 0 1]", got) |
| } |
| cs.reset() |
| // The pages whose only box-report read is this change's. (The Running |
| @@ -718,30 +733,30 @@ func TestRemoteInstanceRequestBudget(t *testing.T) { |
| for _, path := range []string{"/apps/shop", "/apps/shop/deployments", "/"} { |
| tb.page(t, path) |
| } |
| - if got := cs.counts(); got != [4]int{0, 0, 0, 0} { |
| - t.Fatalf("views within the minute = %v, want no box or record reads", got) |
| + if got := cs.counts(); got != [5]int{0, 0, 0, 0, 0} { |
| + t.Fatalf("views within the minute = %v, want no box, record or slot reads", got) |
| } |
| // The Running tab's region note reads the reports itself, through |
| // liveEdges (appDefault), and did before this change. One read is that |
| // note's; a second would be this change failing to share the cache. |
| cs.reset() |
| tb.page(t, "/apps/shop/instances") |
| - if got := cs.counts(); got != [4]int{1, 2, 0, 0} { |
| - t.Fatalf("Running tab within the minute = %v, want only the region note's own [1 2 0 0]", got) |
| + if got := cs.counts(); got != [5]int{1, 2, 0, 0, 0} { |
| + t.Fatalf("Running tab within the minute = %v, want only the region note's own [1 2 0 0 0]", got) |
| } |
| clock = clock.Add(boxReportTTL + time.Second) |
| cs.reset() |
| tb.page(t, "/apps/shop") |
| - if got := cs.counts(); got != [4]int{1, 2, 0, 0} { |
| - t.Fatalf("overview after the minute = %v, want [1 2 0 0]", got) |
| + if got := cs.counts(); got != [5]int{1, 2, 0, 0, 1} { |
| + t.Fatalf("overview after the minute = %v, want [1 2 0 0 1]", got) |
| } |
| // Unarmed: one LIST and one GET for the app's one record. |
| tb.fx.srv.SetRecordView(nil) |
| cs.reset() |
| tb.page(t, "/apps/shop") |
| - if got := cs.counts(); got != [4]int{0, 0, 1, 1} { |
| - t.Fatalf("unarmed overview within the minute = %v, want [0 0 1 1]", got) |
| + if got := cs.counts(); got != [5]int{0, 0, 1, 1, 0} { |
| + t.Fatalf("unarmed overview within the minute = %v, want [0 0 1 1 0]", got) |
| } |
| } |
diff --git a/internal/console/server.go b/internal/console/server.go| index cc57b4499..44797a150 100644 |
| --- a/internal/console/server.go |
| +++ b/internal/console/server.go |
| @@ -3600,39 +3600,32 @@ func (s *Server) appResourceMetrics(ctx context.Context, view *AppView, acct *Ac |
| hosts := make([]string, 0, len(view.Routes)) |
| hib := make(map[string]bool, len(view.Routes)) |
| unitByHost := make(map[string]string, len(view.Routes)) |
| - boxByHost := map[string]string{} |
| sinceByHost := map[string]time.Time{} |
| - untilByHost := map[string]time.Time{} |
| for _, rt := range view.Routes { |
| if rt.Account != acct.Sqid { |
| continue |
| } |
| + // An instance on another box takes no readings at all: its host |
| + // name alone is not this tenant's, since another box may serve it |
| + // for someone else, and no sample on any box is proven theirs. Its |
| + // row shows the no-data state (remoteinstances.go). |
| + if rt.remote { |
| + continue |
| + } |
| // History starts when this owner came to have the host: samples |
| // from a previous tenant of the same hostname are not theirs. A |
| - // remote row is always bounded (no start, no readings), and so is a |
| - // local row that is provisioned or has a record (RouteView.bounded); |
| - // only a hand route with no record is not. |
| - if rt.remote || rt.bounded { |
| + // local row that is provisioned or has a record is bounded |
| + // (RouteView.bounded); only a hand route with no record is not. |
| + if rt.bounded { |
| sinceByHost[rt.Host] = rt.since |
| } |
| - // An instance on another box joins readings only from the box whose |
| - // report was accepted for this account and app (remoteinstances.go), |
| - // and none at all without one: the host name alone is not this |
| - // tenant's, since another box may serve it for someone else. |
| - if rt.remote { |
| - if rt.metricsBox == "" { |
| - continue |
| - } |
| - boxByHost[rt.Host] = rt.metricsBox |
| - untilByHost[rt.Host] = rt.until |
| - } |
| hosts = append(hosts, rt.Host) |
| hib[rt.Host] = rt.Hibernate |
| if rt.Unit != "" { |
| unitByHost[rt.Host] = rt.Unit |
| } |
| } |
| - am, err := s.ownerAppMetricsFrom(ctx, hosts, unitByHost, boxByHost, sinceByHost, untilByHost) |
| + am, err := s.ownerAppMetricsFrom(ctx, hosts, unitByHost, sinceByHost) |
| if err != nil { |
| log.Printf("console: app metrics %s: %v", view.App, err) |
| return nil |
diff --git a/internal/console/view.go b/internal/console/view.go| index 94f4d8bc0..9947c2166 100644 |
| --- a/internal/console/view.go |
| +++ b/internal/console/view.go |
| @@ -376,31 +376,20 @@ type RouteView struct { |
| dbBytes *int64 |
| aliases []string |
| boxAwake bool |
| - // metricsBox is the one box whose metrics samples may join a remote |
| - // row: the box whose accepted report names this account and app. "" |
| - // joins none. unknown says the row's process state is not known |
| - // (remoteRoute): its health reads "Can't tell right now". |
| - metricsBox string |
| - unknown bool |
| - // since is when this row's owner came to have the host: its instance |
| - // record's created_at (addRemoteRows sets it on local rows that have a |
| - // record too). Metrics samples before it are not this owner's |
| - // (ownerAppMetricsFrom). Zero on a local row (a hand route with no |
| - // record) leaves the row unbounded, as before; on a remote row it means |
| - // no readings. |
| + // unknown says the row's process state is not known (remoteRoute): |
| + // its health reads "Can't tell right now". A remote row takes no |
| + // metrics readings at all (appResourceMetrics skips it). |
| + unknown bool |
| + // since is when this local row's owner came to have the host: its |
| + // instance record's created_at (addRemoteRows). Metrics samples before |
| + // it are not this owner's (ownerAppMetricsFrom). |
| since time.Time |
| - // bounded says since applies to this row's readings, zero meaning no |
| - // readings at all: every remote row, and every local row that is |
| - // provisioned or has a record. A provisioned local row whose record |
| - // could not be read has an unknown start, so it shows nothing rather |
| - // than the whole window. Only a hand route with no record is unbounded. |
| + // bounded says since applies to this local row's readings, zero |
| + // meaning no readings at all: every local row that is provisioned or |
| + // has a record. A provisioned local row whose record could not be read |
| + // has an unknown start, so it shows nothing rather than the whole |
| + // window. Only a hand route with no record is unbounded. |
| bounded bool |
| - // until is when the box report this remote row joined observed the |
| - // host as this account's: samples after it are not proven to be this |
| - // owner's (the hostname may have changed hands since), so they do not |
| - // join. Zero on a local row (no upper bound) and on a remote row with |
| - // no accepted report (no readings at all). |
| - until time.Time |
| } |
| // humanizeCaps renders a registry.Route.Caps column for a person: the |
diff --git a/internal/provision/console_remote_instances_census_test.go b/internal/provision/console_remote_instances_census_test.go| index d668ac1c3..da7540e7b 100644 |
| --- a/internal/provision/console_remote_instances_census_test.go |
| +++ b/internal/provision/console_remote_instances_census_test.go |
| @@ -45,6 +45,10 @@ package provision |
| // each record not already a local row with GetRecord, through the |
| // record view's snapshot when armed; it writes nothing: key-site, like |
| // Server.appInstanceCount. |
| +// - Round 6 review: Server.pageRecords names RecordKey and the host's |
| +// incarnation slot key only so the judged read's record GET and slot GET |
| +// can be told apart (slotHeldStore): the slot read is held for a minute |
| +// beside the record version it was read with. Reads only: key-site. |
| func consoleRemoteInstancesWriteCensusInventory() []censusEntry { |
| entries := append([]censusEntry(nil), claimsCleanupR2WriteCensusInventory()...) |
| replacements := []censusEntry{ |
| @@ -55,7 +59,7 @@ func consoleRemoteInstancesWriteCensusInventory() []censusEntry { |
| {"internal/console/lifetimes_create.go", "Server.allocCleanLocked", "key-site", "key:RecordKey", "a6f1a6c5f15fec828ab9ff64ca153d6a6b032716d628924caa925640a44f7856"}, |
| {"internal/console/claim_retire.go", "Server.retireClaimHostRecord", "key-site", "key:claimRetireRecordKey", "3c30cfcad8f2edb3c38b7dd9e56697cd3e17ce3a7fa0e76eb815adf3dad7bd4d"}, |
| {"internal/console/remoteinstances.go", "Server.retireUnsettled", "key-site", "key:RecordsPrefix,key:SidecarsPrefix", "c1c706feafbb7769a6b3d04e2010cd330d6196a08a4f0068dfd8c530cce8541b"}, |
| - {"internal/console/remoteinstances.go", "Server.pageRecords", "key-site", "key:RecordsPrefix", "d2b3108fee1429c9638a41628da10abfd9a603824e9ca08bcfc73831d2940ef8"}, |
| + {"internal/console/remoteinstances.go", "Server.pageRecords", "key-site", "key:RecordKey,key:RecordsPrefix", "0ad9a2788c0c9b196c9a28c22d953192f6eec7c18d6eb1b9963c1897dd4083c1"}, |
| {"internal/console/remoteinstances.go", "Server.recordStamps", "key-site", "key:RecordsPrefix,key:SidecarsPrefix", "c38f120e5be0e8c883b6da7d86df23a5b6b495a31732732e6cbe6efe5821ff43"}, |
| } |
| for _, r := range replacements { |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index b1b1ec24d..df49b3cbb 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -45,4 +45,4 @@ plan14-root-reads-edge-protection-2.tsv a864cf31b6bf2c30b5aa8c2647835efdc456f34f |
| plan14-root-reads-offline-move-trim-t1.tsv a864cf31b6bf2c30b5aa8c2647835efdc456f34f4945eea12751daab2457728e |
| plan14-root-reads-claims-cleanup-r1.tsv 9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924 |
| plan14-root-reads-claims-cleanup-r2.tsv 9cef5e93a1e3520e02efe66455bf70c1170d380b6d6a72ede02036ce3dd41924 |
| -plan14-root-reads-console-remote-instances.tsv c4b872b770e88ffa7ffc349490e05d7ae84257bb1bee5b8c8c92444e319fb222 |
| +plan14-root-reads-console-remote-instances.tsv dca65b72ab685c21c4029fdf101792d155da7109698390f34c80b658447230fd |
diff --git a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv| index b62e675ff..2db846024 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-console-remote-instances.tsv |
| @@ -1,25 +1,25 @@ |
| # Census overlay console-remote-instances, written by census-propose (#369). census-ruling-console-remote-instances, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-console-remote-instances.md. |
| # 9 body, 2 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| @legacy d0a3ae6c1eb6795c3810264874e4f1363432cbdd3aae6398e30422c7169a3726 internal/console/accountfleet.go Server.assembleAccountFleet legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. registry:Account@2350,registry:Account@4421,registry:App@2476,registry:Name@4814,registry:Region@2437,whole:Fleet@4006,whole:Fleet@4408,whole:Fleet@4522,whole:Route@2335 1b5ecf4066d067d721683d273e768d834df0bb9cb3cf5ff90648b1e6842bacc8 |
| -@legacy 5d23e3044287253a4ff2e8ef1bd1ea50e2f4682485ba794d7c9d5635c8a24584 internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes an awake set, a box pin per host and an ownership window per host (since, until) from the caller: readings only from that box and only from samples inside the window, via ownerAppMetricsFrom; registry reads unchanged. registry:Backing@1279,registry:Hibernate@1201,registry:Kind@1184,registry:Provisioned@1254,registry:Status@1061,registry:Unit@1270,registry:Unit@394,registry:Unit@429,whole:Route@1038,whole:Route@242,whole:Route@285,whole:Route@351 6d4e71f0460632bec27b64b948c6bea4fdf48c2ff5c15c252614a46643b81924 |
| -@legacy 6aca486aeff4e98674d40cac55e1ed92f45045a178c212f3ed3be6e106ad8bde internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil for healthByHost's new awake, box-pin and ownership-window arguments; nothing else. registry:Account@4619,registry:App@1646,registry:App@2119,registry:App@4558,registry:Backing@2279,registry:Canary@2417,registry:Channel@2139,registry:Environment@2164,registry:Hibernate@2238,registry:Host@1730,registry:Host@2061,registry:Host@2217,registry:Host@2373,registry:Host@4691,registry:Host@4771,registry:Kind@2076,registry:Platform@2402,registry:Prefix@4787,registry:Provisioned@2304,registry:Replication@2336,registry:Status@2188,registry:Target@4805,registry:Unit@2258,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1978,whole:Route@2009,whole:Route@2109,whole:Route@4682,whole:RoutePath@3624 b4c691f072d0c7d829aba6a5302cf95fe36abf2596d5060064493b49af80c35f |
| +@legacy 0d769027303bdf8db21b4e9940052ad823cd3837eb68adc179b8077b44f84307 internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes only the caller's ownership start per host (sinceByHost): readings only from samples at or after it, via ownerAppMetricsFrom. The awake set, the box pin and the until window are gone. Registry reads unchanged. registry:Backing@1178,registry:Hibernate@1112,registry:Kind@1095,registry:Provisioned@1153,registry:Status@972,registry:Unit@1169,registry:Unit@329,registry:Unit@364,whole:Route@177,whole:Route@220,whole:Route@286,whole:Route@949 cc4a0de52038d250031e4739b943a36f799e4cf7ae87a2b64312280861ba6a6e |
| +@legacy ee3d05d9ac77fa0c464c826b7fbd058ed8bf68bd45b211e7ad5ad1848d8ad862 internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil for healthByHost's ownership-start argument; nothing else. registry:Account@4604,registry:App@1646,registry:App@2104,registry:App@4543,registry:Backing@2264,registry:Canary@2402,registry:Channel@2124,registry:Environment@2149,registry:Hibernate@2223,registry:Host@1730,registry:Host@2046,registry:Host@2202,registry:Host@2358,registry:Host@4676,registry:Host@4756,registry:Kind@2061,registry:Platform@2387,registry:Prefix@4772,registry:Provisioned@2289,registry:Replication@2321,registry:Status@2173,registry:Target@4790,registry:Unit@2243,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1963,whole:Route@1994,whole:Route@2094,whole:Route@4667,whole:RoutePath@3609 2fc5fde5477d298cc925ecf9d3b0fbb4cda8095bd7e22df76c2e114e716b5dea |
| @legacy e096052196bcd47b52cd721741d73c701d59e2f0d6a0a0a0cf9c4b33a1636bf1 internal/console/claim_retire.go Server.retireClaimHostRecord legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Notes the app in the console's in-memory deletion log (noteRecordDeletion, which also invalidates the pages' held box reports) before retiring a record, for the canary-retire guard; the retire itself is unchanged. file:Read@941 3c30cfcad8f2edb3c38b7dd9e56697cd3e17ce3a7fa0e76eb815adf3dad7bd4d |
| @legacy 2c4f2defe9c0c19d0f25974cf6ddf19e1fbdf2bf5f5658e4b50447c84d4e90ef internal/console/instancepage.go Server.handleAppInstance legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Instance page adds updates view from rollout join; browser rendering remains legacy.;rev3=census-ruling-console-remote-instances;basis=A remote row (no local registry row) runs none of the hostname-keyed box joins (layout, rollout, updates): it shows only what its row brought through remoteFacts, aliases included. Local rows read layout, rollout join and ListAliases as before. file:Query@2895,registry:Account@2667,registry:Alias@2767,registry:App@2697,registry:Host@2645,whole:RouteAlias@2628 5208ae08d92c1022d7849e4ad50578460bb01b521983e09ee2f39af528a1dc55 |
| @legacy aa852aec334f46af0b4bb16f7f81afa3d4690f0f12c6c80b2ab5cff4837367aa internal/console/metricsview.go buildUnitRows legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Each unit row also keeps its raw per-sample readings (float32 CPU, int64 memory) so an owner's graph can be redrawn from only their samples; reads nothing new. file:ReadBytes@315,file:ReadBytes@327 e7f942ea8d32626b6ead3313deec26c458a7d7c296e7120c7384dfc5f416c378 |
| @legacy b58f31b085d67e08a0f81ba95dd47114f9849e6986cb92a0a89a4234064ff4dc internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict under the lifetime judge, listRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 05c81080b1bd975c844e031830246881397e2b1864e1dc4a27bd425c77535d99 |
| @legacy 9c63018a0c60a52c55b2ef0159bc58cbf0f191e0166a53adf58feff954c6935e internal/console/templates/app_overview.html external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only. file:external@0 2a112ff768c300894881b858e61465841c87810ca7cb1d98a0fe2a54155a0ca1 |
| -@legacy 80631d7995159901c7272e19e73a447d95cce7fc671ec0056f28572057b55071 internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from remoteFacts: a box report whose rollout entry names the record's own account and app, generated after the record was created (held down: Failed; transient, unidentified or unread: Can't tell right now), readings pinned to that box and bounded by the record's created_at and the report's generation. Builds registry.Route literals from the record; reads no registry for them. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2887,whole:Route@3596,whole:Route@4110,whole:Route@4163,whole:Route@4278,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 c6e49aec6194fbb4ce76a51610708b4d9a4de82f2a8ae6a52f4ae25a1a06135b |
| +@legacy 6a237934bdb53b917a4638b5661576e8efb1745631770a94fad3cfede96be2ce internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from remoteFacts (a box report whose rollout entry names the record's own account and app, generated after the record was created): awake is Running, held down is Failed, transient or unidentified is Can't tell right now. No metrics readings at all and no registry.Route literal for them. Local records unchanged. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2861,whole:Route@3852,whole:Route@3905,whole:Route@4020,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 3a82f379bbfbf600c1dae99bb28efc08cb6c431d7664f9eaa69f4e51dbf80fe7 |
| @legacy 985c17c7d12aab5b0e7faa1861e93fc51e946406f767e9f2fc33a89f4a74f16e internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row (its record's created_at bounds the local row's metrics history); adds rows from the account's records and remoteFacts when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada |
| internal/console/accountfleet.go Server.assembleAccountFleet legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Fleet tab: the shared-fleet app count also reads the account's own instance records (per app of the account, under its own prefix, region not a fleet placement); the registry read is unchanged. registry:Account@2350,registry:Account@4421,registry:App@2476,registry:Name@4814,registry:Region@2437,whole:Fleet@4006,whole:Fleet@4408,whole:Fleet@4522,whole:Route@2335 1b5ecf4066d067d721683d273e768d834df0bb9cb3cf5ff90648b1e6842bacc8 |
| -internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes an awake set, a box pin per host and an ownership window per host (since, until) from the caller: readings only from that box and only from samples inside the window, via ownerAppMetricsFrom; registry reads unchanged. registry:Backing@1279,registry:Hibernate@1201,registry:Kind@1184,registry:Provisioned@1254,registry:Status@1061,registry:Unit@1270,registry:Unit@394,registry:Unit@429,whole:Route@1038,whole:Route@242,whole:Route@285,whole:Route@351 6d4e71f0460632bec27b64b948c6bea4fdf48c2ff5c15c252614a46643b81924 |
| -internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil for healthByHost's new awake, box-pin and ownership-window arguments; nothing else. registry:Account@4619,registry:App@1646,registry:App@2119,registry:App@4558,registry:Backing@2279,registry:Canary@2417,registry:Channel@2139,registry:Environment@2164,registry:Hibernate@2238,registry:Host@1730,registry:Host@2061,registry:Host@2217,registry:Host@2373,registry:Host@4691,registry:Host@4771,registry:Kind@2076,registry:Platform@2402,registry:Prefix@4787,registry:Provisioned@2304,registry:Replication@2336,registry:Status@2188,registry:Target@4805,registry:Unit@2258,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1978,whole:Route@2009,whole:Route@2109,whole:Route@4682,whole:RoutePath@3624 b4c691f072d0c7d829aba6a5302cf95fe36abf2596d5060064493b49af80c35f |
| +internal/console/apiinstances.go Server.healthByHost legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Takes only the caller's ownership start per host (sinceByHost): readings only from samples at or after it, via ownerAppMetricsFrom. The awake set, the box pin and the until window are gone. Registry reads unchanged. registry:Backing@1178,registry:Hibernate@1112,registry:Kind@1095,registry:Provisioned@1153,registry:Status@972,registry:Unit@1169,registry:Unit@329,registry:Unit@364,whole:Route@177,whole:Route@220,whole:Route@286,whole:Route@949 cc4a0de52038d250031e4739b943a36f799e4cf7ae87a2b64312280861ba6a6e |
| +internal/console/apiroutes.go Server.handleAPIRoutes legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Passes nil for healthByHost's ownership-start argument; nothing else. registry:Account@4604,registry:App@1646,registry:App@2104,registry:App@4543,registry:Backing@2264,registry:Canary@2402,registry:Channel@2124,registry:Environment@2149,registry:Hibernate@2223,registry:Host@1730,registry:Host@2046,registry:Host@2202,registry:Host@2358,registry:Host@4676,registry:Host@4756,registry:Kind@2061,registry:Platform@2387,registry:Prefix@4772,registry:Provisioned@2289,registry:Replication@2321,registry:Status@2173,registry:Target@4790,registry:Unit@2243,whole:Route@1635,whole:Route@1684,whole:Route@1721,whole:Route@1741,whole:Route@1861,whole:Route@1963,whole:Route@1994,whole:Route@2094,whole:Route@4667,whole:RoutePath@3609 2fc5fde5477d298cc925ecf9d3b0fbb4cda8095bd7e22df76c2e114e716b5dea |
| internal/console/claim_retire.go Server.retireClaimHostRecord legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Notes the app in the console's in-memory deletion log (noteRecordDeletion, which also invalidates the pages' held box reports) before retiring a record, for the canary-retire guard; the retire itself is unchanged. file:Read@941 3c30cfcad8f2edb3c38b7dd9e56697cd3e17ce3a7fa0e76eb815adf3dad7bd4d |
| internal/console/instancepage.go Server.handleAppInstance legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Instance page adds updates view from rollout join; browser rendering remains legacy.;rev3=census-ruling-console-remote-instances;basis=A remote row (no local registry row) runs none of the hostname-keyed box joins (layout, rollout, updates): it shows only what its row brought through remoteFacts, aliases included. Local rows read layout, rollout join and ListAliases as before. file:Query@2895,registry:Account@2667,registry:Alias@2767,registry:App@2697,registry:Host@2645,whole:RouteAlias@2628 5208ae08d92c1022d7849e4ad50578460bb01b521983e09ee2f39af528a1dc55 |
| internal/console/metricsview.go buildUnitRows legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Each unit row also keeps its raw per-sample readings (float32 CPU, int64 memory) so an owner's graph can be redrawn from only their samples; reads nothing new. file:ReadBytes@315,file:ReadBytes@327 e7f942ea8d32626b6ead3313deec26c458a7d7c296e7120c7384dfc5f416c378 |
| internal/console/metricsview.go type UnitRow diagnostic H3 schema-only;rev3=census-ruling-console-remote-instances;basis=Two unexported fields carrying those raw per-sample readings; schema only. file:ReadBytes@133 db66030c5353fee88e0826786a424e0fee88d3191004deff380d00086bef5d62 |
| internal/console/server.go Server.channelHosts legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Canary-retire guard also counts the account's instance records (ListRecordsStrict under the lifetime judge, listRecordsStrict) and sidecar records (listed, then each read with GetSidecarRecord; any read error refuses) naming the channel; with none, it refuses unless the app has settled (retireUnsettled). The registry read is as on main. Fails closed. registry:App@424,registry:Channel@441,registry:Host@472,whole:Route@410 05c81080b1bd975c844e031830246881397e2b1864e1dc4a27bd425c77535d99 |
| internal/console/templates/app_overview.html external legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-console-remote-instances;basis=Running tile does not claim Served when a route's state is unknown and reads the existing 'no data right now' when every instance's state is unknown; Web addresses tile reads 'no data right now' instead of 'DNS & certs OK' for a domain with no reading; display only. file:external@0 2a112ff768c300894881b858e61465841c87810ca7cb1d98a0fe2a54155a0ca1 |
| -internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from remoteFacts: a box report whose rollout entry names the record's own account and app, generated after the record was created (held down: Failed; transient, unidentified or unread: Can't tell right now), readings pinned to that box and bounded by the record's created_at and the report's generation. Builds registry.Route literals from the record; reads no registry for them. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2887,whole:Route@3596,whole:Route@4110,whole:Route@4163,whole:Route@4278,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 c6e49aec6194fbb4ce76a51610708b4d9a4de82f2a8ae6a52f4ae25a1a06135b |
| +internal/console/apiinstances.go Server.instanceHealth legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Records with no local registry row get health only from remoteFacts (a box report whose rollout entry names the record's own account and app, generated after the record was created): awake is Running, held down is Failed, transient or unidentified is Can't tell right now. No metrics readings at all and no registry.Route literal for them. Local records unchanged. registry:Account@1987,registry:Account@2007,registry:App@1948,registry:App@1964,registry:Host@839,registry:Unit@2117,registry:Unit@2159,whole:Route@1151,whole:Route@2054,whole:Route@2075,whole:Route@2861,whole:Route@3852,whole:Route@3905,whole:Route@4020,whole:Route@792,whole:Route@821,whole:Route@832,whole:Route@850 3a82f379bbfbf600c1dae99bb28efc08cb6c431d7664f9eaa69f4e51dbf80fe7 |
| internal/console/view.go Assemble legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-console-remote-instances;basis=Collects the set of local registry hosts (rt.Host) so a record host the registry has gets no remote row (its record's created_at bounds the local row's metrics history); adds rows from the account's records and remoteFacts when given a remote source. registry:App@1716,registry:App@1739,registry:App@2117,registry:App@2147,registry:Backing@2017,registry:Caps@1385,registry:Channel@960,registry:Environment@1942,registry:Hibernate@1859,registry:Host@1768,registry:Host@861,registry:Kind@1783,registry:Platform@1889,registry:Provisioned@2042,registry:Status@1800,registry:Unit@1999,registry:Version@1823,whole:Route@2092,whole:Route@2167,whole:Route@810,whole:Route@839,whole:Route@910 120ae8c042523f872fd1c19357b8bb830e4afe9da1e38ad202df2ada3ad52ada |
| -@coverage internal/console b685e1f3583949edb1f14426d4e7e6ab9eb25a8afc848dc180ba8484912d8e39 |
| +@coverage internal/console 468bc2c1b1c81ac498611e8fff5570ae5d31fdd5bd15d2e4f39b95dc2cc657ec |
| @coverage internal/console/templates 76bacccad8d4be132d3f34ac6c652bdb16bc455f75f92efc12428351f9c19491 |