Skip to content
AsterDrive Developer DocsDeveloper

Health Checks

Health checks are mounted at the repository root, not under /api/v1.

Both primary and follower nodes register this group.

MethodPathDescription
GET / HEAD/healthLiveness check
GET / HEAD/health/readyReadiness check covering the database, setup state, and lightweight prerequisites for the active node mode
GET/health/memoryHeap statistics, registered only in debug_assertions + openapi builds
GET/health/metricsPrometheus metrics, present only when the metrics feature is enabled

Typical response:

{
"code": "success",
"msg": "",
"data": {
"status": "ok",
"version": "0.0.0",
"build_time": "2026-03-22T00:00:00Z"
}
}

build_time comes from the compile-time ASTER_BUILD_TIME environment variable. When the variable is unset, the build script falls back to the current UTC time.

HEAD /health has the same semantics, but returns no body.

This endpoint does more than a database ping. It checks the database and the active cache backend for every deployment profile. The single profile remains ready when an unavailable configured remote cache falls back to a healthy memory cache, while diagnostics report that state as degraded. Shared-runtime profiles require both the configured and active backend to be Redis. It then continues according to node mode:

  • primary: validates dynamic cluster topology and the authoritative setup state. needs_admin and needs_storage return 200 immediately; only ready requires a default storage policy, a constructible driver, and that driver’s lightweight readiness check
  • follower: checks the follower’s active storage driver and the state required for binding

This endpoint is meant to stay cheap. It does not perform remote S3 or remote-storage read/write/delete probes. Use the admin policy “test connection” action when you need to verify object storage credentials or permissions.

Successful primary responses use one of three data.status values:

  • needs_admin: 200; base dependencies are healthy, but the first administrator does not exist
  • needs_storage: 200; an administrator exists, but the default storage policy group or administrator assignment is incomplete
  • ready: 200; product setup is complete and the default driver’s lightweight readiness check passed

Error responses:

  • database unavailable: 503 with Database unavailable
  • an unhealthy active cache: 503 with Cache unavailable; in cluster deployments, an active backend that differs from configuration also returns 503, and both the configured and active backend must be Redis
  • invalid cluster topology, missing default policy, driver-construction failure, or lightweight readiness failure: 503 with Storage unavailable

Recommended deployment usage:

  • /health for liveness / basic probing
  • /health/ready for Kubernetes readiness; final launch validation must also require data.status = "ready"

Only debug_assertions + openapi builds register this endpoint.

It reports current heap allocation and peak usage as MB strings.

Only compiled when the metrics feature is enabled. Output is Prometheus text exposition.

If you need metrics, build with:

Terminal window
cargo build --release --features metrics

or:

Terminal window
cargo build --release --features full

The application layer does not add authentication here. In production, access must be restricted by reverse proxy, firewall, security group, or internal-only binding.

HTTP and database:

MetricLabelsNotes
http_requests_totalmethod, route, statusRequest count
http_request_duration_secondsmethod, route, statusRequest latency histogram
db_queries_totalbackend, kind, statusSeaORM query count
db_query_duration_secondsbackend, kind, statusSeaORM query latency histogram

Auth, upload, download, and tasks:

MetricLabelsNotes
auth_events_totalaction, status, reasonLogin and refresh-token events
file_uploads_totalmode, statusUpload outcomes across direct / chunked / presigned modes
file_downloads_totalsource, outcome, rangeDownload outcomes
upload_sessions_totalmodeCreated upload sessions
upload_session_events_totalmode, event, statusSession lifecycle events
background_tasks_totalkind, statusTask state transitions
background_task_retries_totalkindRetry count
background_tasks_pendingnoneCurrent Pending / Retry backlog

Storage drivers and share rollback:

MetricLabelsNotes
storage_driver_operations_totaldriver, operation, status, kindDriver operations
storage_driver_operation_duration_secondsdriver, operation, status, kindDriver latency histogram
share_download_rollback_events_totaleventRollback queue events after interrupted public-share downloads
share_download_rollback_pendingnonePending rollback work

Process metrics:

MetricLabelsNotes
process_memory_rss_bytesnoneResident set size
process_cpu_milliseconds_totalnoneTotal CPU time in milliseconds
process_uptime_secondsnoneUptime since metrics initialization

process_cpu_milliseconds_total is already exposed in milliseconds. process_uptime_seconds is monotonic rather than epoch-based.