Skip to content

Database metrics

PandaStack exposes two distinct views of a running database: engine metrics (connections, queries per second, cache hit ratio) sourced from Managed Prometheus, and a live pod snapshot (phase, CPU, memory, restarts) from the Kubernetes cluster. Both are read live through worker-v3.

Database engine metrics are a paid feature, sourced from KubeBlocks Managed Prometheus via the postgres / mysqld exporters. They describe how the database engine itself is behaving.

GET /v1/databases/:id/engine-metrics

Returns DatabaseEngineMetricsSummary:

FieldTypeNotes
rangeenumThe time range (1h, 24h, 7d, 30d)
enabledbooleanWhether metrics are available/enabled
enginestringpostgresql or mysql
upboolean (nullable)Whether the engine exporter reports the DB up
connectionsnumber (nullable)Current active connections
maxConnectionsnumber (nullable)Configured connection ceiling
connectionsPctnumber (nullable)Connections as a percentage (0–100) of max
qpsnumber (nullable)Queries / transactions per second
cacheHitPctnumber (nullable)Cache hit ratio, 0–100

All numeric fields are nullable — the UI shows - when no sample has been reported.

{
"success": true,
"data": {
"range": "24h",
"enabled": true,
"engine": "postgresql",
"up": true,
"connections": 12,
"maxConnections": 300,
"connectionsPct": 4,
"qps": 87.4,
"cacheHitPct": 99.1
}
}

GET /v1/databases/:id/engine-metrics/timeseries

Returns DatabaseEngineMetricsTimeseries — a series of points for charting connections, QPS, and cache hit ratio over the window:

FieldTypeNotes
rangeenum1h / 24h / 7d / 30d
enabledbooleanWhether metrics are available
enginestringpostgresql or mysql
pointsarraySee point shape below

Each DatabaseEngineMetricsPoint:

FieldTypeNotes
tstringISO bucket timestamp
connectionsnumber (nullable)Connections at that bucket
qpsnumber (nullable)QPS at that bucket
cacheHitPctnumber (nullable)Cache hit ratio at that bucket

A null point means no sample was taken in that bucket, so the chart draws a gap rather than a fabricated value.

RangeWindow
1hLast hour
24hLast 24 hours
7dLast 7 days
30dLast 30 days

Separate from engine metrics, PandaStack surfaces a live pod snapshot of the database’s Kubernetes workload, sourced through worker-v3 (/internal/db/metrics). This is DatabaseMetrics:

FieldTypeNotes
availablebooleanWhether a live snapshot was obtained
phasestring (nullable)Pod phase, e.g. Running, Pending
readybooleanWhether the pod is ready
restartsnumberContainer restart count
startedAtstring (nullable)When the pod started
cpuMillinumber (nullable)Current total CPU in millicores
memoryMiBnumber (nullable)Current total memory in MiB
containersarrayPer-container CPU/memory

Each DatabaseContainerMetric: name, cpuMilli, memoryMiB.

{
"success": true,
"data": {
"available": true,
"phase": "Running",
"ready": true,
"restarts": 0,
"startedAt": "2026-07-14T02:00:00.000Z",
"cpuMilli": 45,
"memoryMiB": 312,
"containers": [
{ "name": "postgresql", "cpuMilli": 40, "memoryMiB": 300 },
{ "name": "metrics-exporter", "cpuMilli": 5, "memoryMiB": 12 }
]
}
}