Repository navigation
Conversation
This was referenced Oct 28, 2026
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
alex289
force-pushed
the
feat/health-history
branch
from
October 28, 2026 13:16
7762942 to
b77bc06
Compare
| FROM application_health_changes | ||
| WHERE changed_at < ? | ||
| ) WHERE position = 1 | ||
| )`, cutoff, cutoff). |
Member
There was a problem hiding this comment.
Interesting query :)
Not sure if this is really easier or which one is better:
Where(`changed_at < ? AND EXISTS (
SELECT 1 FROM application_health_changes newer
WHERE newer.application_id = application_health_changes.application_id
AND newer.changed_at < ?
AND (newer.changed_at, newer.id) > (application_health_changes.changed_at, application_health_changes.id)
)`, cutoff, cutoff)
Member
Author
There was a problem hiding this comment.
Both delete the same rows. I kept the window function because it says directly "keep the latest row before the cutoff per app". Speed doesn't matter much either way: after the first prune, only about a day of rows plus one row per app are older than the cutoff. Happy to switch to the EXISTS version if you prefer it.
Store every application health change with the failing services for context. Agent disconnects and hub restarts are recorded as unknown with an agent offline reason, using the agent's last seen time after a restart. Changes older than 30 days are pruned daily, keeping the last change before the cutoff per application.
alex289
force-pushed
the
feat/health-history
branch
from
October 28, 2026 19:45
b77bc06 to
f5a9983
Compare
Address review: skip the history lookup for reports that change nothing, use proto getters for services, trim service names after truncating and test the pruner.
This branch has not been deployed
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.
Type of change
Description
Part 2/4 of #268. Stores every change of an application's health so availability can be computed over time.
application_health_changestable (migration000036): status, optional reason, the failing services (JSON) andchanged_at. It is deleted along with its application.unknownwith reasonagent_offline. At hub startup each agent is marked offline from itslast_seentime, so hub downtime shows up as a gap instead of the last status silently continuing.