Sandbox metrics provide timestamped CPU, memory, and disk utilization data for a sandbox.
Getting sandbox metrics
Calling the metrics API returns a list of timestamped metric records. Metrics are sampled every 5 seconds.
Getting sandbox metrics using the SDKs
import { Sandbox } from 'novita-sandbox'
const sbx = await Sandbox.create()
console.log('Created sandbox:', sbx.sandboxId)
// Allow time for metrics collection.
await new Promise((resolve) => setTimeout(resolve, 10_000))
const metrics = await sbx.getMetrics()
// Alternative by ID:
// const metrics = await Sandbox.getMetrics(sbx.sandboxId)
console.log('Metrics:', metrics)
// Example shape:
// [
// {
// timestamp: 2025-07-28T08:04:05.000Z,
// cpuUsedPct: 20.33,
// cpuCount: 2,
// memUsed: 32681984, // bytes
// memTotal: 507592704, // bytes
// diskUsed: 1514856448, // bytes
// diskTotal: 2573185024 // bytes
// },
// {
// timestamp: 2025-07-28T08:04:10.000Z,
// cpuUsedPct: 0.2,
// cpuCount: 2,
// memUsed: 33316864, // bytes
// memTotal: 507592704, // bytes
// diskUsed: 1514856448, // bytes
// diskTotal: 2573185024 // bytes
// }
// ]
Getting sandbox metrics using the CLI
novita-sandbox-cli sandbox metrics <sandbox_id>
# Example output:
# Metrics for sandbox <sandbox_id>
#
# [2025-07-25 14:05:55Z] CPU: 8.27% / 2 Cores | Memory: 31 / 484 MiB | Disk: 1445 / 2453 MiB
# [2025-07-25 14:06:00Z] CPU: 0.5% / 2 Cores | Memory: 32 / 484 MiB | Disk: 1445 / 2453 MiB
# [2025-07-25 14:06:05Z] CPU: 0.1% / 2 Cores | Memory: 32 / 484 MiB | Disk: 1445 / 2453 MiB
# [2025-07-25 14:06:10Z] CPU: 0.3% / 2 Cores | Memory: 32 / 484 MiB | Disk: 1445 / 2453 MiB
Use --follow to stream metrics continuously in real time:
novita-sandbox-cli sandbox metrics <sandbox_id> --follow
Use --format json to output machine-readable metrics:
novita-sandbox-cli sandbox metrics <sandbox_id> --format json
Metrics may not appear immediately after sandbox creation; before the first sample, the response may be empty.