Skip to content

feat(health): count boot-time SQLite backup advisory as a metric, not just a log line #2089

Description

@JSONbored

sqliteBackupAdvisory (src/selfhost/health.ts:50) returns a one-time boot warning when running on a single unbacked SQLite file, but it's only logged — there's no gittensory metric an operator can alert on for 'this instance has no acknowledged backup', which is exactly the data-loss SPOF #1821 cares about. Expose a gittensory_backup_acknowledged gauge (1 when acknowledged or on Postgres, 0 when the advisory would fire) registered at boot.

Deliverables

  • Add a pure backupAcknowledgedGaugeValue({usingSqlite, backupAcknowledged}) helper in health.ts returning 1|0 mirroring the advisory logic
  • Register gauge("gittensory_backup_acknowledged", ...) in server.ts near the other gauges
  • Ensure it's 1 on Postgres (usingSqlite=false) and 1 when acknowledged; 0 only when the advisory fires
  • Unit tests for all three input combinations (both branches of the advisory condition)

References

  • src/selfhost/health.ts:50
  • src/server.ts:504
  • src/selfhost/metrics.ts:54

Part of #1821.


size: XS · gittensor:bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions