refactor(alertd): move the doctor subsystem into the alertd crate#438
Open
passcod wants to merge 2 commits into
Open
refactor(alertd): move the doctor subsystem into the alertd crate#438passcod wants to merge 2 commits into
passcod wants to merge 2 commits into
Conversation
Approved plan for TODO #10: invert the crate relationship so bestool-alertd owns the doctor framework + checks (calling bestool-tamanu for common domain code), migrate the 16 YAML alerts to checks (default FAIL, canopy owns alerting), retire the YAML alert engine + standalone CLI, then review thresholds across all checks. Co-authored-by: Claude <noreply@anthropic.com>
Relocate the doctor framework, checks, sweep orchestration, and the
DoctorTask from bestool-tamanu and bestool into bestool-alertd. alertd
now owns the monitoring engine and depends on bestool-tamanu for common
Tamanu domain code; bestool's doctor CLI keeps only arg parsing,
rendering, and daemon-fetch, calling into bestool_alertd::doctor.
This is a behaviour-preserving relocation. The one functional fix:
perform_sweep and DoctorTask take the running binary's version as a
parameter, so the wire payload reports bestool's version rather than
alertd's (env!("CARGO_PKG_VERSION") would otherwise resolve to the
library crate).
Co-authored-by: Claude <noreply@anthropic.com>
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.
🤖 Phase 1 of consolidating monitoring (TODO #10, plan in
docs/plans/healthchecks-into-alertd.md). Behaviour-preserving refactor — no check logic changes.The doctor/healthcheck subsystem was split across three crates: the
Checktype and checks inbestool-tamanu, the sweep orchestration + canopy posting inbestool, and the daemon framework inbestool-alertd. This moves the whole subsystem intobestool-alertdso the monitoring engine owns both the framework and the checks, withbestool-alertdnow depending onbestool-tamanufor common Tamanu domain code (config, discovery, services, server-info DB queries). No dependency cycle —bestool-tamanunever depends on alertd.bestool-tamanu→bestool-alertd: the entiredoctormodule (check,checks,checks/*,progress,server_infofacts), mounted atcrate::doctor.bestool→bestool-alertd:SweepResult,perform_sweep,collect_server_facts,build_payload,overall_from_payload(nowdoctor/sweep.rs) andDoctorTask(nowdoctor/task.rs), with their tests.bestoolkeeps thetamanu doctorCLI, rendering, and daemon-fetch, callingbestool_alertd::doctor.bestool-tamanuloses itsdoctorfeature and the deps only it used (bestool-kopia,hickory-resolver,owo-colors,reqwest), which move tobestool-alertd.The one mechanical change:
perform_sweepnow takes the running binary's version as a parameter instead ofenv!("CARGO_PKG_VERSION")(which would otherwise resolve to alertd's version once moved). Both callers pass bestool's version, so the wire payload is unchanged.Subsequent phases migrate the YAML alerts to checks (in alertd), retire the YAML alert engine + standalone CLI, and review thresholds.