Skip to content

feat(health): enrich /health with version, uptime, and backend fingerprint #2077

Description

@JSONbored

GET /health returns a bare {status:"ok"} (src/server.ts:558-561) with no way to confirm which image/commit is running or how long it has been up — operators can't tell after a deploy whether the new build actually rolled. Enrich the liveness body with version (from package.json or a build-time env), uptimeSeconds (Date.now()-startedAt, already tracked at server.ts:523), and the DB backend name (sqlite|postgres). Keep it binding-free (no DB call — that's /ready's job).

Deliverables

  • Add a buildHealthBody({version, startedAt, dbBackend}) helper in src/selfhost/health.ts returning {status:"ok", version, uptimeSeconds, backend}
  • Wire it into the /health branch of server.ts, reusing the existing startedAt
  • Source version from process.env.GITTENSORY_VERSION with a package.json fallback; never throw if unset (report "unknown")
  • Unit tests for buildHealthBody: version present vs unset (both arms of the ?? fallback), uptime rounding, each backend value

References

  • src/server.ts:558
  • src/server.ts:523
  • src/selfhost/health.ts:5

size: S · gittensor:feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions