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, including database and storage availability
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. The current logic checks the database first, then performs a light readiness probe for the active node mode:

  • primary: checks that the default storage policy exists, that the driver can be instantiated, and that low-cost prerequisites such as the local storage directory are present
  • 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.

Return semantics:

  • all ready: 200
  • database unavailable: 503 with Database unavailable
  • storage unavailable: 503 with Storage unavailable

Recommended deployment usage:

  • /health for liveness / basic probing
  • /health/ready for readiness / pre-rollout probing

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.