Skip to main content

Get Container Stats

Retrieves a single snapshot of resource usage statistics for a specific container, including CPU, memory, network, and block I/O metrics.

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
Status Codes:
  • 200 - Success
  • 403 - Permission denied
  • 404 - Container not found or environment not found
  • 500 - Failed to get stats

Example

Response Example

Stream All Container Stats

Streams resource statistics for all running containers in an environment using Server-Sent Events (SSE). This endpoint collects stats for all containers once and closes the connection.

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
Event: 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 established
  • 403 - 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