Repository navigation
Measure server status age from the last observation - #341
Merged
Merged
Conversation
A server row is not rewritten when its status is unchanged, so its own update time ages forever and a healthy server eventually looks stale. The reconciler's sweep is the observation: pass its completion time into the health snapshot and treat every stored status as fresh when the sweep is recent. A row that was written recently is still trusted on its own, and without a sweep the previous per-row behaviour is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/health/detailon the dev instance reported the game layerunknownwith 2 stale servers after two minutes of uptime, while both servers were running healthily.A server row is only rewritten when its observed status changes. A server that stays running therefore keeps its original
updated_at, and once that ages past the staleness windowhealth.Computecorrectly concludes no observation is recent — but the observation did happen, every sweep.Fix
The reconciler's sweep is the observation.
enqueueAllrecords when it finished observing every server, and the health snapshot receives that time asInput.ObservedAt:The unobserved layer still reports
unknown, neverok— the state machine is untouched; only the observation clock is now honest.Verification
go build ./...,go vet ./...,go test ./internal/health/... ./internal/reconciler/...greenunknown; no sweep falls back to per-row ageTestLastSweepAtAdvancesWithASweepcovers the reconciler clock