Get Container Stats
Path Parameters
The container ID or name
Query Parameters
The environment ID where the container is located
Response
CPU usage percentage (0-100 per core, can exceed 100 on multi-core systems)
Actual memory usage in bytes (excluding cache). This is calculated by subtracting inactive file cache from total usage, matching Docker CLI behavior.
Raw memory usage in bytes (including cache)
File cache size in bytes that was subtracted from raw usage
Memory limit in bytes configured for the container
Memory usage as a percentage of the limit (0-100)
Total network bytes received across all interfaces
Total network bytes transmitted across all interfaces
Total bytes read from block devices
Total bytes written to block devices
Unix timestamp in milliseconds when the stats were collected
Error Responses
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
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.
Container ID
Container name
CPU usage percentage
Actual memory usage in bytes (excluding cache)
Raw memory usage in bytes (including cache)
File cache size in bytes
Memory limit in bytes
Memory usage percentage
Network bytes received
Network bytes transmitted
Block device bytes read
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.
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
