Get Container Stats
Path Parameters
string
required
The container ID or name
Query Parameters
string
required
The environment ID where the container is located
Response
number
CPU usage percentage (0-100 per core, can exceed 100 on multi-core systems)
number
Actual memory usage in bytes (excluding cache). This is calculated by subtracting inactive file cache from total usage, matching Docker CLI behavior.
number
Raw memory usage in bytes (including cache)
number
File cache size in bytes that was subtracted from raw usage
number
Memory limit in bytes configured for the container
number
Memory usage as a percentage of the limit (0-100)
number
Total network bytes received across all interfaces
number
Total network bytes transmitted across all interfaces
number
Total bytes read from block devices
number
Total bytes written to block devices
number
Unix timestamp in milliseconds when the stats were collected
Error Responses
string
Error message if the request fails
200- Success403- Permission denied404- Container not found or environment not found500- Failed to get stats
Example
Response Example
Stream All Container Stats
Query Parameters
string
required
The environment ID to monitor
Response Format
The endpoint returns a Server-Sent Events (SSE) stream with the following event types: Event:stat
Emitted for each running container with its statistics.
string
Container ID
string
Container name
number
CPU usage percentage
number
Actual memory usage in bytes (excluding cache)
number
Raw memory usage in bytes (including cache)
number
File cache size in bytes
number
Memory limit in bytes
number
Memory usage percentage
number
Network bytes received
number
Network bytes transmitted
number
Block device bytes read
number
Block device bytes written
done
Emitted when all container stats have been collected and the stream is ending.
Event: error
Emitted if an error occurs during stats collection.
string
Error message
Error Responses
Status Codes:200- SSE stream established403- Permission denied
Example
Response Example
Notes
- The stream automatically closes after collecting stats for all containers once
- Only running containers are included in the stats collection
- Keepalive comments are sent every 5 seconds to maintain the connection
- Individual container stats collection has an 8-second timeout
- The overall container list fetch has a 10-second timeout
- Failed containers are silently skipped
