Skip to main content

Server Metrics API

The server metrics endpoint returns real-time health and performance data about the SuperFast backend. It is used by the built-in Server Dashboard in Settings.

Get Metricsโ€‹

GET /api/v1/server/metrics
Authorization: Bearer <token>

No query parameters.

Response (200 OK)โ€‹

{
"success": true,
"data": {
"version": "1.4.2",
"uptime_seconds": 604800,
"uptime_human": "7 days, 0 hours, 0 minutes",
"goroutines": 24,
"memory": {
"heap_used_mb": 45.2,
"heap_total_mb": 68.0,
"heap_idle_mb": 22.8,
"stack_in_use_mb": 2.1,
"gc_count": 312,
"last_gc_at": "2026-07-21T08:29:50Z"
},
"database": {
"connected": true,
"size_mb": 124.5,
"active_connections": 5,
"idle_connections": 10,
"max_connections": 25,
"tables_count": 14,
"migration_version": 8
},
"redis": {
"connected": true,
"used_memory_mb": 12.3,
"connected_clients": 3
},
"sync": {
"total_push_operations": 84521,
"total_pull_operations": 71234,
"queue_depth": 0,
"last_push_at": "2026-07-21T08:30:00Z",
"last_pull_at": "2026-07-21T08:30:01Z"
},
"whatsapp": {
"connected": true,
"instance": "superfast-store1",
"messages_sent_today": 47
},
"server": {
"go_version": "go1.22.5",
"os": "linux",
"arch": "amd64",
"cpu_cores": 2
}
}
}

Response Fields Referenceโ€‹

Top Levelโ€‹

FieldTypeDescription
versionstringSuperFast backend version (semantic versioning)
uptime_secondsintegerSeconds since the server process started
uptime_humanstringHuman-readable uptime string
goroutinesintegerNumber of active Go goroutines

memoryโ€‹

FieldTypeDescription
heap_used_mbfloatMemory currently in use by Go heap
heap_total_mbfloatTotal heap memory obtained from OS
heap_idle_mbfloatHeap memory returned to OS or idle
stack_in_use_mbfloatMemory used by goroutine stacks
gc_countintegerTotal number of GC cycles since start
last_gc_atISO 8601Timestamp of last garbage collection

databaseโ€‹

FieldTypeDescription
connectedbooleanWhether PostgreSQL connection is healthy
size_mbfloatTotal PostgreSQL database size on disk
active_connectionsintegerConnections currently executing a query
idle_connectionsintegerOpen connections waiting for work
max_connectionsintegerMax pool size configured
tables_countintegerNumber of tables in the database
migration_versionintegerCurrent database migration version

redisโ€‹

FieldTypeDescription
connectedbooleanWhether Redis is reachable
used_memory_mbfloatMemory used by Redis
connected_clientsintegerNumber of Redis client connections

syncโ€‹

FieldTypeDescription
total_push_operationsintegerTotal pushes ever received (all time)
total_pull_operationsintegerTotal pulls ever served (all time)
queue_depthintegerItems currently in the server sync queue
last_push_atISO 8601Timestamp of most recent push
last_pull_atISO 8601Timestamp of most recent pull

whatsappโ€‹

FieldTypeDescription
connectedbooleanWhatsApp session status
instancestringEvolution API instance name
messages_sent_todayintegerMessages sent since midnight (server local time)

serverโ€‹

FieldTypeDescription
go_versionstringGo runtime version
osstringOperating system (linux, windows, darwin)
archstringCPU architecture (amd64, arm64)
cpu_coresintegerNumber of logical CPU cores available

Health Check (No Auth)โ€‹

A lightweight health check endpoint that does not require authentication. Useful for load balancer health probes.

GET /api/v1/health

Response (200 OK)โ€‹

{
"status": "ok",
"version": "1.4.2",
"timestamp": "2026-07-21T08:30:00Z"
}

Response (503 Service Unavailable)โ€‹

If the database is unreachable:

{
"status": "degraded",
"version": "1.4.2",
"timestamp": "2026-07-21T08:30:00Z",
"checks": {
"database": "unreachable",
"redis": "ok"
}
}

Monitoring Recommendationsโ€‹

MetricWarning ThresholdCritical Threshold
heap_used_mb> 300 MB> 500 MB
goroutines> 100> 500
database.active_connections> 20> 24 (near max)
sync.queue_depth> 1,000> 10,000
database.connectedโ€”false
redis.connectedโ€”false